Update a trunk's state.
(
txn: &mut T,
trunk_id: TrunkId,
state: TrunkState,
)
| 862 | |
| 863 | /// Update a trunk's state. |
| 864 | fn update_trunk_state<T: MutTxnT>( |
| 865 | txn: &mut T, |
| 866 | trunk_id: TrunkId, |
| 867 | state: TrunkState, |
| 868 | ) -> PristineResult<()> { |
| 869 | let key = encode_trunk_id(&trunk_id); |
| 870 | |
| 871 | // Get existing trunk |
| 872 | if let Some(mut serialized) = txn.get_crdt_trunk(&key)? { |
| 873 | // Update state in the serialized data |
| 874 | serialized.state = state; |
| 875 | |
| 876 | // Re-encode and store |
| 877 | let value = encode_trunk_value(&serialized); |
| 878 | txn.put_crdt_trunk(&key, &value)?; |
| 879 | } |
| 880 | |
| 881 | Ok(()) |
| 882 | } |
| 883 | |
| 884 | /// Update a trunk's path. |
| 885 | fn update_trunk_path<T: MutTxnT>( |
no test coverage detected