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

Function apply_file_ops

atomic-core/src/apply/file_ops.rs:166–177  ·  view source on GitHub ↗

Apply all FileOps from a change to the CRDT tables. This populates TRUNKS, BRANCHES, and LEAVES tables with the semantic layer data, enabling human-readable diffs and token-level blame. # Arguments `txn` - Mutable transaction for database writes `change_id` - The NodeId of the change being applied `file_ops` - The FileOps to apply # Returns Statistics about what was applied. # Example ```ru

(
    txn: &mut T,
    change_id: NodeId,
    file_ops: &[FileOps],
)

Source from the content-addressed store, hash-verified

164/// let stats = apply_file_ops(&mut txn, change_id, change.file_ops())?;
165/// ```
166pub fn apply_file_ops<T: MutTxnT>(
167 txn: &mut T,
168 change_id: NodeId,
169 file_ops: &[FileOps],
170) -> PristineResult<ApplyFileOpsStats> {
171 let mut stats = ApplyFileOpsStats::new();
172 let mut next_leaf_idx = 0u32;
173 for ops in file_ops {
174 apply_single_file_ops(txn, change_id, ops, &mut stats, &mut next_leaf_idx)?;
175 }
176 Ok(stats)
177}
178
179/// Apply FileOps using CRDT table handles opened once for the full pass.
180///

Callers 1

apply_file_ops_batchedFunction · 0.85

Calls 1

apply_single_file_opsFunction · 0.85

Tested by

no test coverage detected