pub struct Client { /* private fields */ }
Expand description
Blobfs client
Implementations§
source§impl Client
impl Client
sourcepub fn new(
dir: DirectoryProxy,
creator: Option<BlobCreatorProxy>,
reader: Option<BlobReaderProxy>,
vmex: Option<Resource>
) -> Result<Self, Error>
pub fn new( dir: DirectoryProxy, creator: Option<BlobCreatorProxy>, reader: Option<BlobReaderProxy>, vmex: Option<Resource> ) -> Result<Self, Error>
Returns a client connected to the given blob directory, BlobCreatorProxy, and
BlobReaderProxy. If vmex
is passed in, sets the VmexResource, which is used to mark blobs
as executable. If creator
or reader
is not supplied, writes or reads respectively will
be performed through the blob directory.
sourcepub fn new_test() -> (Self, DirectoryRequestStream)
pub fn new_test() -> (Self, DirectoryRequestStream)
Creates a new client backed by the returned request stream. This constructor should not be used outside of tests.
§Panics
Panics on error
sourcepub fn new_mock() -> (Self, Mock)
pub fn new_mock() -> (Self, Mock)
Creates a new client backed by the returned mock. This constructor should not be used outside of tests.
§Panics
Panics on error
sourcepub fn open_blob_for_read(
&self,
blob: &Hash,
flags: OpenFlags,
scope: ExecutionScope,
server_end: ServerEnd<NodeMarker>
) -> Result<(), Error>
pub fn open_blob_for_read( &self, blob: &Hash, flags: OpenFlags, scope: ExecutionScope, server_end: ServerEnd<NodeMarker> ) -> Result<(), Error>
Open a blob for read. scope
will only be used if the client was configured to use
fuchsia.fxfs.BlobReader.
sourcepub fn open2_blob_for_read(
&self,
blob: &Hash,
protocols: ConnectionProtocols,
scope: ExecutionScope,
object_request: ObjectRequestRef<'_>
) -> Result<(), Status>
pub fn open2_blob_for_read( &self, blob: &Hash, protocols: ConnectionProtocols, scope: ExecutionScope, object_request: ObjectRequestRef<'_> ) -> Result<(), Status>
Open a blob for read using open2. scope
will only be used if the client was configured to
use fuchsia.fxfs.BlobReader.
sourcepub async fn list_known_blobs(&self) -> Result<HashSet<Hash>, BlobfsError>
pub async fn list_known_blobs(&self) -> Result<HashSet<Hash>, BlobfsError>
Returns the list of known blobs in blobfs.
sourcepub async fn delete_blob(&self, blob: &Hash) -> Result<(), BlobfsError>
pub async fn delete_blob(&self, blob: &Hash) -> Result<(), BlobfsError>
Delete the blob with the given merkle hash.
sourcepub async fn open_blob_for_write(
&self,
blob: &Hash
) -> Result<BlobWriter, CreateError>
pub async fn open_blob_for_write( &self, blob: &Hash ) -> Result<BlobWriter, CreateError>
Open a new blob for write.
sourcepub async fn has_blob(&self, blob: &Hash) -> bool
pub async fn has_blob(&self, blob: &Hash) -> bool
Returns whether blobfs has a blob with the given hash.
sourcepub async fn filter_to_missing_blobs(
&self,
candidates: &HashSet<Hash>,
all_known: Option<&HashSet<Hash>>
) -> HashSet<Hash>
pub async fn filter_to_missing_blobs( &self, candidates: &HashSet<Hash>, all_known: Option<&HashSet<Hash>> ) -> HashSet<Hash>
Determines which of candidate blobs exist and are readable in blobfs, returning the
set difference of candidates and readable.
If provided, all_known
should be a superset of all readable blobs in blobfs, i.e.
if a blob is readable it must be in all_known
, but non-readable blobs may also be
included.
all_known
is used to skip the expensive per-blob readable check for blobs that we are
sure are missing.
sourcepub async fn sync(&self) -> Result<(), BlobfsError>
pub async fn sync(&self) -> Result<(), BlobfsError>
Call fuchsia.io/Node.Sync on the blobfs directory.