(&self, sources: &[&str])
| 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) { |
no test coverage detected