Weave
02 · Queryable views

Lens

Lens is the read-side: derived materialized views over one or many Traces. Snapshots, sub-DBs, fast iteration over arbitrary keyspaces, batched writes, cache-aware compaction. The source log is never touched.

Concepts
  • 01Read-side projections of one or more Traces.
  • 02Snapshots, sub-DBs, batched writes, cache-aware compaction.
  • 03Source logs are never mutated.
  • 04Iteration over arbitrary keyspaces, byte-prefix scans.
Code
use lens::{Lens, LensConfig};

let lens = Lens::open("./.weave/views/posts", LensConfig::default()).await?;
let mut tx = lens.batch();
tx.put(b"post:42", b"hello, world")?;
tx.commit().await?;

for (k, v) in lens.scan_prefix(b"post:") {
    println!("{:?} -> {:?}", k, v);
}