pub struct BlobStore { /* private fields */ }Implementations§
Source§impl BlobStore
impl BlobStore
pub fn new(protocol: &BlobsProtocol) -> Self
pub fn new_with_address_lookup( protocol: &BlobsProtocol, address_lookup: MemoryLookup, ) -> Self
pub const fn inner(&self) -> &BlobApi
Sourcepub async fn add_bytes(&self, data: impl AsRef<[u8]>) -> Result<Hash>
pub async fn add_bytes(&self, data: impl AsRef<[u8]>) -> Result<Hash>
§Errors
Returns an error if the blob fails to be added to the store.
Sourcepub async fn add_file(&self, path: impl AsRef<Path>) -> Result<Hash>
pub async fn add_file(&self, path: impl AsRef<Path>) -> Result<Hash>
§Errors
Returns an error if the file fails to be read or added to the store.
Sourcepub async fn add_file_ref(&self, path: impl AsRef<Path>) -> Result<Hash>
pub async fn add_file_ref(&self, path: impl AsRef<Path>) -> Result<Hash>
Add a file using a reference to its original path instead of copying its contents into the blob store.
The source file must remain available and unchanged for as long as the blob store may need to read this blob.
§Errors
Returns an error if the file fails to be read or added to the store.
Sourcepub async fn export_to_path(
&self,
hash: Hash,
destination: impl AsRef<Path>,
) -> Result<u64>
pub async fn export_to_path( &self, hash: Hash, destination: impl AsRef<Path>, ) -> Result<u64>
Export a complete blob to a temporary or caller-managed path.
§Errors
Returns an error if the blob cannot be read or written.
Sourcepub async fn has(&self, hash: Hash) -> Result<bool>
pub async fn has(&self, hash: Hash) -> Result<bool>
§Errors
Returns an error if the store cannot be queried.
Sourcepub async fn get(&self, hash: Hash) -> Result<Bytes>
pub async fn get(&self, hash: Hash) -> Result<Bytes>
§Errors
Returns an error if the blob cannot be found or read.
pub fn ticket(&self, endpoint: &Endpoint, hash: Hash) -> BlobTicket
pub fn ticket_for_addr(&self, addr: EndpointAddr, hash: Hash) -> BlobTicket
Sourcepub async fn pin(&self, name: impl AsRef<str>, hash: Hash) -> Result<()>
pub async fn pin(&self, name: impl AsRef<str>, hash: Hash) -> Result<()>
Pin a blob with a durable named tag so garbage collection cannot remove it.
§Errors
Returns an error if the tag cannot be written.
Sourcepub async fn is_pinned(&self, name: impl AsRef<str>, hash: Hash) -> Result<bool>
pub async fn is_pinned(&self, name: impl AsRef<str>, hash: Hash) -> Result<bool>
§Errors
Returns an error if the pin cannot be queried.
Sourcepub async fn list_hashes(&self) -> Result<Vec<Hash>>
pub async fn list_hashes(&self) -> Result<Vec<Hash>>
List all complete blobs currently in the store.
§Errors
Returns an error if the store cannot be queried.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BlobStore
impl !UnwindSafe for BlobStore
impl Freeze for BlobStore
impl Send for BlobStore
impl Sync for BlobStore
impl Unpin for BlobStore
impl UnsafeUnpin for BlobStore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more