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

Function stats_store_roundtrip

nodedb/src/engine/sparse/stats.rs:384–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382
383 #[test]
384 fn stats_store_roundtrip() {
385 let dir = tempfile::tempdir().unwrap();
386 let db = Arc::new(Database::create(dir.path().join("stats.redb")).unwrap());
387 let store = StatsStore::open(db).unwrap();
388
389 let mut stats = ColumnStats::new();
390 stats.observe(Some(&serde_json::Value::String("hello".into())));
391 store.put(1, "users", "name", &stats).unwrap();
392
393 let loaded = store.get(1, "users", "name").unwrap().unwrap();
394 assert_eq!(loaded.row_count, 1);
395 assert_eq!(loaded.non_null_count, 1);
396 assert_eq!(loaded.min_value, Some("hello".to_string()));
397 }
398}

Callers

nothing calls this directly

Calls 7

joinMethod · 0.80
createFunction · 0.50
openFunction · 0.50
pathMethod · 0.45
observeMethod · 0.45
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected