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:1064–1080  ·  view source on GitHub ↗
(&self, sources: &[&str])

Source from the content-addressed store, hash-verified

1062 }
1063
1064 fn kg_node_ids_by_source(&self, sources: &[&str]) -> PristineResult<Vec<String>> {
1065 let table = match self.txn.open_table(KG_NODES) {
1066 Ok(t) => t,
1067 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(Vec::new()),
1068 Err(e) => return Err(PristineError::from(e)),
1069 };
1070 let mut ids = Vec::new();
1071 for entry in table.iter()? {
1072 let (key, value) = entry?;
1073 if let Ok(node) = serde_json::from_slice::<KgNode>(value.value()) {
1074 if sources.contains(&node.source.as_str()) {
1075 ids.push(key.value().to_string());
1076 }
1077 }
1078 }
1079 Ok(ids)
1080 }
1081
1082 fn count_kg_edges(&self) -> PristineResult<usize> {
1083 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