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

Function test_kg_persistence

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

Source from the content-addressed store, hash-verified

477
478 #[test]
479 fn test_kg_persistence() {
480 let dir = tempdir().unwrap();
481 let pristine = Pristine::open(dir.path().join("db")).unwrap();
482 {
483 let mut txn = pristine.write_txn().unwrap();
484 txn.init_kg().unwrap();
485 txn.upsert_kg_node(&KgNode::new("x", "t", "X", "s"))
486 .unwrap();
487 txn.upsert_kg_edge(&KgEdge::new("x", "y", "LINK")).unwrap();
488 txn.commit().unwrap();
489 }
490 {
491 let txn = pristine.read_txn().unwrap();
492 assert!(txn.get_kg_node("x").unwrap().is_some());
493 assert_eq!(txn.get_kg_edges_from("x").unwrap().len(), 1);
494 }
495 }
496}

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