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

Function put_trunk

atomic-core/src/apply/file_ops.rs:1001–1018  ·  view source on GitHub ↗

Store a trunk in the CRDT tables.

(
    txn: &mut T,
    trunk_id: TrunkId,
    serialized: &SerializedTrunk,
)

Source from the content-addressed store, hash-verified

999
1000/// Store a trunk in the CRDT tables.
1001fn put_trunk<T: MutTxnT>(
1002 txn: &mut T,
1003 trunk_id: TrunkId,
1004 serialized: &SerializedTrunk,
1005) -> PristineResult<()> {
1006 let key = encode_trunk_id(&trunk_id);
1007 let value = encode_trunk_value(serialized);
1008
1009 txn.put_crdt_trunk(&key, &value)?;
1010
1011 // Also update path index
1012 txn.put_crdt_path_trunk(&serialized.path, &key)?;
1013
1014 // And inode index
1015 txn.put_crdt_inode_trunk(serialized.inode.get(), &key)?;
1016
1017 Ok(())
1018}
1019
1020/// Update a trunk's state.
1021fn update_trunk_state<T: MutTxnT>(

Callers 1

apply_trunk_opFunction · 0.85

Calls 6

encode_trunk_idFunction · 0.85
encode_trunk_valueFunction · 0.85
put_crdt_trunkMethod · 0.80
put_crdt_path_trunkMethod · 0.80
put_crdt_inode_trunkMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected