MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / access_tracking

Function access_tracking

nodedb-graph/src/csr/memory.rs:138–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136
137 #[test]
138 fn access_tracking() {
139 let mut csr = CsrIndex::new();
140 csr.add_edge("a", "L", "b").unwrap();
141 csr.add_edge("b", "L", "c").unwrap();
142
143 let a_id = csr.node_id_raw("a").unwrap();
144 assert_eq!(csr.hot_node_count(), 0);
145
146 csr.record_access(a_id);
147 csr.record_access(a_id);
148 assert_eq!(csr.hot_node_count(), 1);
149
150 let cold = csr.cold_nodes(0);
151 assert!(!cold.contains(&a_id));
152 assert_eq!(cold.len(), 2); // b and c
153
154 csr.reset_access_counts();
155 assert_eq!(csr.hot_node_count(), 0);
156 }
157
158 #[test]
159 fn memory_estimation_includes_weights() {

Callers

nothing calls this directly

Calls 5

add_edgeMethod · 0.80
record_accessMethod · 0.80
cold_nodesMethod · 0.80
reset_access_countsMethod · 0.80
node_id_rawMethod · 0.45

Tested by

no test coverage detected