Skip to main content

FileSystem

Type Alias FileSystem 

Source
pub type FileSystem<T> = FileSystem<RegularFile<T>>;
Expand description

A complete filesystem tree, specialized for composefs regular files.

Aliased Type§

pub struct FileSystem<T> {
    pub root: Directory<RegularFile<T>>,
    pub leaves: Vec<Leaf<RegularFile<T>>>,
}

Fields§

§root: Directory<RegularFile<T>>

The root directory of the filesystem.

§leaves: Vec<Leaf<RegularFile<T>>>

Table of all leaf nodes; LeafId indexes into this vector.

Implementations§

Source§

impl<ObjectID: FsVerityHashValue> FileSystem<ObjectID>

Source

pub fn commit_images( &self, repository: &Repository<ObjectID>, image_name: Option<&str>, ) -> Result<HashMap<FormatVersion, ObjectID>>

Commits this filesystem as EROFS images for each format version in the repository config.

Returns a map from FormatVersion to the fsverity digest of the stored image for that version.

The image_name named ref (if provided) is assigned to the default version from repository.format_config(). All extra versions are stored anonymously (no named ref).

Note: Callers should ensure root metadata is set before calling this, typically via copy_root_metadata_from_usr() or set_root_stat().

Source

pub fn commit_image( &self, repository: &Repository<ObjectID>, image_name: Option<&str>, ) -> Result<ObjectID>

Commits this filesystem as an EROFS image to the repository.

Generates an EROFS filesystem image using the repository’s configured EROFS format version and writes it with the optional name. Returns the fsverity digest of the committed image for the default format version.

Note: Callers should ensure root metadata is set before calling this, typically via copy_root_metadata_from_usr() or set_root_stat().

Source

pub fn compute_image_id(&self, version: FormatVersion) -> ObjectID

Computes the fsverity digest for this filesystem as an EROFS image.

The digest depends on the EROFS format version: V1 and V2 produce different on-disk layouts and therefore different digests. Callers must supply the version explicitly so that the digest matches what is actually stored (or will be stored) in the repository.

Note: Callers should ensure root metadata is set before calling this, typically via copy_root_metadata_from_usr() or set_root_stat().

Source

pub fn print_dumpfile(&self) -> Result<()>

Prints this filesystem in dumpfile format to stdout.

Serializes the entire filesystem tree to stdout in composefs dumpfile text format.

Note: Callers should ensure root metadata is set before calling this, typically via copy_root_metadata_from_usr() or set_root_stat().