blobfs

Struct Client

Source
pub struct Client { /* private fields */ }
Expand description

Blobfs client

Implementations§

Source§

impl Client

Source

pub fn builder() -> ClientBuilder

Create an empty ClientBuilder

Source§

impl Client

Source

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.

Source

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

Source

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

Source

pub async fn get_blob_vmo(&self, hash: &Hash) -> Result<Vmo, GetBlobVmoError>

Returns the read-only VMO backing the blob.

Source

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.

Source

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.

Source

pub async fn list_known_blobs(&self) -> Result<HashSet<Hash>, BlobfsError>

Returns the list of known blobs in blobfs.

Source

pub async fn delete_blob(&self, blob: &Hash) -> Result<(), BlobfsError>

Delete the blob with the given merkle hash.

Source

pub async fn open_blob_for_write( &self, blob: &Hash, ) -> Result<BlobWriter, CreateError>

Open a new blob for write.

Source

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.

Source

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:

  1. blob is partially written by resolve A
  2. blob is opened by this fn to check for presence by concurrent resolve B
  3. 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
Source

pub async fn sync(&self) -> Result<(), BlobfsError>

Call fuchsia.io/Node.Sync on the blobfs directory.

Trait Implementations§

Source§

impl Clone for Client

Source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

Source§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Cast the given object into a dyn std::any::Any.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more