Skip to main content

Module trie_merger

Module trie_merger 

Source
Expand description

Trie-native merging primitives for sorted, consolidated UpdatesTyped.

The columnar Chunk impl drives these: merge_pair merges one input fully and a prefix of the other, suffix_chunk materializes the survivor’s leftover, extract partitions by frontier, and split_at cuts a chunk. survey maps the interleaving of the two inputs at each trie layer, and write_from_surveys (via write_layer and write_diffs) copies the ranges the surveys identify into the output trie.

Structs§

ReportContainer
Derived columnar container for an enum.

Enums§

Report
A report we would expect to see in a sequence about two layers.
ReportReference
Reference for an enum.

Functions§

extract
Partition merged into chunks ready to ship (times strictly less than upper) and chunks kept for future seals (times at-or-after upper), updating frontier to the antichain of kept times. merged is consumed lazily, and outputs flow through ship / kept sinks so the caller can spill or forward as chunks are produced rather than buffering them.
merge_pair
Merge two batches, one completely and the other through the corresponding prefix, returning the merged output and leaving each input’s unconsumed suffix in batch1 / batch2 (via an updated (key, val, time) cursor) or None if it was fully consumed.
split_at
Split chunk into two UpdatesTyped parts at record index n: the first n records and the remaining chunk.len() - n. Bitmap pattern mirrors extract’s split between ship/kept halves.
suffix_chunk
Reconstruct batch[cursor..] as a fresh standalone UpdatesTyped, where cursor is a (key, val, time) index triple into batch’s flat columns.
survey
From two sequences of interleaved lists, map out the interleaving of their values.
write_diffs
Write the diff layer from a time survey and two diff inputs.
write_layer
Write one layer of merged output from a list survey and item survey.