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

Function unique_origin_nodes

nodedb/src/control/backup/orchestrator.rs:161–180  ·  view source on GitHub ↗

Enumerate the unique node IDs that hold any vShard right now. In single-node mode (no routing table) returns `[self.node_id]`, which may be 0 — that's fine; the section's origin_node_id is only carried for traceability/debugging, not for routing.

(state: &SharedState)

Source from the content-addressed store, hash-verified

159/// which may be 0 — that's fine; the section's origin_node_id is
160/// only carried for traceability/debugging, not for routing.
161fn unique_origin_nodes(state: &SharedState) -> Vec<u64> {
162 let Some(routing) = state.cluster_routing.as_ref() else {
163 return vec![state.node_id];
164 };
165 let table = routing.read().expect("routing table poisoned");
166 let mut set = BTreeSet::new();
167 for info in table.group_members().values() {
168 if info.leader != 0 {
169 set.insert(info.leader);
170 }
171 for &m in &info.members {
172 set.insert(m);
173 }
174 }
175 if set.is_empty() {
176 vec![state.node_id]
177 } else {
178 set.into_iter().collect()
179 }
180}
181
182fn is_self(state: &SharedState, node_id: u64) -> bool {
183 node_id == state.node_id || node_id == 0 || state.cluster_transport.is_none()

Callers 1

backup_tenantFunction · 0.85

Calls 7

group_membersMethod · 0.80
collectMethod · 0.80
as_refMethod · 0.45
expectMethod · 0.45
readMethod · 0.45
insertMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected