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