pub struct TarFileSystem { /* private fields */ }Expand description
Read-only filesystem backed by the mount chunk of a .aospkg package.
The package container is header + manifest + mount index + mount.tar.
TarFileSystem::open decodes only the precomputed mount index and serves
reads from the uncompressed mount.tar chunk at mountBase + offset.
Extraction would create a duplicate host tree, thousands of physical inodes,
and a cleanup problem before reading the same bytes again.
File reads are an O(log n) index lookup plus a page-cache-backed memory
slice; metadata and directory listings come from the in-memory index. The
index must be pre-sorted by canonical path, and load performs a release-safe
adjacent-order check before any binary-search-dependent path can run. The
mmap is keyed by file identity and shared across VMs, so RSS follows the
pages actually touched rather than the full archive size. This open path is
on VM startup (configure_vm), so it must stay O(index decode): never parse
tar headers, read/hash the whole archive, or recover metadata from legacy
in-archive JSON here.
This filesystem is mounted only as a granular package-version leaf such as
/opt/agentos/pkgs/<pkg>/<version>. Managed commands and current aliases
are separate symlink leaf mounts, while parent directories stay writable
overlay directories so user-installed files can coexist with managed ones.
Implementations§
Source§impl TarFileSystem
impl TarFileSystem
Trait Implementations§
Source§impl Clone for TarFileSystem
impl Clone for TarFileSystem
Source§fn clone(&self) -> TarFileSystem
fn clone(&self) -> TarFileSystem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl VirtualFileSystem for TarFileSystem
impl VirtualFileSystem for TarFileSystem
fn read_file(&mut self, path: &str) -> Result<Vec<u8>, VfsError>
fn read_dir(&mut self, path: &str) -> Result<Vec<String>, VfsError>
fn read_dir_with_types( &mut self, path: &str, ) -> Result<Vec<VirtualDirEntry>, VfsError>
Source§fn write_file(
&mut self,
path: &str,
_content: impl Into<Vec<u8>>,
) -> Result<(), VfsError>
fn write_file( &mut self, path: &str, _content: impl Into<Vec<u8>>, ) -> Result<(), VfsError>
fn create_dir(&mut self, path: &str) -> Result<(), VfsError>
fn mkdir(&mut self, path: &str, _recursive: bool) -> Result<(), VfsError>
fn exists(&self, path: &str) -> bool
fn stat(&mut self, path: &str) -> Result<VirtualStat, VfsError>
fn remove_file(&mut self, path: &str) -> Result<(), VfsError>
fn remove_dir(&mut self, path: &str) -> Result<(), VfsError>
fn rename(&mut self, old_path: &str, new_path: &str) -> Result<(), VfsError>
fn realpath(&self, path: &str) -> Result<String, VfsError>
fn symlink(&mut self, target: &str, link_path: &str) -> Result<(), VfsError>
fn read_link(&self, path: &str) -> Result<String, VfsError>
fn lstat(&self, path: &str) -> Result<VirtualStat, VfsError>
fn link(&mut self, old_path: &str, new_path: &str) -> Result<(), VfsError>
fn chmod(&mut self, path: &str, _mode: u32) -> Result<(), VfsError>
fn chown(&mut self, path: &str, _uid: u32, _gid: u32) -> Result<(), VfsError>
fn utimes( &mut self, path: &str, _atime_ms: u64, _mtime_ms: u64, ) -> Result<(), VfsError>
fn utimes_spec( &mut self, path: &str, _atime: VirtualUtimeSpec, _mtime: VirtualUtimeSpec, _follow_symlinks: bool, ) -> Result<(), VfsError>
Source§fn truncate(&mut self, path: &str, _length: u64) -> Result<(), VfsError>
fn truncate(&mut self, path: &str, _length: u64) -> Result<(), VfsError>
fn pread( &mut self, path: &str, offset: u64, length: usize, ) -> Result<Vec<u8>, VfsError>
fn read_text_file(&mut self, path: &str) -> Result<String, VfsError>
fn read_dir_limited( &mut self, path: &str, max_entries: usize, ) -> Result<Vec<String>, VfsError>
fn write_file_with_mode( &mut self, path: &str, content: impl Into<Vec<u8>>, mode: Option<u32>, ) -> Result<(), VfsError>
fn create_file_exclusive( &mut self, path: &str, content: impl Into<Vec<u8>>, ) -> Result<(), VfsError>
fn create_file_exclusive_with_mode( &mut self, path: &str, content: impl Into<Vec<u8>>, mode: Option<u32>, ) -> Result<(), VfsError>
Source§fn append_file(
&mut self,
path: &str,
content: impl Into<Vec<u8>>,
) -> Result<u64, VfsError>
fn append_file( &mut self, path: &str, content: impl Into<Vec<u8>>, ) -> Result<u64, VfsError>
fn create_dir_with_mode( &mut self, path: &str, mode: Option<u32>, ) -> Result<(), VfsError>
fn mkdir_with_mode( &mut self, path: &str, recursive: bool, mode: Option<u32>, ) -> Result<(), VfsError>
Auto Trait Implementations§
impl Freeze for TarFileSystem
impl RefUnwindSafe for TarFileSystem
impl Send for TarFileSystem
impl Sync for TarFileSystem
impl Unpin for TarFileSystem
impl UnsafeUnpin for TarFileSystem
impl UnwindSafe for TarFileSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more