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