UnfilteredDeserializer (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db

## Class UnfilteredDeserializer

- java.lang.Object
- - org.apache.cassandra.db.UnfilteredDeserializer

- Direct Known Subclasses:
    UnfilteredDeserializer.OldFormatDeserializer

      public abstract class UnfilteredDeserializer
      extends java.lang.Object

  Helper class to deserialize Unfiltered object from disk efficiently. More precisely, this class is used by the low-level reader to ensure we don't do more work than necessary (i.e. we don't allocate/deserialize objects for things we don't care about).

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `UnfilteredDeserializer.OldFormatDeserializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SerializationHelper` | `helper`
    `protected DataInputPlus` | `in`
    `protected CFMetaData` | `metadata`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `UnfilteredDeserializer(CFMetaData metadata, DataInputPlus in, SerializationHelper helper)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract long` | `bytesReadForUnconsumedData()` For the legacy layout deserializer, we have to deal with the fact that a row can span multiple index blocks and that the call to hasNext() reads the next element upfront.
    `abstract void` | `clearState()` Clears any state in this deserializer.
    `abstract int` | `compareNextTo(ClusteringBound bound)` Compare the provided bound to the next atom to read on disk.
    `static UnfilteredDeserializer` | `create(CFMetaData metadata, DataInputPlus in, SerializationHeader header, SerializationHelper helper, DeletionTime partitionDeletion, boolean readAllAsDynamic)`
    `abstract boolean` | `hasNext()` Whether or not there is more atom to read.
    `abstract boolean` | `nextIsRow()` Returns whether the next atom is a row or not.
    `abstract boolean` | `nextIsStatic()` Returns whether the next atom is the static row or not.
    `abstract Unfiltered` | `readNext()` Returns the next atom.
    `abstract void` | `skipNext()` Skips the next atom.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### metadata

          protected final CFMetaData metadata

    - #### in

          protected final DataInputPlus in

    - #### helper

          protected final SerializationHelper helper

  - ### Constructor Detail

    - #### UnfilteredDeserializer

          protected UnfilteredDeserializer(CFMetaData metadata,
                                           DataInputPlus in,
                                           SerializationHelper helper)

  - ### Method Detail

    - #### create

          public static UnfilteredDeserializer create(CFMetaData metadata,
                                                      DataInputPlus in,
                                                      SerializationHeader header,
                                                      SerializationHelper helper,
                                                      DeletionTime partitionDeletion,
                                                      boolean readAllAsDynamic)

    - #### hasNext

          public abstract boolean hasNext()
                                   throws java.io.IOException

      Whether or not there is more atom to read.
      Throws:
        `java.io.IOException`

    - #### compareNextTo

          public abstract int compareNextTo(ClusteringBound bound)
                                     throws java.io.IOException

      Compare the provided bound to the next atom to read on disk. This will not read/deserialize the whole atom but only what is necessary for the comparison. Whenever we know what to do with this atom (read it or skip it), readNext or skipNext should be called.
      Throws:
        `java.io.IOException`

    - #### nextIsRow

          public abstract boolean nextIsRow()
                                     throws java.io.IOException

      Returns whether the next atom is a row or not.
      Throws:
        `java.io.IOException`

    - #### nextIsStatic

          public abstract boolean nextIsStatic()
                                        throws java.io.IOException

      Returns whether the next atom is the static row or not.
      Throws:
        `java.io.IOException`

    - #### readNext

          public abstract Unfiltered readNext()
                                       throws java.io.IOException

      Returns the next atom.
      Throws:
        `java.io.IOException`

    - #### clearState

          public abstract void clearState()
                                   throws java.io.IOException

      Clears any state in this deserializer.
      Throws:
        `java.io.IOException`

    - #### skipNext

          public abstract void skipNext()
                                 throws java.io.IOException

      Skips the next atom.
      Throws:
        `java.io.IOException`

    - #### bytesReadForUnconsumedData

          public abstract long bytesReadForUnconsumedData()

      For the legacy layout deserializer, we have to deal with the fact that a row can span multiple index blocks and that the call to hasNext() reads the next element upfront. We must take that into account when we check in AbstractSSTableIterator if we're past the end of an index block boundary as that check expect to account for only consumed data (that is, if hasNext has been called and made us cross an index boundary but neither readNext() or skipNext() as yet been called, we shouldn't consider the index block boundary crossed yet). TODO: we don't care about this for the current file format because a row can never span multiple index blocks (further, hasNext() only just basically read 2 bytes from disk in that case). So once we drop backward compatibility with pre-3.0 sstable, we should remove this.

Copyright © 2018 The Apache Software Foundation