AbstractNativeCell (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.db

## Class AbstractNativeCell

- java.lang.Object
- - org.apache.cassandra.db.AbstractCell
  - - org.apache.cassandra.db.AbstractNativeCell

- All Implemented Interfaces:
    IMeasurableMemory, Cell, CellName, Composite, OnDiskAtom
  Direct Known Subclasses:
    NativeCell

      public abstract class AbstractNativeCell
      extends AbstractCell
      implements CellName

  Packs a CellName AND a Cell into one off-heap representation. Layout is: Note we store the ColumnIdentifier in full as bytes. This seems an okay tradeoff for now, as we just look it back up again when we need to, and in the near future we hope to switch to ints, longs or UUIDs representing column identifiers on disk, at which point we can switch that here as well. [timestamp][value offset][name size]][name extra][name offset deltas][cell names][value][Descendants] [ 8b ][ 4b ][ 2b ][ 1b ][ each 2b ][ arb < 64k][ arb ][ arbitrary ] descendants: any overriding classes will put their state here name offsets are deltas from their base offset, and don't include the first offset, or the end position of the final entry, i.e. there will be size - 1 entries, and each is a delta that is added to the offset of the position of the first name (which is always CELL_NAME_OFFSETS_OFFSET + (2 * (size - 1))). The length of the final name fills up any remaining space upto the value offset name extra: lowest 2 bits indicate the clustering size delta (i.e. how many name items are NOT part of the clustering key) the next 2 bits indicate the CellNameType the next bit indicates if the column is a static or clustered/dynamic column

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.db.composites.Composite

      `Composite.EOC`

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.db.OnDiskAtom

      `OnDiskAtom.Serializer`

  - ### Field Summary

    - ### Fields inherited from interface org.apache.cassandra.db.Cell

      `MAX_NAME_LENGTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractNativeCell(NativeAllocator allocator, OpOrder.Group writeOp, Cell copyOf)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `clusteringSize()` The number of clustering components.
    `java.nio.ByteBuffer` | `collectionElement()` The value of the collection element, or null if the cell is not part of a collection (i.e.
    `int` | `compareTo(Composite that)`
    `int` | `compareToSimple(Composite that)`
    `protected void` | `construct(Cell from)`
    `CellName` | `copy(CFMetaData cfm, AbstractAllocator allocator)`
    `ColumnIdentifier` | `cql3ColumnName(CFMetaData metadata)` The name of the CQL3 column this cell represents.
    `int` | `dataSize()`
    `Composite` | `end()`
    `Composite.EOC` | `eoc()`
    `boolean` | `equals(CellName that)`
    `boolean` | `equals(java.lang.Object obj)`
    `java.nio.ByteBuffer` | `get(int i)`
    `protected byte` | `getByte(long offset)`
    `protected java.nio.ByteBuffer` | `getByteBuffer(long offset, int length)`
    `protected void` | `getBytes(long offset, byte[] trg, int trgOffset, int count)`
    `protected int` | `getInt(long offset)`
    `protected long` | `getLong(long offset)`
    `protected int` | `getShort(long offset)`
    `protected long` | `internalSize()`
    `boolean` | `isCollectionCell()`
    `boolean` | `isEmpty()`
    `boolean` | `isPrefixOf(CType type, Composite c)`
    `boolean` | `isSameCQL3RowAs(CellNameType type, CellName other)` Whether this cell is part of the same CQL3 row as the other cell.
    `boolean` | `isStatic()`
    `long` | `maxTimestamp()`
    `long` | `minTimestamp()`
    `protected int` | `postfixSize()`
    `protected void` | `setByte(long offset, byte b)`
    `protected void` | `setBytes(long offset, java.nio.ByteBuffer buffer)`
    `protected void` | `setInt(long offset, int l)`
    `protected void` | `setLong(long offset, long l)`
    `protected void` | `setShort(long offset, short s)`
    `int` | `size()`
    `protected int` | `sizeOf(Cell cell)`
    `ColumnSlice` | `slice()`
    `Composite` | `start()`
    `java.nio.ByteBuffer` | `toByteBuffer()`
    `protected void` | `updateWithName(java.security.MessageDigest digest)`
    `protected void` | `updateWithValue(java.security.MessageDigest digest)`
    `java.nio.ByteBuffer` | `value()`
    `Composite` | `withEOC(Composite.EOC eoc)`
    `Cell` | `withUpdatedName(CellName newName)`
    `Cell` | `withUpdatedTimestamp(long newTimestamp)`
    `protected void` | `writeComponentTo(java.security.MessageDigest digest, int i, boolean includeSize)`
    `protected void` | `writeMemoryTo(java.security.MessageDigest digest, int from, int count)`

    - ### Methods inherited from class org.apache.cassandra.db.AbstractCell

      `cellDataSize, create, diff, diffCounter, equals, getLocalDeletionTime, getString, hashCode, isLive, isLive, onDiskIterator, reconcile, reconcileCounter, serializationFlags, serializedSize, updateDigest, validateFields, validateName`

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

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

    - ### Methods inherited from interface org.apache.cassandra.db.composites.CellName

      `unsharedHeapSizeExcludingData`

    - ### Methods inherited from interface org.apache.cassandra.cache.IMeasurableMemory

      `unsharedHeapSize`

    - ### Methods inherited from interface org.apache.cassandra.db.Cell

      `localCopy, localCopy, name, unsharedHeapSizeExcludingData`

    - ### Methods inherited from interface org.apache.cassandra.db.OnDiskAtom

      `timestamp`

- - ### Constructor Detail

    - #### AbstractNativeCell

          public AbstractNativeCell(NativeAllocator allocator,
                            OpOrder.Group writeOp,
                            Cell copyOf)

  - ### Method Detail

    - #### sizeOf

          protected int sizeOf(Cell cell)

    - #### construct

          protected void construct(Cell from)

    - #### postfixSize

          protected int postfixSize()

    - #### value

          public java.nio.ByteBuffer value()

      Specified by:
        `value` in interface `Cell`

    - #### isStatic

          public boolean isStatic()

      Specified by:
        `isStatic` in interface `Composite`

    - #### minTimestamp

          public long minTimestamp()

    - #### maxTimestamp

          public long maxTimestamp()

    - #### clusteringSize

          public int clusteringSize()

      Description copied from interface: `CellName`
      The number of clustering components. It can be 0 if the table has no clustering columns, and it can be equal to size() if the table is dense() (in which case cql3ColumnName() will be null).
      Specified by:
        `clusteringSize` in interface `CellName`

    - #### cql3ColumnName

          public ColumnIdentifier cql3ColumnName(CFMetaData metadata)

      Description copied from interface: `CellName`
      The name of the CQL3 column this cell represents. Will be null for cells of "dense" tables.
      Specified by:
        `cql3ColumnName` in interface `CellName`

    - #### collectionElement

          public java.nio.ByteBuffer collectionElement()

      Description copied from interface: `CellName`
      The value of the collection element, or null if the cell is not part of a collection (i.e. if !isCollectionCell()).
      Specified by:
        `collectionElement` in interface `CellName`

    - #### isCollectionCell

          public boolean isCollectionCell()

      Specified by:
        `isCollectionCell` in interface `CellName`

    - #### isSameCQL3RowAs

          public boolean isSameCQL3RowAs(CellNameType type,
                                CellName other)

      Description copied from interface: `CellName`
      Whether this cell is part of the same CQL3 row as the other cell.
      Specified by:
        `isSameCQL3RowAs` in interface `CellName`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Composite`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Composite`

    - #### get

          public java.nio.ByteBuffer get(int i)

      Specified by:
        `get` in interface `Composite`

    - #### writeComponentTo

          protected void writeComponentTo(java.security.MessageDigest digest,
                              int i,
                              boolean includeSize)

    - #### writeMemoryTo

          protected void writeMemoryTo(java.security.MessageDigest digest,
                           int from,
                           int count)

    - #### eoc

          public Composite.EOC eoc()

      Specified by:
        `eoc` in interface `Composite`

    - #### withEOC

          public Composite withEOC(Composite.EOC eoc)

      Specified by:
        `withEOC` in interface `Composite`

    - #### start

          public Composite start()

      Specified by:
        `start` in interface `Composite`

    - #### end

          public Composite end()

      Specified by:
        `end` in interface `Composite`

    - #### slice

          public ColumnSlice slice()

      Specified by:
        `slice` in interface `Composite`

    - #### isPrefixOf

          public boolean isPrefixOf(CType type,
                           Composite c)

      Specified by:
        `isPrefixOf` in interface `Composite`

    - #### toByteBuffer

          public java.nio.ByteBuffer toByteBuffer()

      Specified by:
        `toByteBuffer` in interface `Composite`

    - #### updateWithName

          protected void updateWithName(java.security.MessageDigest digest)

    - #### updateWithValue

          protected void updateWithValue(java.security.MessageDigest digest)

    - #### dataSize

          public int dataSize()

      Specified by:
        `dataSize` in interface `Composite`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `AbstractCell`

    - #### equals

          public boolean equals(CellName that)

    - #### copy

          public CellName copy(CFMetaData cfm,
                      AbstractAllocator allocator)

      Specified by:
        `copy` in interface `CellName`
      Specified by:
        `copy` in interface `Composite`

    - #### withUpdatedName

          public Cell withUpdatedName(CellName newName)

      Specified by:
        `withUpdatedName` in interface `Cell`

    - #### withUpdatedTimestamp

          public Cell withUpdatedTimestamp(long newTimestamp)

      Specified by:
        `withUpdatedTimestamp` in interface `Cell`

    - #### internalSize

          protected long internalSize()

    - #### setByte

          protected final void setByte(long offset,
                     byte b)

    - #### setShort

          protected final void setShort(long offset,
                      short s)

    - #### setInt

          protected final void setInt(long offset,
                    int l)

    - #### setLong

          protected final void setLong(long offset,
                     long l)

    - #### setBytes

          protected final void setBytes(long offset,
                      java.nio.ByteBuffer buffer)

    - #### getByte

          protected final byte getByte(long offset)

    - #### getBytes

          protected final void getBytes(long offset,
                      byte[] trg,
                      int trgOffset,
                      int count)

    - #### getShort

          protected final int getShort(long offset)

    - #### getInt

          protected final int getInt(long offset)

    - #### getLong

          protected final long getLong(long offset)

    - #### getByteBuffer

          protected final java.nio.ByteBuffer getByteBuffer(long offset,
                                          int length)

    - #### compareTo

          @Inline
          public final int compareTo(Composite that)

    - #### compareToSimple

          public final int compareToSimple(Composite that)

Copyright © 2014 The Apache Software Foundation