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 async fn get_blob_vmo(&self, hash: &Hash) -> Result<Vmo, GetBlobVmoError>
pub async fn get_blob_vmo(&self, hash: &Hash) -> Result<Vmo, GetBlobVmoError>
Returns the read-only VMO backing the blob.
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 open3_blob_for_read(
&self,
blob: &Hash,
flags: Flags,
scope: ExecutionScope,
object_request: ObjectRequestRef<'_>,
) -> Result<(), Status>
pub fn open3_blob_for_read( &self, blob: &Hash, flags: Flags, scope: ExecutionScope, object_request: ObjectRequestRef<'_>, ) -> Result<(), Status>
Open a blob for read using open3. 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. On c++blobfs, this should only be called if there are no concurrent attempts to write the blob. On c++blobfs, open connections to even partially written blobs keep the blob alive, and so if this call overlaps with a concurrent attempt to create the blob that fails and is then retried, this open connection will prevent the partially written blob from being removed and block the creation of the new write connection. TODO(https://fxbug.dev/294286136) Add GetVmo support to c++blobfs.
Sourcepub async fn filter_to_missing_blobs(
&self,
candidates: &HashSet<Hash>,
) -> HashSet<Hash>
pub async fn filter_to_missing_blobs( &self, candidates: &HashSet<Hash>, ) -> HashSet<Hash>
Determines which blobs of candidates
are missing from blobfs.
TODO(https://fxbug.dev/338477132) This fn is used during resolves after a meta.far is
fetched to determine which content blobs and subpackage meta.fars need to be fetched.
On c++blobfs, opening a partially written blob keeps that blob alive, creating the
following race condition:
- blob is partially written by resolve A
- blob is opened by this fn to check for presence by concurrent resolve B
- resolve A encounters an error and retries the fetch, which attempts to open the blob for write, which collides with the partially written blob from (1) that is being kept alive by (2) and so fails
Sourcepub async fn sync(&self) -> Result<(), BlobfsError>
pub async fn sync(&self) -> Result<(), BlobfsError>
Call fuchsia.io/Node.Sync on the blobfs directory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)