pub trait LocalTree: Send + Sync {
// Required methods
fn manifest(&self, dir: &Path) -> Result<Manifest, WorkspaceError>;
fn pack(&self, dir: &Path) -> Result<Packed, WorkspaceError>;
fn pack_paths(
&self,
dir: &Path,
paths: &[String],
) -> Result<Packed, WorkspaceError>;
fn extract(
&self,
archive: &[u8],
globs: &[String],
dir: &Path,
) -> Result<Vec<Artifact>, WorkspaceError>;
}Expand description
A local directory tree, packed, hashed and written to: the port microvms-edges
implements over the real filesystem.
Every implementation walks the same way: SKIPPED_DIRS skipped whole; sockets, fifos
and devices skipped individually; symlinks kept as links, never followed; the
MAX_PACK_BYTES and MAX_PACK_MEMBERS budgets enforced during the walk.
Required Methods§
Sourcefn manifest(&self, dir: &Path) -> Result<Manifest, WorkspaceError>
fn manifest(&self, dir: &Path) -> Result<Manifest, WorkspaceError>
The walk of dir, hashed into a Manifest: exactly the set Self::pack uploads.
Sourcefn pack(&self, dir: &Path) -> Result<Packed, WorkspaceError>
fn pack(&self, dir: &Path) -> Result<Packed, WorkspaceError>
The walk of dir as a tar archive, members in sorted path order so the same tree packs
to the same bytes.
Sourcefn pack_paths(
&self,
dir: &Path,
paths: &[String],
) -> Result<Packed, WorkspaceError>
fn pack_paths( &self, dir: &Path, paths: &[String], ) -> Result<Packed, WorkspaceError>
Exactly the named relative paths under dir, in sorted order.
Sourcefn extract(
&self,
archive: &[u8],
globs: &[String],
dir: &Path,
) -> Result<Vec<Artifact>, WorkspaceError>
fn extract( &self, archive: &[u8], globs: &[String], dir: &Path, ) -> Result<Vec<Artifact>, WorkspaceError>
Writes the regular-file members of archive that match one of globs under dir,
and nothing else: no symlink, hardlink, directory or special member, nothing under
.git whatever the globs say, and nothing that would land outside dir. What it
skips is skipped, not refused, since the archive is the VM’s word.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".