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

Function versioned_edge_key

nodedb/src/engine/graph/edge_store/temporal/keys.rs:77–93  ·  view source on GitHub ↗

Build a versioned edge key. Returns an error if `system_from` is negative — key ordering semantics require a non-negative suffix.

(
    collection: &str,
    src: &str,
    label: &str,
    dst: &str,
    system_from: i64,
)

Source from the content-addressed store, hash-verified

75/// Returns an error if `system_from` is negative — key ordering semantics
76/// require a non-negative suffix.
77pub fn versioned_edge_key(
78 collection: &str,
79 src: &str,
80 label: &str,
81 dst: &str,
82 system_from: i64,
83) -> crate::Result<String> {
84 if system_from < 0 {
85 return Err(crate::Error::BadRequest {
86 detail: format!("versioned_edge_key: negative system_from={system_from}"),
87 });
88 }
89 Ok(format!(
90 "{collection}\x00{src}\x00{label}\x00{dst}\x00{system_from:0width$}",
91 width = SYSTEM_TIME_WIDTH
92 ))
93}
94
95/// Build the version-range prefix for a base edge.
96pub fn edge_version_prefix(collection: &str, src: &str, label: &str, dst: &str) -> String {

Calls

no outgoing calls