Class RowSequenceAsChunkImpl

java.lang.Object
io.deephaven.engine.rowset.impl.RowSequenceAsChunkImpl
All Implemented Interfaces:
RowSequence, LongSizedDataStructure, SafeCloseable, AutoCloseable
Direct Known Subclasses:
RspRowSequence, ShiftedRowSequence, SingleRangeRowSequence, SortedRangesRowSequence, WritableRowSetImpl

public abstract class RowSequenceAsChunkImpl extends Object implements RowSequence
Base for RowSequence implementations that cache the results of asRowKeyChunk() and asRowKeyRangesChunk().

Concurrent readers of an unmodified sequence may call either method. A chunk is filled while only the filling thread can see it, and is published with a compare-and-set; a published chunk is never refilled. Invalidation moves the published chunk to a stale slot, from which a later build may claim it exclusively and refill it. Invalidation and close() are mutations, so they must not run concurrently with readers, and a reader must not use a chunk after the sequence is modified.

  • Constructor Details

    • RowSequenceAsChunkImpl

      public RowSequenceAsChunkImpl()
  • Method Details

    • runsUpperBound

      protected long runsUpperBound()
    • asRowKeyChunk

      public final LongChunk<OrderedRowKeys> asRowKeyChunk()
      Description copied from interface: RowSequence
      Get a LongChunk representation of the individual row keys in this RowSequence.
      Specified by:
      asRowKeyChunk in interface RowSequence
      Returns:
      A LongChunk containing the row keys in this RowSequence
    • asRowKeyRangesChunk

      public final LongChunk<OrderedRowKeyRanges> asRowKeyRangesChunk()
      Description copied from interface: RowSequence
      Get a LongChunk representation of row key ranges in this RowSequence.
      Specified by:
      asRowKeyRangesChunk in interface RowSequence
      Returns:
      A LongChunk containing the row key ranges in this RowSequence
    • lastRowKey

      public abstract long lastRowKey()
      Description copied from interface: RowSequence
      Get the last row key in this RowSequence.
      Specified by:
      lastRowKey in interface RowSequence
      Returns:
      The last row key, or RowSequence.NULL_ROW_KEY if there is none.
    • rangesCountUpperBound

      public abstract long rangesCountUpperBound()
    • close

      @OverridingMethodsMustInvokeSuper public void close()
      Description copied from interface: RowSequence

      Free any resources associated with this object.

      Using any RowSequence methods after close() is an error and may produce exceptions or undefined results.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface RowSequence
      Specified by:
      close in interface SafeCloseable
    • closeRowSequenceAsChunkImpl

      protected final void closeRowSequenceAsChunkImpl()
      Close any resources associated with this RowSequenceAsChunkImpl. This is the implementation for close, made available for subclasses that have a need to release parent class resources independently of their own close implementation. Most uses should prefer to invalidate, instead.
    • invalidateRowSequenceAsChunkImpl

      protected final void invalidateRowSequenceAsChunkImpl()
      Invalidate the cached chunks after a modification. The published chunks become stale and may be refilled by the next build, so no reader may use a chunk obtained before the modification.