(
txn: &atomic_core::pristine::WriteTxn<'_>,
start: OperationId,
target: OperationId,
)
| 4440 | } |
| 4441 | |
| 4442 | fn operation_reaches( |
| 4443 | txn: &atomic_core::pristine::WriteTxn<'_>, |
| 4444 | start: OperationId, |
| 4445 | target: OperationId, |
| 4446 | ) -> Result<bool, RepositoryError> { |
| 4447 | let mut pending = vec![start]; |
| 4448 | let mut visited = BTreeSet::new(); |
| 4449 | while let Some(operation_id) = pending.pop() { |
| 4450 | if operation_id == target { |
| 4451 | return Ok(true); |
| 4452 | } |
| 4453 | if !visited.insert(operation_id) { |
| 4454 | continue; |
| 4455 | } |
| 4456 | let operation = txn |
| 4457 | .get_operation(operation_id) |
| 4458 | .map_err(pristine_error)? |
| 4459 | .ok_or_else(|| RepositoryError::OperationNotFound { |
| 4460 | selector: operation_id.to_string(), |
| 4461 | })?; |
| 4462 | pending.extend(operation.payload().parents.iter().copied()); |
| 4463 | } |
| 4464 | Ok(false) |
| 4465 | } |
| 4466 | |
| 4467 | fn merge_commuting_operation_states( |
| 4468 | operations: &[Operation], |
no test coverage detected