Applies a TrunkOp to the pristine database. This is the main entry point for applying file-level operations. # Arguments `txn` - The transaction to apply the operation in `context` - The apply context for tracking state and conflicts `trunk_id` - The ID for the trunk (for Create ops, this is the new ID) `op` - The operation to apply # Returns `Ok(())` - The operation was applied successfully
(
txn: &mut T,
context: &mut ApplyContext,
trunk_id: TrunkId,
op: &TrunkOp,
)
| 70 | /// apply_trunk_op(&mut txn, &mut context, trunk_id, &op)?; |
| 71 | /// ``` |
| 72 | pub fn apply_trunk_op<T: MutCrdtTxnT>( |
| 73 | txn: &mut T, |
| 74 | context: &mut ApplyContext, |
| 75 | trunk_id: TrunkId, |
| 76 | op: &TrunkOp, |
| 77 | ) -> ApplyResult<()> { |
| 78 | match op { |
| 79 | TrunkOp::Create { path, encoding } => apply_create(txn, context, trunk_id, path, *encoding), |
| 80 | TrunkOp::Delete { trunk } => apply_delete(txn, context, *trunk), |
| 81 | TrunkOp::Move { trunk, new_path } => apply_move(txn, context, *trunk, new_path), |
| 82 | TrunkOp::Undelete { trunk } => apply_undelete(txn, context, *trunk), |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // Create Operation |
| 87 |