Class SharedWriterDictionary
SharedDictionaryWriterState instances (one per active full
subscriber) delegate their index lookups here, so all full subscribers observe the same index assignments.
The value list only grows, until reset() discards it. Each per-subscriber wrapper tracks an independent
flushedOffset into this list so it knows which values have already been sent to that subscriber.
Thread-safety: the producer writes to its subscribers in parallel, so full subscribers fill, measure and read this
dictionary from different threads at once. Filling and copying hold the dictionary's monitor, once per chunk filled
and once per batch copied, since a fill may grow the value list while a copy reads it; the values are read only under
the monitor. Measuring does not hold it: the size is a volatile field, so getTotalSize() gives the
subscribers' hasDelta() and totalSize() checks an up-to-date count without blocking, and because
values are only appended, a range of the list that a subscriber has measured stays valid however many values are
added afterwards. reset() must be called only while no subscriber is writing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull WritableChunk<Values> buildDeltaChunk(int fromOffset, int toOffset) Builds and returns a typed chunk containing the values in[fromOffset, toOffset).longintReturns the current generation counter.intTotal number of distinct values currently in the dictionary (reset to 0 afterreset()).@NotNull ChunkTypeThe chunk type of the dictionary's values.voidreset()Discards all accumulated values and increments the generation counter.
-
Constructor Details
-
SharedWriterDictionary
-
-
Method Details
-
getDictId
public long getDictId() -
getValuesChunkType
The chunk type of the dictionary's values. -
getTotalSize
public int getTotalSize()Total number of distinct values currently in the dictionary (reset to 0 afterreset()). -
buildDeltaChunk
@InternalUseOnly @NotNull public @NotNull WritableChunk<Values> buildDeltaChunk(int fromOffset, int toOffset) Builds and returns a typed chunk containing the values in[fromOffset, toOffset). The returned chunk is owned by the caller and must be closed when no longer needed. -
getGeneration
public int getGeneration()Returns the current generation counter. Increments each timereset()is called. -
reset
public void reset()Discards all accumulated values and increments the generation counter.SharedDictionaryWriterStateinstances that reference this shared dictionary will detect the reset on their next query and re-emit anisDelta=falseDictionaryBatch.
-