VariantDictionaryBuilder

Builds a dictionary by interning field names, and encodes it once the values that use it are written.

Append-only by construction: an id, once handed out, is embedded in value bytes that may already have been flushed, so ids can never be renumbered. A dictionary is therefore in insertion order, and VariantMetadata.sortedAndUnique is set only when insertion order happened to be lexicographic anyway — which is the common case for a single document whose fields are interned in sorted order, and never the case for a segment-wide dictionary.

Not thread-safe. The engine has a single writer by design.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val size: Int

Number of interned strings.

Functions

Link copied to clipboard

Encodes the dictionary and returns a reader over it.

Link copied to clipboard
fun intern(name: String): Int

Returns the id of name, interning it if this is its first use.

Link copied to clipboard

Encodes the dictionary in the specification's metadata layout.