Package io.deephaven.engine.rowset.impl
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
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.rowset.RowSequence
RowSequence.Iterator -
Field Summary
Fields inherited from interface io.deephaven.engine.rowset.RowSequence
NULL_ROW_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal LongChunk<OrderedRowKeys> Get aLongChunkrepresentation of the individual row keys in thisRowSequence.final LongChunk<OrderedRowKeyRanges> Get aLongChunkrepresentation of row key ranges in thisRowSequence.voidclose()Free any resources associated with this object.protected final voidClose any resources associated with this RowSequenceAsChunkImpl.protected final voidInvalidate the cached chunks after a modification.abstract longGet the last row key in thisRowSequence.abstract longprotected longMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.util.datastructures.LongSizedDataStructure
intSize, intSizeMethods inherited from interface io.deephaven.engine.rowset.RowSequence
asRowSet, fillRowKeyChunk, fillRowKeyRangesChunk, firstRowKey, forAllRowKeyRanges, forAllRowKeys, forEachRowKey, forEachRowKeyRange, getAverageRunLengthEstimate, getRowSequenceByKeyRange, getRowSequenceByPosition, getRowSequenceIterator, isContiguous, isEmpty, size
-
Constructor Details
-
RowSequenceAsChunkImpl
public RowSequenceAsChunkImpl()
-
-
Method Details
-
runsUpperBound
protected long runsUpperBound() -
asRowKeyChunk
Description copied from interface:RowSequenceGet aLongChunkrepresentation of the individual row keys in thisRowSequence.- Specified by:
asRowKeyChunkin interfaceRowSequence- Returns:
- A
LongChunkcontaining the row keys in thisRowSequence
-
asRowKeyRangesChunk
Description copied from interface:RowSequenceGet aLongChunkrepresentation of row key ranges in thisRowSequence.- Specified by:
asRowKeyRangesChunkin interfaceRowSequence- Returns:
- A
LongChunkcontaining the row key ranges in thisRowSequence
-
lastRowKey
public abstract long lastRowKey()Description copied from interface:RowSequenceGet the last row key in thisRowSequence.- Specified by:
lastRowKeyin interfaceRowSequence- Returns:
- The last row key, or
RowSequence.NULL_ROW_KEYif there is none.
-
rangesCountUpperBound
public abstract long rangesCountUpperBound() -
close
@OverridingMethodsMustInvokeSuper public void close()Description copied from interface:RowSequenceFree any resources associated with this object.
Using any
RowSequencemethods afterclose()is an error and may produce exceptions or undefined results.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRowSequence- Specified by:
closein interfaceSafeCloseable
-
closeRowSequenceAsChunkImpl
protected final void closeRowSequenceAsChunkImpl()Close any resources associated with this RowSequenceAsChunkImpl. This is the implementation forclose, made available for subclasses that have a need to release parent class resources independently of their owncloseimplementation. Most uses should prefer toinvalidate, 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.
-