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

Function fence

libatomic/src/daemon/services_sandbox.rs:182–192  ·  view source on GitHub ↗

Refuse unless `expected` is the view's snapshot now.

(repo: &Repository, view: &str, expected: &ViewSnapshot)

Source from the content-addressed store, hash-verified

180
181/// Refuse unless `expected` is the view's snapshot now.
182fn fence(repo: &Repository, view: &str, expected: &ViewSnapshot) -> Result<ViewSnapshot, Status> {
183 let fence = wire::snapshot_fence(expected).map_err(invalid)?;
184 let current = current_snapshot(repo, view)?;
185 if wire::snapshot_fence(&current).map_err(invalid)? != fence {
186 return Err(domain_status(
187 ErrorCode::ViewStale,
188 format!("view '{view}' has moved on; materialize it again"),
189 ));
190 }
191 Ok(current)
192}
193
194fn wire_error(message: String) -> Status {
195 domain_status(ErrorCode::Internal, message)

Callers 2

get_file_statesMethod · 0.85
get_changesMethod · 0.85

Calls 3

snapshot_fenceFunction · 0.85
current_snapshotFunction · 0.85
domain_statusFunction · 0.85

Tested by

no test coverage detected