MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_kg_persistence

Function test_kg_persistence

atomic-core/src/pristine/txn/write/triples.rs:690–706  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

688
689 #[test]
690 fn test_kg_persistence() {
691 let dir = tempdir().unwrap();
692 let pristine = Pristine::open(dir.path().join("db")).unwrap();
693 {
694 let mut txn = pristine.write_txn().unwrap();
695 txn.init_kg().unwrap();
696 txn.upsert_kg_node(&KgNode::new("x", "t", "X", "s"))
697 .unwrap();
698 txn.upsert_kg_edge(&KgEdge::new("x", "y", "LINK")).unwrap();
699 txn.commit().unwrap();
700 }
701 {
702 let txn = pristine.read_txn().unwrap();
703 assert!(txn.get_kg_node("x").unwrap().is_some());
704 assert_eq!(txn.get_kg_edges_from("x").unwrap().len(), 1);
705 }
706 }
707}

Callers

nothing calls this directly

Calls 8

write_txnMethod · 0.80
upsert_kg_nodeMethod · 0.80
upsert_kg_edgeMethod · 0.80
commitMethod · 0.80
read_txnMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
init_kgMethod · 0.45

Tested by

no test coverage detected