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

Function put_trunk

atomic-core/src/apply/file_ops.rs:844–861  ·  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

842
843/// Store a trunk in the CRDT tables.
844fn put_trunk<T: MutTxnT>(
845 txn: &mut T,
846 trunk_id: TrunkId,
847 serialized: &SerializedTrunk,
848) -> PristineResult<()> {
849 let key = encode_trunk_id(&trunk_id);
850 let value = encode_trunk_value(serialized);
851
852 txn.put_crdt_trunk(&key, &value)?;
853
854 // Also update path index
855 txn.put_crdt_path_trunk(&serialized.path, &key)?;
856
857 // And inode index
858 txn.put_crdt_inode_trunk(serialized.inode.get(), &key)?;
859
860 Ok(())
861}
862
863/// Update a trunk's state.
864fn 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