pub struct IndexReadGuard<'a, K> { /* private fields */ }Expand description
A read-only view of the index state. Holds a shared read lock for the duration of the guard. Supports lookup, iteration, and range queries in key order.
Implementations§
Source§impl<'a, K> IndexReadGuard<'a, K>
impl<'a, K> IndexReadGuard<'a, K>
pub fn stats(&self) -> DbStats
Sourcepub fn known_blobs(&self) -> Iter<'_, BlobHash, u32>
pub fn known_blobs(&self) -> Iter<'_, BlobHash, u32>
Returns an iterator over known blob hashes and their reference counts.
Sourcepub fn contains_blob_hash(&self, hash: &BlobHash) -> bool
pub fn contains_blob_hash(&self, hash: &BlobHash) -> bool
Returns true if the given blob hash is currently referenced.
Sourcepub fn range<T, R>(&self, range: R) -> Range<'_, K, IndexStateItem>
pub fn range<T, R>(&self, range: R) -> Range<'_, K, IndexStateItem>
Returns an iterator over entries within the specified key range, in ascending order.
The range may use a borrowed form of the key (e.g., &str for String).
Source§impl<'a, K> IndexReadGuard<'a, K>where
K: Ord,
impl<'a, K> IndexReadGuard<'a, K>where
K: Ord,
Sourcepub fn get_item(&self, key: &K) -> Option<IndexStateItem>
pub fn get_item(&self, key: &K) -> Option<IndexStateItem>
Returns the item for the given key, if it exists.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Returns true if the index contains the specified key.
Sourcepub fn iter(&self) -> Iter<'_, K, IndexStateItem>
pub fn iter(&self) -> Iter<'_, K, IndexStateItem>
Returns an iterator over all entries in ascending key order.
Source§impl<'a, K> IndexReadGuard<'a, K>
impl<'a, K> IndexReadGuard<'a, K>
Sourcepub fn require_item(&self, key: &K) -> Result<IndexStateItem, IndexError>
pub fn require_item(&self, key: &K) -> Result<IndexStateItem, IndexError>
Returns the item for the given key, or an error if it is not present.
Source§impl<'a, K> IndexReadGuard<'a, K>where
K: Clone,
impl<'a, K> IndexReadGuard<'a, K>where
K: Clone,
Sourcepub fn keys_snapshot(&self) -> BTreeMap<K, IndexStateItem>
pub fn keys_snapshot(&self) -> BTreeMap<K, IndexStateItem>
Returns a snapshot of the current key map.
Calls clone inside.
Auto Trait Implementations§
impl<'a, K> Freeze for IndexReadGuard<'a, K>
impl<'a, K> !RefUnwindSafe for IndexReadGuard<'a, K>
impl<'a, K> !Send for IndexReadGuard<'a, K>
impl<'a, K> Sync for IndexReadGuard<'a, K>where
K: Sync,
impl<'a, K> Unpin for IndexReadGuard<'a, K>
impl<'a, K> !UnwindSafe for IndexReadGuard<'a, K>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more