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

Function update_branch_state

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

Update a branch's state.

(
    txn: &mut T,
    branch_id: BranchId,
    state: BranchState,
)

Source from the content-addressed store, hash-verified

929
930/// Update a branch's state.
931fn update_branch_state<T: MutTxnT>(
932 txn: &mut T,
933 branch_id: BranchId,
934 state: BranchState,
935) -> PristineResult<()> {
936 let key = encode_branch_id(&branch_id);
937
938 // Get existing branch
939 if let Some(mut serialized) = txn.get_crdt_branch(&key)? {
940 // Update state
941 serialized.state = state;
942
943 // Re-encode and store
944 let value = encode_branch_value(&serialized);
945 txn.put_crdt_branch(&key, &value)?;
946 }
947
948 Ok(())
949}
950
951/// Store a leaf in the CRDT tables.
952fn put_leaf<T: MutTxnT>(

Callers 1

Calls 4

encode_branch_idFunction · 0.85
encode_branch_valueFunction · 0.85
put_crdt_branchMethod · 0.80
get_crdt_branchMethod · 0.45

Tested by

no test coverage detected