pub struct LmdbStorage { /* private fields */ }Expand description
Content-addressed LMDB storage.
Uses heed (LMDB wrapper) for memory-mapped, transactional chunk storage.
Keys are 32-byte XorName addresses, values are raw chunk bytes.
Implementations§
Source§impl LmdbStorage
impl LmdbStorage
Sourcepub async fn new(config: LmdbStorageConfig) -> Result<Self>
pub async fn new(config: LmdbStorageConfig) -> Result<Self>
Create a new LMDB storage instance.
Opens (or creates) an LMDB environment at {root_dir}/chunks.mdb/.
§Errors
Returns an error if the LMDB environment cannot be opened.
Sourcepub fn stats(&self) -> StorageStats
pub fn stats(&self) -> StorageStats
Get storage statistics.
Sourcepub fn current_chunks(&self) -> Result<u64>
pub fn current_chunks(&self) -> Result<u64>
Return the number of chunks currently stored, queried from LMDB metadata.
This is an O(1) read of the B-tree page header — not a full scan.
§Errors
Returns an error if the LMDB read transaction fails.
Sourcepub fn compute_address(content: &[u8]) -> XorName
pub fn compute_address(content: &[u8]) -> XorName
Compute content address (BLAKE3 hash).
Auto Trait Implementations§
impl !Freeze for LmdbStorage
impl !RefUnwindSafe for LmdbStorage
impl Send for LmdbStorage
impl Sync for LmdbStorage
impl Unpin for LmdbStorage
impl UnsafeUnpin for LmdbStorage
impl UnwindSafe for LmdbStorage
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> 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