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,
)
| 75 | /// Returns an error if `system_from` is negative — key ordering semantics |
| 76 | /// require a non-negative suffix. |
| 77 | pub 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. |
| 96 | pub fn edge_version_prefix(collection: &str, src: &str, label: &str, dst: &str) -> String { |
no outgoing calls