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

Function put_leaf

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

1110
1111/// Store a leaf in the CRDT tables.
1112fn put_leaf<T: MutTxnT>(
1113 txn: &mut T,
1114 branch_id: BranchId,
1115 leaf_id: LeafId,
1116 serialized: &SerializedLeaf,
1117) -> PristineResult<()> {
1118 let key = encode_leaf_id(&leaf_id);
1119 let value = encode_leaf_value(serialized);
1120
1121 txn.put_crdt_leaf(&key, &value)?;
1122
1123 // Update branch->leaf ordering
1124 let branch_key = encode_branch_id(&branch_id);
1125 txn.put_crdt_branch_leaf(&branch_key, &key)?;
1126
1127 Ok(())
1128}
1129
1130/// Update a leaf's state.
1131fn 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