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

Method add_node_label

nodedb-graph/src/csr/index/interning.rs:140–147  ·  view source on GitHub ↗

Add a label to a node. Returns `Ok(false)` if the 64 distinct node-label limit is hit (the label is silently ignored). Returns `Err(GraphError::NodeOverflow)` if the node is new and the partition's node-id space is exhausted.

(&mut self, node: &str, label: &str)

Source from the content-addressed store, hash-verified

138 /// label is silently ignored). Returns `Err(GraphError::NodeOverflow)` if
139 /// the node is new and the partition's node-id space is exhausted.
140 pub fn add_node_label(&mut self, node: &str, label: &str) -> Result<bool, crate::GraphError> {
141 let node_id = self.ensure_node(node)?;
142 let Some(label_id) = self.ensure_node_label(label) else {
143 return Ok(false);
144 };
145 self.node_label_bits[node_id as usize] |= 1u64 << label_id;
146 Ok(true)
147 }
148
149 /// Remove a label from a node.
150 pub fn remove_node_label(&mut self, node: &str, label: &str) {

Callers 2

dispatch_graphMethod · 0.80
execute_with_node_labelsFunction · 0.80

Calls 2

ensure_nodeMethod · 0.80
ensure_node_labelMethod · 0.80

Tested by 1

execute_with_node_labelsFunction · 0.64