Struct package_directory::RootDir
source · 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 open2(
self: Arc<Self>,
scope: ExecutionScope,
path: VfsPath,
protocols: ConnectionProtocols,
object_request: ObjectRequestRef<'_>
) -> Result<(), Status>
fn open2( self: Arc<Self>, scope: ExecutionScope, path: VfsPath, protocols: ConnectionProtocols, 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§fn read_dirents<'a, 'async_trait>(
&'a self,
pos: &'a TraversalPosition,
sink: Box<dyn Sink + 'static>
) -> Pin<Box<dyn Future<Output = Result<(TraversalPosition, Box<dyn Sealed + 'static>), Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
fn read_dirents<'a, 'async_trait>(
&'a self,
pos: &'a TraversalPosition,
sink: Box<dyn Sink + 'static>
) -> Pin<Box<dyn Future<Output = Result<(TraversalPosition, Box<dyn Sealed + 'static>), Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'a: 'async_trait,
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 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§fn get_attrs<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<NodeAttributes, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_attrs<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<NodeAttributes, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§fn get_attributes<'life0, 'async_trait>(
&'life0 self,
requested_attributes: NodeAttributesQuery
) -> Pin<Box<dyn Future<Output = Result<NodeAttributes2, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_attributes<'life0, 'async_trait>(
&'life0 self,
requested_attributes: NodeAttributesQuery
) -> Pin<Box<dyn Future<Output = Result<NodeAttributes2, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
§fn will_open_as_node(&self) -> Result<(), Status>
fn will_open_as_node(&self) -> Result<(), Status>
§fn will_clone(&self)
fn will_clone(&self)
will_clone
will be accompanied by an eventual call to close
.