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

Function validate_prefix_bits

nodedb-cluster/src/distributed_array/routing.rs:101–108  ·  view source on GitHub ↗
(prefix_bits: u8)

Source from the content-addressed store, hash-verified

99// ── Internal helpers ──────────────────────────────────────────────────────
100
101fn validate_prefix_bits(prefix_bits: u8) -> Result<()> {
102 if prefix_bits == 0 || prefix_bits > 16 {
103 return Err(ClusterError::Codec {
104 detail: format!("array routing: prefix_bits must be 1-16, got {prefix_bits}"),
105 });
106 }
107 Ok(())
108}
109
110/// Extract the top `prefix_bits` bits of a Hilbert prefix as a bucket index.
111fn prefix_bucket(hilbert_prefix: u64, prefix_bits: u8) -> u32 {

Callers 2

array_vshard_for_tileFunction · 0.85
array_vshards_for_sliceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected