Update a branch's state.
(
txn: &mut T,
branch_id: BranchId,
state: BranchState,
)
| 929 | |
| 930 | /// Update a branch's state. |
| 931 | fn 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. |
| 952 | fn put_leaf<T: MutTxnT>( |
no test coverage detected