pub struct BlobStore { /* private fields */ }Expand description
Storage implementation for managed local storage.
Writes files to library_dir/storage/ab/cd/{file_id} as plaintext.
Local files are never encrypted – encryption only happens when uploading
to the cloud home.
Implementations§
Source§impl BlobStore
impl BlobStore
Sourcepub fn new_local(library_dir: LibraryDir) -> Self
pub fn new_local(library_dir: LibraryDir) -> Self
Create storage for managed local blobs.
Sourcepub async fn store_bytes(
&self,
file_id: &str,
data: &[u8],
on_progress: Box<dyn Fn(usize, usize) + Send + Sync>,
) -> Result<(), StorageError>
pub async fn store_bytes( &self, file_id: &str, data: &[u8], on_progress: Box<dyn Fn(usize, usize) + Send + Sync>, ) -> Result<(), StorageError>
Write bytes to local storage without creating a DB record.
Uses the given file_id for the hash-based storage path.
Sourcepub async fn store_from_path(
&self,
file_id: &str,
source: &Path,
on_progress: Box<dyn Fn(usize, usize) + Send + Sync>,
) -> Result<(), StorageError>
pub async fn store_from_path( &self, file_id: &str, source: &Path, on_progress: Box<dyn Fn(usize, usize) + Send + Sync>, ) -> Result<(), StorageError>
Stream a source file from disk into local storage without buffering the
whole thing in memory. Progress is reported in 1 MiB batches to match
the cadence of store_bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlobStore
impl RefUnwindSafe for BlobStore
impl Send for BlobStore
impl Sync for BlobStore
impl Unpin for BlobStore
impl UnwindSafe for BlobStore
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.