MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / with_tenant_key4

Function with_tenant_key4

nodedb/src/engine/sparse/btree.rs:45–68  ·  view source on GitHub ↗

Build a tenant-scoped index key `"{tenant}:{a}:{b}:{c}:{d}"`.

(
    tenant_id: u64,
    a: &str,
    b: &str,
    c: &str,
    d: &str,
    f: impl FnOnce(&str) -> R,
)

Source from the content-addressed store, hash-verified

43
44/// Build a tenant-scoped index key `"{tenant}:{a}:{b}:{c}:{d}"`.
45pub(super) fn with_tenant_key4<R>(
46 tenant_id: u64,
47 a: &str,
48 b: &str,
49 c: &str,
50 d: &str,
51 f: impl FnOnce(&str) -> R,
52) -> R {
53 KEY_BUF.with(|buf| {
54 let mut buf = buf.borrow_mut();
55 buf.clear();
56 use std::fmt::Write;
57 let _ = write!(buf, "{tenant_id}");
58 buf.push(':');
59 buf.push_str(a);
60 buf.push(':');
61 buf.push_str(b);
62 buf.push(':');
63 buf.push_str(c);
64 buf.push(':');
65 buf.push_str(d);
66 f(&buf)
67 })
68}
69
70/// redb-backed B-Tree storage engine for sparse/metadata queries.
71pub struct SparseEngine {

Callers 2

index_putMethod · 0.85
index_put_in_txnMethod · 0.85

Calls 2

clearMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected