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

Function update_branch_state

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

1089
1090/// Update a branch's state.
1091fn update_branch_state<T: MutTxnT>(
1092 txn: &mut T,
1093 branch_id: BranchId,
1094 state: BranchState,
1095) -> PristineResult<()> {
1096 let key = encode_branch_id(&branch_id);
1097
1098 // Get existing branch
1099 if let Some(mut serialized) = txn.get_crdt_branch(&key)? {
1100 // Update state
1101 serialized.state = state;
1102
1103 // Re-encode and store
1104 let value = encode_branch_value(&serialized);
1105 txn.put_crdt_branch(&key, &value)?;
1106 }
1107
1108 Ok(())
1109}
1110
1111/// Store a leaf in the CRDT tables.
1112fn 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