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

Function trunk_facts

atomic-cli/tests/it/git_import_cb9c_test.rs:1370–1380  ·  view source on GitHub ↗

Trunk row facts for a path: (trunk, row path). Opens a fresh Repository — never call while another writable handle is held.

(root: &Path, path: &str)

Source from the content-addressed store, hash-verified

1368/// Trunk row facts for a path: (trunk, row path). Opens a fresh Repository —
1369/// never call while another writable handle is held.
1370fn trunk_facts(root: &Path, path: &str) -> Option<(TrunkId, String)> {
1371 let repo = open_repo(root);
1372 let txn = repo.pristine().read_txn().unwrap();
1373 use atomic_core::crdt::tables::{decode_trunk_id, encode_trunk_id};
1374 let trunk = CrdtTxnT::get_trunk_by_path(&txn, path).unwrap();
1375 trunk.map(|trunk| {
1376 let key = encode_trunk_id(&trunk);
1377 let row = CrdtTxnT::get_crdt_trunk(&txn, &key).unwrap().unwrap();
1378 (decode_trunk_id(&key), row.path)
1379 })
1380}
1381
1382/// Trunk row facts using an EXISTING Repository handle (no re-open, so it is
1383/// safe while the caller holds the database).

Calls 6

encode_trunk_idFunction · 0.85
decode_trunk_idFunction · 0.85
read_txnMethod · 0.80
pristineMethod · 0.80
open_repoFunction · 0.70
unwrapMethod · 0.45

Tested by

no test coverage detected