Interface DictionaryWriterRegistry

All Known Implementing Classes:
DictionaryWriterRegistryImpl, WebDictionaryWriterRegistryImpl

public interface DictionaryWriterRegistry
Manages the set of 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.

  • Method Details

    • getOrCreate

      @NotNull @NotNull DictionaryWriterState getOrCreate(long dictId, @NotNull @NotNull ChunkWriter<Chunk<Values>> valuesWriter, @NotNull @NotNull ChunkType valuesChunkType)
      Returns (or creates) the DictionaryWriterState for the given dictionary id.

      The first call for a given dictId registers the valuesWriter for that id and creates the appropriate state type. Subsequent calls for the same id return the existing state.

    • entries

      @NotNull @NotNull Collection<DictionaryWriterRegistry.Entry> entries()
      Returns all registered entries.
    • hasAnyDelta

      boolean hasAnyDelta()
      Returns true if 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.
    • resetOverflowedEntries

      void resetOverflowedEntries(long liveRowCount)
      Checks each registered DictionaryWriterState for overflow: if its totalSize exceeds liveRowCount, calls DictionaryWriterState.reset() so the next DictionaryBatch will be isDelta=false with a compacted dictionary. Only call this for local (viewport/snapshot) registries; for shared-backed registries the SharedWriterDictionary is reset externally.
      Parameters:
      liveRowCount - the current number of live rows visible to this subscription