SegmentBuilder class final

Builds an immutable segment: blocks of documents plus a sorted primary index.

The segment is a pure byte format: finish returns a Bytes buffer that can be written to a file or an object store. It knows nothing about I/O.

Layout:

[header 16B][blocks...][block table][index][bloom][footer 32B]

Keys must be unique. They are copied on add because callers reuse their key buffers.

Constructors

SegmentBuilder({int blockTargetSize = 64 * 1024, int bitsPerKey = 10})
Creates a builder with a target document-block size.

Properties

bitsPerKey → int
Bloom filter bits per key.
final
blockTargetSize → int
Target size of one document block.
final
docCount → int
Number of documents added.
no setter
hashCode → int
The hash code for this object.
no setterinherited
payloadSize → int
Bytes accumulated so far, excluding the index and bloom.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(Uint8List key, Bytes document) → void
Adds one document under key.
addTombstone(Uint8List key) → void
Records that key was deleted, without storing a document.
finish() → Bytes
Builds the segment and returns its bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited