Interface DictionaryWriterRegistry
- All Known Implementing Classes:
DictionaryWriterRegistryImpl,WebDictionaryWriterRegistryImpl
DictionaryWriterState instances for a single barrage stream (snapshot or subscription
update sequence), one per Arrow dictionary id.
When BarrageMessageWriterImpl processes a batch, it calls
getOrCreate(long, io.deephaven.extensions.barrage.chunk.ChunkWriter<io.deephaven.chunk.Chunk<io.deephaven.chunk.attributes.Values>>, io.deephaven.chunk.ChunkType) for each DictionaryChunkWriter column to obtain (or register) the state for that
column's dictionary id. After the batch's column data is serialized, the registry's entries() are inspected
to determine which dictionary ids have pending deltas that need a DictionaryBatch
message.
The server implementation is DictionaryWriterRegistryImpl. The JS API supplies its own implementation, since
the server implementation's fastutil backing is not available under GWT.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classPer-id state plus the values writer needed to serialize dictionary values into a DictionaryBatch. -
Method Summary
Modifier and TypeMethodDescription@NotNull Collection<DictionaryWriterRegistry.Entry> entries()Returns all registered entries.@NotNull DictionaryWriterStategetOrCreate(long dictId, @NotNull ChunkWriter<Chunk<Values>> valuesWriter, @NotNull ChunkType valuesChunkType) Returns (or creates) theDictionaryWriterStatefor the given dictionary id.booleanReturnstrueif any registered dictionary has a pending delta that needs a DictionaryBatch message.voidmaybeResetEntries(@NotNull LongUnaryOperator maxSizeForDictId) Resets each registeredDictionaryWriterStatewhosetotalSizeexceeds the limitmaxSizeForDictIdgives for its dictionary id, so the next DictionaryBatch will beisDelta=falsewith a compacted dictionary.voidAdvances the delta boundary for every registered state that currently has a pending delta.
-
Method Details
-
getOrCreate
@NotNull @NotNull DictionaryWriterState getOrCreate(long dictId, @NotNull @NotNull ChunkWriter<Chunk<Values>> valuesWriter, @NotNull @NotNull ChunkType valuesChunkType) Returns (or creates) theDictionaryWriterStatefor the given dictionary id.The first call for a given
dictIdregisters thevaluesWriterfor that id and creates the appropriate state type. Subsequent calls for the same id return the existing state. -
entries
Returns all registered entries. -
hasAnyDelta
boolean hasAnyDelta()Returnstrueif any registered dictionary has a pending delta that needs a DictionaryBatch message. -
resetDeltas
void resetDeltas()Advances the delta boundary for every registered state that currently has a pending delta. -
maybeResetEntries
Resets each registeredDictionaryWriterStatewhosetotalSizeexceeds the limitmaxSizeForDictIdgives for its dictionary id, so the next DictionaryBatch will beisDelta=falsewith a compacted dictionary. This applies to local (viewport/snapshot) registries only; a shared-backed registry ignores this call, as itsSharedWriterDictionaryis reset externally.- Parameters:
maxSizeForDictId- the most values the dictionary with a given id may hold before it is reset; typically no more than the live row count visible to the subscription
-