pub struct Layer { /* private fields */ }Expand description
Represents an overlay layer with its metadata and content.
Implementations§
Source§impl Layer
impl Layer
Sourcepub fn open(storage: &Storage, id: &str) -> Result<Self>
pub fn open(storage: &Storage, id: &str) -> Result<Self>
Open a layer by ID using fd-relative operations.
§Errors
Returns an error if the layer directory doesn’t exist or cannot be opened.
Sourcepub fn parent_links(&self) -> &[String]
pub fn parent_links(&self) -> &[String]
Get the parent link IDs for this layer.
Sourcepub fn parents(&self, storage: &Storage) -> Result<Vec<String>>
pub fn parents(&self, storage: &Storage) -> Result<Vec<String>>
Get parent layer IDs (resolved from link IDs).
This resolves the short link IDs from the lower file to full layer IDs
by reading the symlinks in the overlay/l/ directory.
§Errors
Returns an error if any link cannot be resolved.
Sourcepub fn layer_chain(self, storage: &Storage) -> Result<Vec<Layer>>
pub fn layer_chain(self, storage: &Storage) -> Result<Vec<Layer>>
Get the complete chain of layers from this layer to the base.
Returns layers in order: [self, parent, grandparent, …, base]
§Errors
Returns an error if the layer chain exceeds the maximum depth of 500 layers.
Sourcepub fn open_file(&self, path: impl AsRef<Path>) -> Result<File>
pub fn open_file(&self, path: impl AsRef<Path>) -> Result<File>
Open a file in the layer’s diff directory using fd-relative operations.
§Errors
Returns an error if the file doesn’t exist or cannot be opened.
Sourcepub fn open_file_std(&self, path: impl AsRef<Path>) -> Result<File>
pub fn open_file_std(&self, path: impl AsRef<Path>) -> Result<File>
Open a file and return a standard library File.
§Errors
Returns an error if the file doesn’t exist or cannot be opened.
Sourcepub fn metadata(&self, path: impl AsRef<Path>) -> Result<Metadata>
pub fn metadata(&self, path: impl AsRef<Path>) -> Result<Metadata>
Get metadata for a file in the layer’s diff directory.
§Errors
Returns an error if the file doesn’t exist.