pub struct StorageIndex { /* private fields */ }Expand description
Ephemeral metadata index backed by redb.
Implementations§
Source§impl StorageIndex
impl StorageIndex
Sourcepub fn open(path: &Path) -> Result<Self, CacheError>
pub fn open(path: &Path) -> Result<Self, CacheError>
Open or create the index at the given path.
Sourcepub fn index_narinfo(&self, hash: &str, nar_size: u64) -> Result<(), CacheError>
pub fn index_narinfo(&self, hash: &str, nar_size: u64) -> Result<(), CacheError>
Record a narinfo in the index.
Sourcepub fn index_store_path(
&self,
store_path: &str,
hash: &str,
) -> Result<(), CacheError>
pub fn index_store_path( &self, store_path: &str, hash: &str, ) -> Result<(), CacheError>
Record a store path → hash mapping.
Sourcepub fn has_narinfo(&self, hash: &str) -> Result<bool, CacheError>
pub fn has_narinfo(&self, hash: &str) -> Result<bool, CacheError>
Check if a hash exists in the index.
Sourcepub fn list_hashes(&self) -> Result<Vec<String>, CacheError>
pub fn list_hashes(&self) -> Result<Vec<String>, CacheError>
List all indexed hashes.
Sourcepub fn count(&self) -> Result<u64, CacheError>
pub fn count(&self) -> Result<u64, CacheError>
Total number of indexed narinfos.
Auto Trait Implementations§
impl !RefUnwindSafe for StorageIndex
impl !UnwindSafe for StorageIndex
impl Freeze for StorageIndex
impl Send for StorageIndex
impl Sync for StorageIndex
impl Unpin for StorageIndex
impl UnsafeUnpin for StorageIndex
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> 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