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

Function touches_vault

libatomic/src/daemon/services_sandbox.rs:200–208  ·  view source on GitHub ↗

Whether a change touches the vault — which a sandbox may submit only with `vault.write` as well.

(bytes: &[u8])

Source from the content-addressed store, hash-verified

198/// Whether a change touches the vault — which a sandbox may submit only with
199/// `vault.write` as well.
200fn touches_vault(bytes: &[u8]) -> bool {
201 let Ok((change, _)) = atomic_core::change::Change::deserialize(&mut &bytes[..]) else {
202 // Not a change: the kernel refuses it as malformed.
203 return false;
204 };
205 let vault = |p: &str| p == ".vault" || p.starts_with(".vault/");
206 change.hunks().iter().filter_map(|h| h.path()).any(vault)
207 || change.file_ops().iter().map(|ops| ops.path()).any(vault)
208}
209
210#[tonic::async_trait]
211impl sandbox_service_server::SandboxService for SandboxImpl {

Callers 1

submit_changeMethod · 0.85

Calls 5

deserializeFunction · 0.50
iterMethod · 0.45
hunksMethod · 0.45
pathMethod · 0.45
file_opsMethod · 0.45

Tested by

no test coverage detected