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

Function operation_map_reaches

atomic-repository/src/repository/operation.rs:4295–4318  ·  view source on GitHub ↗
(
    start: OperationId,
    target: OperationId,
    operations: &BTreeMap<OperationId, Operation>,
)

Source from the content-addressed store, hash-verified

4293}
4294
4295fn operation_map_reaches(
4296 start: OperationId,
4297 target: OperationId,
4298 operations: &BTreeMap<OperationId, Operation>,
4299) -> Result<bool, RepositoryError> {
4300 let mut pending = vec![start];
4301 let mut visited = BTreeSet::new();
4302 while let Some(operation_id) = pending.pop() {
4303 if operation_id == target {
4304 return Ok(true);
4305 }
4306 if !visited.insert(operation_id) {
4307 continue;
4308 }
4309 let operation =
4310 operations
4311 .get(&operation_id)
4312 .ok_or_else(|| RepositoryError::OperationNotFound {
4313 selector: operation_id.to_string(),
4314 })?;
4315 pending.extend(operation.payload().parents.iter().copied());
4316 }
4317 Ok(false)
4318}
4319
4320fn apply_snapshot_transition(
4321 snapshot: &mut BTreeMap<MetadataTarget, MetadataValue>,

Callers 1

Calls 5

extendMethod · 0.80
getMethod · 0.65
insertMethod · 0.45
iterMethod · 0.45
payloadMethod · 0.45

Tested by

no test coverage detected