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

Function put_leaf

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

Store a leaf in the CRDT tables.

(
    txn: &mut T,
    branch_id: BranchId,
    leaf_id: LeafId,
    serialized: &SerializedLeaf,
)

Source from the content-addressed store, hash-verified

950
951/// Store a leaf in the CRDT tables.
952fn put_leaf<T: MutTxnT>(
953 txn: &mut T,
954 branch_id: BranchId,
955 leaf_id: LeafId,
956 serialized: &SerializedLeaf,
957) -> PristineResult<()> {
958 let key = encode_leaf_id(&leaf_id);
959 let value = encode_leaf_value(serialized);
960
961 txn.put_crdt_leaf(&key, &value)?;
962
963 // Update branch->leaf ordering
964 let branch_key = encode_branch_id(&branch_id);
965 txn.put_crdt_branch_leaf(&branch_key, &key)?;
966
967 Ok(())
968}
969
970/// Update a leaf's state.
971fn update_leaf_state<T: MutTxnT>(

Callers 1

apply_leaf_opFunction · 0.85

Calls 5

encode_leaf_idFunction · 0.85
encode_leaf_valueFunction · 0.85
encode_branch_idFunction · 0.85
put_crdt_leafMethod · 0.80
put_crdt_branch_leafMethod · 0.80

Tested by

no test coverage detected