forked from kent/consciousness
migrate more files to use index-based node access
- learn.rs, daemon.rs, graph.rs, digest.rs, prompts.rs - Convert store.nodes.get() → store.get_node() - Convert store.nodes.contains_key() → store.contains_key() - Convert store.nodes.values/iter() → all_keys + get_node Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
fe6450223c
commit
af3e41f1d9
5 changed files with 63 additions and 43 deletions
|
|
@ -886,8 +886,8 @@ pub fn health_report(graph: &Graph, store: &Store) -> String {
|
|||
let mut missing_nodes: HashSet<String> = HashSet::new();
|
||||
for rel in &store.relations {
|
||||
if rel.deleted { continue; }
|
||||
let s_missing = !store.nodes.contains_key(&rel.source_key);
|
||||
let t_missing = !store.nodes.contains_key(&rel.target_key);
|
||||
let s_missing = !store.contains_key(&rel.source_key).unwrap_or(false);
|
||||
let t_missing = !store.contains_key(&rel.target_key).unwrap_or(false);
|
||||
if s_missing || t_missing {
|
||||
orphan_edges += 1;
|
||||
if s_missing { missing_nodes.insert(rel.source_key.clone()); }
|
||||
|
|
@ -897,15 +897,18 @@ pub fn health_report(graph: &Graph, store: &Store) -> String {
|
|||
|
||||
// NodeType breakdown
|
||||
let mut type_counts: HashMap<&str, usize> = HashMap::new();
|
||||
for node in store.nodes.values() {
|
||||
let label = match node.node_type {
|
||||
crate::store::NodeType::EpisodicSession => "episodic",
|
||||
crate::store::NodeType::EpisodicDaily => "daily",
|
||||
crate::store::NodeType::EpisodicWeekly => "weekly",
|
||||
crate::store::NodeType::EpisodicMonthly => "monthly",
|
||||
crate::store::NodeType::Semantic => "semantic",
|
||||
};
|
||||
*type_counts.entry(label).or_default() += 1;
|
||||
let all_keys = store.all_keys().unwrap_or_default();
|
||||
for key in &all_keys {
|
||||
if let Ok(Some(node)) = store.get_node(key) {
|
||||
let label = match node.node_type {
|
||||
crate::store::NodeType::EpisodicSession => "episodic",
|
||||
crate::store::NodeType::EpisodicDaily => "daily",
|
||||
crate::store::NodeType::EpisodicWeekly => "weekly",
|
||||
crate::store::NodeType::EpisodicMonthly => "monthly",
|
||||
crate::store::NodeType::Semantic => "semantic",
|
||||
};
|
||||
*type_counts.entry(label).or_default() += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Load history for deltas
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue