pub struct HashStore { /* private fields */ }Expand description
Thread-safe hash store using sled embedded database
Implementations§
Source§impl HashStore
impl HashStore
Sourcepub fn insert(&self, hash: &str, file: UploadedFile) -> Result<()>
pub fn insert(&self, hash: &str, file: UploadedFile) -> Result<()>
Insert a new uploaded file record
Sourcepub fn insert_deferred(&self, hash: &str, file: &UploadedFile) -> Result<()>
pub fn insert_deferred(&self, hash: &str, file: &UploadedFile) -> Result<()>
Insert without flushing. Sled flushes on its own every half second,
so a crash loses at most that much; for runs that insert many records
and call flush when done.
Sourcepub fn remove_deferred(&self, hash: &str) -> Result<()>
pub fn remove_deferred(&self, hash: &str) -> Result<()>
Forget one file without flushing (see insert_deferred).
Sourcepub fn open_tree(&self, name: &str) -> Result<Tree>
pub fn open_tree(&self, name: &str) -> Result<Tree>
Another keyspace in the same database (e.g. the per-path file index), since sled lets only one process open it at a time.
Sourcepub fn remove(&self, hash: &str) -> Result<()>
pub fn remove(&self, hash: &str) -> Result<()>
Forget one file, e.g. when the image it points to no longer exists
Sourcepub fn stats(&self) -> Result<CacheStats>
pub fn stats(&self) -> Result<CacheStats>
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HashStore
impl !UnwindSafe for HashStore
impl Freeze for HashStore
impl Send for HashStore
impl Sync for HashStore
impl Unpin for HashStore
impl UnsafeUnpin for HashStore
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
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> ⓘ
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 more