Documentation
¶
Overview ¶
Package mergestream holds the pieces a streaming merge needs in both the metric and the record engine: the k-way key union, the two-unit memory budget, and the forward-cursor contract. Each engine keeps its own merge driver; only what they would otherwise each invent lives here.
Index ¶
Constants ¶
const DefaultPartCeiling int64 = 16 << 30
DefaultPartCeiling is the maximum merged part size when no ceiling is configured.
const MinPartCap int64 = 8 << 20
MinPartCap keeps low free space from excluding every existing part from compaction.
Variables ¶
var ErrNotForward = errors.New("row range cannot be read forward-only")
ErrNotForward reports a row range a forward-only cursor cannot serve.
Functions ¶
func CheckForward ¶
CheckForward verifies that the row range [start, end) can be read by a forward-only cursor that has already consumed every row below pos. Skipping forward is fine — the cursor discards the gap — but a range that begins behind pos, or ends before it begins, needs a reader that can seek backwards and so fails with an error wrapping ErrNotForward.
Types ¶
type Budget ¶
Budget is the pair of limits a merge seals an output part on. The units are not interchangeable and neither bounds the other: DiskBytes is the size the part reaches encoded on the backend, ResidentBytes what the merge holds in RAM while building it — per-key state that grows with distinct keys rather than with encoded bytes. A limit of zero or less does not bound the merge.
type Keys ¶
type Keys struct {
// contains filtered or unexported fields
}
Keys yields the ascending union of several Source key sequences through a k-way heap, so a merge visits each key once without ever holding a set of them: the state is O(sources), not O(distinct keys), and no key is hashed or sorted.
The zero value is ready to Keys.Reset; a reset reuses the heap, so a reused Keys allocates nothing per traversal.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mergestreamtest is the conformance suite for a streaming merge: the invariants both engines must hold, expressed once so neither tests them its own way.
|
Package mergestreamtest is the conformance suite for a streaming merge: the invariants both engines must hold, expressed once so neither tests them its own way. |