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

Source from the content-addressed store, hash-verified

1530 }
1531
1532 fn kg_node_ids_by_source(&self, sources: &[&str]) -> PristineResult<Vec<String>> {
1533 self.require_current_kg()?;
1534 let table = match self.txn.open_table(KG_NODES) {
1535 Ok(t) => t,
1536 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(Vec::new()),
1537 Err(e) => return Err(PristineError::from(e)),
1538 };
1539 let mut ids = Vec::new();
1540 for entry in table.iter()? {
1541 let (key, value) = entry?;
1542 if let Ok(node) = serde_json::from_slice::<KgNode>(value.value()) {
1543 if sources.contains(&node.source.as_str()) {
1544 ids.push(key.value().to_string());
1545 }
1546 }
1547 }
1548 Ok(ids)
1549 }
1550
1551 fn count_kg_edges(&self) -> PristineResult<usize> {
1552 self.require_current_kg()?;

Callers

nothing calls this directly

Calls 6

require_current_kgMethod · 0.80
valueMethod · 0.80
iterMethod · 0.45
containsMethod · 0.45
as_strMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected