Class DictionaryWriterRegistryImpl
java.lang.Object
io.deephaven.extensions.barrage.chunk.DictionaryWriterRegistryImpl
- All Implemented Interfaces:
DictionaryWriterRegistry
The server-side
DictionaryWriterRegistry implementation, backed by fastutil maps.
Two construction modes:
- Local (default constructor) — for viewport subscriptions and snapshots. Each registry creates
LocalDictionaryWriterStateinstances that are fully private to this stream. - Shared-backed (
DictionaryWriterRegistryImpl(Long2ObjectOpenHashMap)constructor) — for full subscriptions and growing subscriptions targeting a full subscription. Each registry createsSharedDictionaryWriterStateinstances that delegate index lookups to the table-levelSharedWriterDictionary, so all full subscribers share the same value-to-index mapping.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.extensions.barrage.chunk.DictionaryWriterRegistry
DictionaryWriterRegistry.Entry -
Constructor Summary
ConstructorsConstructorDescriptionCreates a local registry for viewport subscriptions and snapshots.DictionaryWriterRegistryImpl(@NotNull it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<SharedWriterDictionary> sharedDictionaries) Creates a shared-backed registry for full subscriptions and growing subscriptions targeting a full subscription. -
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.voidAdvances the delta boundary for every registered state that currently has a pending delta.voidresetOverflowedEntries(long liveRowCount) Checks each registeredDictionaryWriterStatefor overflow: if itstotalSizeexceedsliveRowCount, callsDictionaryWriterState.reset()so the next DictionaryBatch will beisDelta=falsewith a compacted dictionary.
-
Constructor Details
-
DictionaryWriterRegistryImpl
public DictionaryWriterRegistryImpl()Creates a local registry for viewport subscriptions and snapshots. -
DictionaryWriterRegistryImpl
public DictionaryWriterRegistryImpl(@NotNull @NotNull it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<SharedWriterDictionary> sharedDictionaries) Creates a shared-backed registry for full subscriptions and growing subscriptions targeting a full subscription. ThesharedDictionariesmap is owned by theio.deephaven.server.barrage.BarrageMessageProducerand lives for the lifetime of the table's producer; it is never cleared.
-
-
Method Details
-
getOrCreate
@NotNull public @NotNull DictionaryWriterState getOrCreate(long dictId, @NotNull @NotNull ChunkWriter<Chunk<Values>> valuesWriter, @NotNull @NotNull ChunkType valuesChunkType) Description copied from interface:DictionaryWriterRegistryReturns (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.- Specified by:
getOrCreatein interfaceDictionaryWriterRegistry
-
entries
Description copied from interface:DictionaryWriterRegistryReturns all registered entries.- Specified by:
entriesin interfaceDictionaryWriterRegistry
-
hasAnyDelta
public boolean hasAnyDelta()Description copied from interface:DictionaryWriterRegistryReturnstrueif any registered dictionary has a pending delta that needs a DictionaryBatch message.- Specified by:
hasAnyDeltain interfaceDictionaryWriterRegistry
-
resetDeltas
public void resetDeltas()Description copied from interface:DictionaryWriterRegistryAdvances the delta boundary for every registered state that currently has a pending delta.- Specified by:
resetDeltasin interfaceDictionaryWriterRegistry
-
resetOverflowedEntries
public void resetOverflowedEntries(long liveRowCount) Description copied from interface:DictionaryWriterRegistryChecks each registeredDictionaryWriterStatefor overflow: if itstotalSizeexceedsliveRowCount, callsDictionaryWriterState.reset()so the next DictionaryBatch will beisDelta=falsewith a compacted dictionary. Only call this for local (viewport/snapshot) registries; for shared-backed registries theSharedWriterDictionaryis reset externally.- Specified by:
resetOverflowedEntriesin interfaceDictionaryWriterRegistry- Parameters:
liveRowCount- the current number of live rows visible to this subscription
-