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

Function test_kg_persistence

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

Source from the content-addressed store, hash-verified

706
707 #[test]
708 fn test_kg_persistence() {
709 let dir = tempdir().unwrap();
710 let pristine = Pristine::open(dir.path().join("db")).unwrap();
711 {
712 let mut txn = pristine.write_txn().unwrap();
713 txn.init_kg().unwrap();
714 txn.upsert_kg_node(&KgNode::new("x", "t", "X", "s"))
715 .unwrap();
716 txn.upsert_kg_edge(&KgEdge::new("x", "y", "LINK")).unwrap();
717 txn.commit().unwrap();
718 }
719 {
720 let txn = pristine.read_txn().unwrap();
721 assert!(txn.get_kg_node("x").unwrap().is_some());
722 assert_eq!(txn.get_kg_edges_from("x").unwrap().len(), 1);
723 }
724 }
725}

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