MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / unregister_node

Method unregister_node

ciphercore-base/src/graphs.rs:4417–4446  ·  view source on GitHub ↗
(&self, node: Node)

Source from the content-addressed store, hash-verified

4415 }
4416
4417 fn unregister_node(&self, node: Node) -> Result<()> {
4418 if node.get_graph().get_context() != *self {
4419 return Err(runtime_error!(
4420 "The node to be unregister from a different context"
4421 ));
4422 }
4423 if self.is_finalized() {
4424 return Err(runtime_error!(
4425 "Can't unregister a node from a finalized context"
4426 ));
4427 }
4428
4429 let node_id = node.get_id();
4430 let graph_id = node.get_graph().get_id();
4431
4432 let mut cell = self.body.borrow_mut();
4433 let name_option = cell.nodes_names.remove(&(graph_id, node_id));
4434 cell.nodes_annotations.remove(&(graph_id, node_id));
4435 if cell.nodes_names_inverse.get(&graph_id).is_none() {
4436 return Ok(());
4437 }
4438 let graph_map_inverse = cell
4439 .nodes_names_inverse
4440 .get_mut(&graph_id)
4441 .expect("Should not be here!");
4442 if let Some(name) = name_option {
4443 graph_map_inverse.remove(&name);
4444 }
4445 Ok(())
4446 }
4447
4448 fn to_versioned_data(&self) -> Result<VersionedData> {
4449 VersionedData::create_versioned_data(

Callers 1

remove_last_nodeMethod · 0.45

Calls 6

is_finalizedMethod · 0.80
get_contextMethod · 0.45
get_graphMethod · 0.45
get_idMethod · 0.45
removeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected