Interface WritableRowRedirection
- All Superinterfaces:
ChunkSink<RowKeys>,ChunkSource<RowKeys>,ChunkSource.WithPrev<RowKeys>,DefaultChunkSource<RowKeys>,DefaultChunkSource.WithPrev<RowKeys>,FillContextMaker,FillUnordered<RowKeys>,GetContextMaker,RowRedirection
- All Known Implementing Classes:
ContiguousWritableRowRedirection,GroupedWritableRowRedirection,IntColumnSourceWritableRowRedirection,LongColumnSourceWritableRowRedirection,WritableRowRedirectionLockFree
Writable
RowRedirection.
A WritableRowRedirection can be in one of two states: tracking prev values or not. The typical lifecycle looks like
this:
- A WritableRowRedirection is created with an initial map, but not tracking prev values. In this state, get() and getPrev() behave identically; put() and remove() affect current values but do no "prev value" tracking.
- Prev value tracking begins when the caller calls startTrackingPrevValues(). Immediately after this call, the data is logically "forked": getPrev() will still refer to the same set of entries as before; this set will be frozen until the end of the generation.
- Additionally, a terminal listener will be registered so that the prev map will be updated at the end of the generation.
- Meanwhile, get(), put(), and remove() will logically refer to a fork of that map: it will initially have the same entries as prev, but it will diverge over time as the caller does put() and remove() operations.
- At the end of the generation (when the TerminalListener runs), the prev set is (logically) discarded, prev gets current, and current becomes the new fork of the map.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceFactory for producing WritableRowRedirections and their components.Nested classes/interfaces inherited from interface io.deephaven.engine.table.ChunkSink
ChunkSink.FillFromContextNested classes/interfaces inherited from interface io.deephaven.engine.table.ChunkSource
ChunkSource.FillContext, ChunkSource.GetContext, ChunkSource.WithPrev<ATTR extends Any>Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
DefaultChunkSource.SupportsContiguousGet<ATTR extends Any>, DefaultChunkSource.WithPrev<ATTR extends Any> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChunkSink.FillFromContextA basic, empty, singleton defaultChunkSink.FillFromContextinstance.static final WritableRowRedirection.FactoryFields inherited from interface io.deephaven.engine.table.ChunkSource
DEFAULT_FILL_INSTANCE, ZERO_LENGTH_CHUNK_SOURCE_ARRAYFields inherited from interface io.deephaven.engine.table.ChunkSource.WithPrev
ZERO_LENGTH_CHUNK_SOURCE_WITH_PREV_ARRAY -
Method Summary
Modifier and TypeMethodDescriptiondefault voidapplyShift(RowSet tableRowSet, RowSetShiftData shiftData) Update this WritableRowRedirection according to aRowSetShiftData.default voidfillFromChunk(ChunkSink.FillFromContext fillFromContext, @NotNull Chunk<? extends RowKeys> innerRowKeys, @NotNull RowSequence outerRowKeys) Insert mappings from each element in aRowSequenceto the parallel element in aLongChunk.default voidfillFromChunkUnordered(@NotNull ChunkSink.FillFromContext context, @NotNull Chunk<? extends RowKeys> innerRowKeys, @NotNull LongChunk<RowKeys> outerRowKeys) Fills the ChunkSink with data from the source, with data corresponding to the keys from the given key chunk.default ChunkSink.FillFromContextmakeFillFromContext(int chunkCapacity) Make aChunkSink.FillFromContextfor this WritableRowRedirection.longput(long outerRowKey, long innerRowKey) Add or change a mapping fromouterRowKeytoinnerRowKey.default voidputVoid(long outerRowKey, long innerRowKey) Likeput(long, long), but without requiring the implementation to provide a return value.longremove(long outerRowKey) Remove a mapping fromouterRowKey.default voidremoveAll(RowSequence rowSequence) Remove the specifiedrowSequence.default voidremoveAllUnordered(LongChunk<RowKeys> outerRowKeys) Remove the specifiedouterRowKeys.default voidremoveVoid(long outerRowKey) Likeremove(long)(long, long)}, but without requiring the implementation to provide a return value.voidInitiate previous value tracking.Methods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource
getChunk, getChunk, getChunkByFilling, makeFillContext, makeGetContextMethods inherited from interface io.deephaven.engine.table.impl.DefaultChunkSource.WithPrev
getPrevChunk, getPrevChunk, getPrevChunkByFilling, getPrevSourceMethods inherited from interface io.deephaven.engine.table.FillContextMaker
makeFillContextMethods inherited from interface io.deephaven.engine.table.GetContextMaker
makeGetContextMethods inherited from interface io.deephaven.engine.table.impl.util.RowRedirection
ascendingMapping, fillChunk, fillChunkUnordered, fillPrevChunk, fillPrevChunkUnordered, get, getChunkType, getPrev, isWritable, providesFillUnordered, writableCast
-
Field Details
-
DEFAULT_FILL_FROM_INSTANCE
A basic, empty, singleton defaultChunkSink.FillFromContextinstance. -
FACTORY
-
-
Method Details
-
startTrackingPrevValues
void startTrackingPrevValues()Initiate previous value tracking. -
put
long put(long outerRowKey, long innerRowKey) Add or change a mapping fromouterRowKeytoinnerRowKey.- Parameters:
outerRowKey- The outer row key to map frominnerRowKey- The inner row key to map to- Returns:
- The inner row key previously mapped from
outerRowKey, orRowSequence.NULL_ROW_KEYif there was no mapping
-
remove
long remove(long outerRowKey) Remove a mapping fromouterRowKey.- Parameters:
outerRowKey- The outer row key to unmap- Returns:
- The inner row key previously mapped from
outerRowKey, orRowSequence.NULL_ROW_KEYif there was no mapping
-
putVoid
default void putVoid(long outerRowKey, long innerRowKey) Likeput(long, long), but without requiring the implementation to provide a return value. May be more efficient in some cases.- Parameters:
outerRowKey- The outer row key to map frominnerRowKey- The inner row key to map to
-
removeVoid
default void removeVoid(long outerRowKey) Likeremove(long)(long, long)}, but without requiring the implementation to provide a return value. May be more efficient in some cases.- Parameters:
outerRowKey- The outer row key to map from
-
removeAll
Remove the specifiedrowSequence.- Parameters:
rowSequence- The outer row keys to remove
-
removeAllUnordered
Remove the specifiedouterRowKeys.- Parameters:
outerRowKeys- The outer row keys to remove
-
makeFillFromContext
Make aChunkSink.FillFromContextfor this WritableRowRedirection. The default implementation suppliesDEFAULT_FILL_FROM_INSTANCE, suitable for use with the default implementation offillFromChunk(ChunkSink.FillFromContext, Chunk, RowSequence).- Specified by:
makeFillFromContextin interfaceChunkSink<RowKeys>- Parameters:
chunkCapacity- The maximum number of mappings that will be supplied in one operation- Returns:
- The
ChunkSink.FillFromContextto use
-
fillFromChunk
default void fillFromChunk(@NotNull ChunkSink.FillFromContext fillFromContext, @NotNull @NotNull Chunk<? extends RowKeys> innerRowKeys, @NotNull @NotNull RowSequence outerRowKeys) Insert mappings from each element in aRowSequenceto the parallel element in aLongChunk. h- Specified by:
fillFromChunkin interfaceChunkSink<RowKeys>- Parameters:
fillFromContext- THe FillFromContextinnerRowKeys- The inner row keys to map toouterRowKeys- The outer row keys to map from
-
fillFromChunkUnordered
default void fillFromChunkUnordered(@NotNull @NotNull ChunkSink.FillFromContext context, @NotNull @NotNull Chunk<? extends RowKeys> innerRowKeys, @NotNull @NotNull LongChunk<RowKeys> outerRowKeys) Description copied from interface:ChunkSinkFills the ChunkSink with data from the source, with data corresponding to the keys from the given key chunk.- Specified by:
fillFromChunkUnorderedin interfaceChunkSink<RowKeys>- Parameters:
context- A context containing all mutable/state related data used in writing the Chunk.innerRowKeys- The source of the dataRowSequenceouterRowKeys- ALongChunkrepresenting the keys to be written
-
applyShift
Update this WritableRowRedirection according to aRowSetShiftData.- Parameters:
tableRowSet- ARowSetto filter which rows should be shiftedshiftData- TheRowSetShiftDatafor this update
-