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

Function apply_trunk_op

atomic-core/src/crdt/apply/trunk.rs:72–84  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

70/// apply_trunk_op(&mut txn, &mut context, trunk_id, &op)?;
71/// ```
72pub 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

Calls 4

apply_createFunction · 0.85
apply_moveFunction · 0.85
apply_undeleteFunction · 0.85
apply_deleteFunction · 0.70

Tested by 15

test_apply_createFunction · 0.56
test_apply_deleteFunction · 0.56
test_apply_moveFunction · 0.56
test_apply_move_deletedFunction · 0.56
test_apply_undeleteFunction · 0.56