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

Function test_inode_operations

atomic-core/src/pristine/txn/write/tests.rs:739–759  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

737
738 #[test]
739 fn test_inode_operations() {
740 let dir = tempdir().unwrap();
741 let db_path = dir.path().join("pristine");
742 let pristine = Pristine::open(&db_path).unwrap();
743
744 let mut txn = pristine.write_txn().unwrap();
745
746 let inode = txn.alloc_inode().unwrap();
747 let pos = Position::new(NodeId::new(42), ChangePosition::new(100));
748
749 txn.put_inode(inode, pos).unwrap();
750
751 assert_eq!(txn.inode_position(inode).unwrap(), Some(pos));
752 assert_eq!(txn.position_inode(pos).unwrap(), Some(inode));
753
754 let removed_pos = txn.del_inode(inode).unwrap();
755 assert_eq!(removed_pos, Some(pos));
756 assert_eq!(txn.inode_position(inode).unwrap(), None);
757
758 txn.commit().unwrap();
759 }
760
761 #[test]
762 fn pending_inode_reset_cas_refuses_to_lower_concurrently_advanced_counter() {

Callers

nothing calls this directly

Calls 8

openFunction · 0.85
write_txnMethod · 0.80
put_inodeMethod · 0.80
del_inodeMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
alloc_inodeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected