Skip to main content

Crate kevy_window

Crate kevy_window 

Source
Expand description

The sliding-window runtime for scalar indexes — shared by the server and the embedded store (one implementation, so the two faces cannot drift): boundary maintenance, the eviction slide, and the cold half of range/count.

Cold segments are derived spill, not truth (the rows stay hot; the index is rebuilt from them on boot) — so a failed slide simply leaves the tree untouched (the batch is read before it is cut), and a restart drops the segment set and re-slides.

use kevy_index::{IndexValue, Segment, ValType, WindowShape, WindowSpec};
// keep the last 100 units of `ts` hot, evicting in buckets of 50
let mut w = kevy_window::WindowRt::new(WindowSpec::new("ts", 100, 50), WindowShape::PlainI64);
let mut seg = Segment::new();
for ts in [10, 20, 300] {
    seg.apply(format!("r:{ts}").as_bytes(), None, Some(IndexValue::I64(ts)));
}
assert!(w.slide(b"t.ts", &mut seg, dir.path())?);

// the two old entries left the tree and are answered from the cold side
let (lo, hi) = (IndexValue::I64(0), IndexValue::I64(1_000));
assert_eq!(seg.count(&lo, &hi), 1);
assert_eq!(w.cold_count(ValType::I64, &lo, &hi)?, 2);

Every public item here is documented and the lint holds it.

Structs§

ColdHit
One cold hit: its page-order ingredients, ready to merge.
ColdPage
The cold half of one shard’s pass-2 answer.
ColdPageQuery
Everything pass 2 asks of the cold directory.
TextColdDir
The frozen text segments for one windowed full-text index on one shard, plus the bloom and tombstones that let a query skip or correct them without opening a file.
WindowRt
One index’s window state on one shard.

Enums§

ColdError
Why sealing entries into a cold segment, or reading them back, failed. The spill is derived data: the caller reports the error and the entries stay rebuildable from the rows.