pub struct RootDir<S> { /* private fields */ }
Expand description
The root directory of Fuchsia package.
Implementations§
Source§impl<S: NonMetaStorage> RootDir<S>
impl<S: NonMetaStorage> RootDir<S>
Sourcepub async fn new(non_meta_storage: S, hash: Hash) -> Result<Arc<Self>, Error>
pub async fn new(non_meta_storage: S, hash: Hash) -> Result<Arc<Self>, Error>
Loads the package metadata given by hash
from non_meta_storage
, returning an object
representing the package, backed by non_meta_storage
.
Sourcepub async fn new_with_dropper(
non_meta_storage: S,
hash: Hash,
dropper: Box<dyn OnRootDirDrop>,
) -> Result<Arc<Self>, Error>
pub async fn new_with_dropper( non_meta_storage: S, hash: Hash, dropper: Box<dyn OnRootDirDrop>, ) -> Result<Arc<Self>, Error>
Loads the package metadata given by hash
from non_meta_storage
, returning an object
representing the package, backed by non_meta_storage
.
Takes dropper
, which will be dropped when the returned RootDir
is dropped.
Sourcepub async fn new_raw(
non_meta_storage: S,
hash: Hash,
dropper: Option<Box<dyn OnRootDirDrop>>,
) -> Result<Self, Error>
pub async fn new_raw( non_meta_storage: S, hash: Hash, dropper: Option<Box<dyn OnRootDirDrop>>, ) -> Result<Self, Error>
Loads the package metadata given by hash
from non_meta_storage
, returning an object
representing the package, backed by non_meta_storage
.
Takes dropper
, which will be dropped when the returned RootDir
is dropped.
Like new_with_dropper
except the returned RootDir
is not in an Arc
.
Sourcepub fn set_dropper(
&mut self,
dropper: Box<dyn OnRootDirDrop>,
) -> Result<(), Box<dyn OnRootDirDrop>>
pub fn set_dropper( &mut self, dropper: Box<dyn OnRootDirDrop>, ) -> Result<(), Box<dyn OnRootDirDrop>>
Sets the dropper. If the dropper was already set, returns dropper
in the error.
Sourcepub async fn read_file(&self, path: &str) -> Result<Vec<u8>, ReadFileError>
pub async fn read_file(&self, path: &str) -> Result<Vec<u8>, ReadFileError>
Returns the contents, if present, of the file at object relative path expression path
.
https://fuchsia.dev/fuchsia-src/concepts/process/namespaces?hl=en#object_relative_path_expressions
Sourcepub fn has_file(&self, path: &str) -> bool
pub fn has_file(&self, path: &str) -> bool
Returns true
iff there is a file at path
, an object relative path expression.
https://fuchsia.dev/fuchsia-src/concepts/process/namespaces?hl=en#object_relative_path_expressions
Sourcepub fn external_file_hashes(&self) -> impl ExactSizeIterator<Item = &Hash>
pub fn external_file_hashes(&self) -> impl ExactSizeIterator<Item = &Hash>
Returns an iterator of the hashes of files stored externally to the package meta.far. May return duplicates.
Sourcepub async fn path(&self) -> Result<PackagePath, PathError>
pub async fn path(&self) -> Result<PackagePath, PathError>
Returns the path of the package as indicated by the “meta/package” file.
Sourcepub async fn subpackages(&self) -> Result<MetaSubpackages, SubpackagesError>
pub async fn subpackages(&self) -> Result<MetaSubpackages, SubpackagesError>
Returns the subpackages of the package.
Trait Implementations§
Source§impl<S: NonMetaStorage> Directory for RootDir<S>
impl<S: NonMetaStorage> Directory for RootDir<S>
Source§fn open(
self: Arc<Self>,
scope: ExecutionScope,
flags: OpenFlags,
path: VfsPath,
server_end: ServerEnd<NodeMarker>,
)
fn open( self: Arc<Self>, scope: ExecutionScope, flags: OpenFlags, path: VfsPath, server_end: ServerEnd<NodeMarker>, )
path
is “.” or a connection to an item inside this
one otherwise. path
will not contain any “.” or “..” components. Read moreSource§fn open3(
self: Arc<Self>,
scope: ExecutionScope,
path: VfsPath,
flags: Flags,
object_request: ObjectRequestRef<'_>,
) -> Result<(), Status>
fn open3( self: Arc<Self>, scope: ExecutionScope, path: VfsPath, flags: Flags, object_request: ObjectRequestRef<'_>, ) -> Result<(), Status>
path
is “.” or a connection to an item inside
this one otherwise. path
will not contain any “.” or “..” components. Read moreSource§async fn read_dirents<'a>(
&'a self,
pos: &'a TraversalPosition,
sink: Box<dyn Sink + 'static>,
) -> Result<(TraversalPosition, Box<dyn Sealed + 'static>), Status>
async fn read_dirents<'a>( &'a self, pos: &'a TraversalPosition, sink: Box<dyn Sink + 'static>, ) -> Result<(TraversalPosition, Box<dyn Sealed + 'static>), Status>
pos
by adding them to sink
.
Once finished, should return a sealed sink.Source§fn register_watcher(
self: Arc<Self>,
_: ExecutionScope,
_: WatchMask,
_: DirectoryWatcher,
) -> Result<(), Status>
fn register_watcher( self: Arc<Self>, _: ExecutionScope, _: WatchMask, _: DirectoryWatcher, ) -> Result<(), Status>
Watcher
to manage watchers.Source§fn unregister_watcher(self: Arc<Self>, _: usize)
fn unregister_watcher(self: Arc<Self>, _: usize)
Source§impl<S: NonMetaStorage> DirectoryEntry for RootDir<S>
impl<S: NonMetaStorage> DirectoryEntry for RootDir<S>
Source§fn open_entry(self: Arc<Self>, request: OpenRequest<'_>) -> Result<(), Status>
fn open_entry(self: Arc<Self>, request: OpenRequest<'_>) -> Result<(), Status>
Source§impl<S: NonMetaStorage> GetEntryInfo for RootDir<S>
impl<S: NonMetaStorage> GetEntryInfo for RootDir<S>
Source§fn entry_info(&self) -> EntryInfo
fn entry_info(&self) -> EntryInfo
Source§impl<S: NonMetaStorage> Node for RootDir<S>
impl<S: NonMetaStorage> Node for RootDir<S>
Source§async fn get_attributes(
&self,
requested_attributes: NodeAttributesQuery,
) -> Result<NodeAttributes2, Status>
async fn get_attributes( &self, requested_attributes: NodeAttributesQuery, ) -> Result<NodeAttributes2, Status>
Source§fn will_open_as_node(&self) -> Result<(), Status>
fn will_open_as_node(&self) -> Result<(), Status>
Source§fn will_clone(&self)
fn will_clone(&self)
will_clone
will be accompanied by an eventual call to close
.