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

Function test_kg_persistence

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

Source from the content-addressed store, hash-verified

748
749 #[test]
750 fn test_kg_persistence() {
751 let dir = tempdir().unwrap();
752 let pristine = Pristine::open(dir.path().join("db")).unwrap();
753 {
754 let mut txn = pristine.write_txn().unwrap();
755 txn.init_kg().unwrap();
756 txn.upsert_kg_node(&KgNode::new("x", C::Memory, "X", "s"))
757 .unwrap();
758 txn.upsert_kg_edge(&KgEdge::new("x", "y", P::References))
759 .unwrap();
760 txn.commit().unwrap();
761 }
762 {
763 let txn = pristine.read_txn().unwrap();
764 assert!(txn.get_kg_node("x").unwrap().is_some());
765 assert_eq!(txn.get_kg_edges_from("x").unwrap().len(), 1);
766 }
767 }
768}

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected