Expand description
A project directory moved between a host and a VM: the manifest, the diff, one incremental sync pass, and the guarded download of a remote tree (#260).
§The daemon extracts uploads; the client extracts only what the caller chose
The trust boundary is asymmetric and the code follows it. On the way in, the archive is
built on the host from a tree the caller owns, and the daemon, whose openat2 confinement is
the extraction surface this workspace hardened (crates/agentd/src/fs.rs), unpacks it. On
the way out, the archive describes the VM’s filesystem, and the VM is where untrusted work
runs, so LocalTree::extract writes only the members the caller’s globs selected, only
when they’re regular files, never under .git, and never outside the destination. A
workload that appends ../../.ssh/authorized_keys, a symlink or .git/hooks/pre-commit to
the archive gets it skipped rather than written.
The same holds for the guest’s manifest: it’s read from the VM, so a deletion it orders is
executed only when deletable finds a plain relative path in it.
§What lives here and what lives in the edges
This module is the rules: which directories never travel, the daemon’s budgets, what a
manifest is, what a diff between two manifests orders, which deletion paths are safe, and
the sync pass that composes them over a Session. It reads no file (ARCH-7). The walk,
the hashing, the tar packing and the extraction are LocalTree’s, the port
microvms-edges implements over the real filesystem, so a test can hand the pass a tree of
its own.
Structs§
- Artifact
- One member
LocalTree::extractwrote. - Delta
- What an incremental sync has to do.
- Manifest
- What one sync left in the guest: every member’s identity, keyed by relative path.
- Packed
- A packed archive and how many members it holds.
- Sync
Pass - What one sync pass did.
- Workspace
Error - A local tree that couldn’t be packed, hashed or written to.
Constants§
- DEFAULT_
SYNC_ DELETE_ TIMEOUT - The in-guest
rm’stimeout_secwhen a caller names none:microvm sync --timeout‘s default, and the bindings’sync_dir’s. - MANIFEST_
NAME - The manifest’s member name relative to the workspace. It never travels and never appears
in a
Delta, so the manifest can’t order its own deletion. - MANIFEST_
PATH - Where the incremental manifest lives in the guest: inside the workspace, deliberately.
- MANIFEST_
VERSION - The manifest format this build writes.
- MAX_
PACK_ BYTES - The pack’s byte budget: the daemon’s
max_body_bytes(512 MiB), checked on file sizes during the walk, so an over-budget tree is refused before its archive is allocated. - MAX_
PACK_ MEMBERS - The pack’s member budget: the daemon’s
max_tar_members. - REMOTE_
WORKDIR - Where a synced tree lands in the guest, and the working directory of what runs in it.
- SKIPPED_
DIRS - Directory names never packed or hashed, whole.
- SYNC_
DELETE_ GRACE - How long past the in-guest
rm’s owntimeout_seca sync pass waits for its answer.
Traits§
- Local
Tree - A local directory tree, packed, hashed and written to: the port
microvms-edgesimplements over the real filesystem.
Functions§
- deletable
- Whether a deletion path from the guest manifest is safe to hand to an in-guest
rm. - diff
- What changed between the tree as it is (
local) and as the last sync left it (remote). - within_
byte_ budget - Whether a walk’s running byte total is still within
MAX_PACK_BYTES: at the budget is within it, one byte past isn’t. - within_
member_ budget - Whether a walk’s running member count is still within
MAX_PACK_MEMBERS.