MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / kg_node_ids_by_source

Method kg_node_ids_by_source

atomic-core/src/pristine/txn/read.rs:1109–1125  ·  view source on GitHub ↗
(&self, sources: &[&str])

Source from the content-addressed store, hash-verified

1107 }
1108
1109 fn kg_node_ids_by_source(&self, sources: &[&str]) -> PristineResult<Vec<String>> {
1110 let table = match self.txn.open_table(KG_NODES) {
1111 Ok(t) => t,
1112 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(Vec::new()),
1113 Err(e) => return Err(PristineError::from(e)),
1114 };
1115 let mut ids = Vec::new();
1116 for entry in table.iter()? {
1117 let (key, value) = entry?;
1118 if let Ok(node) = serde_json::from_slice::<KgNode>(value.value()) {
1119 if sources.contains(&node.source.as_str()) {
1120 ids.push(key.value().to_string());
1121 }
1122 }
1123 }
1124 Ok(ids)
1125 }
1126
1127 fn count_kg_edges(&self) -> PristineResult<usize> {
1128 let table = match self.txn.open_table(KG_EDGES) {

Callers 1

kg_clear_derivedMethod · 0.45

Calls 4

iterMethod · 0.45
containsMethod · 0.45
as_strMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected