pub struct BlockLease { /* private fields */ }Expand description
A block storage lease that auto-frees on drop.
Wraps a FabricBlock handle with RAII lifecycle management. When the
BlockLease is dropped, the underlying resource will be released (once
the host provides an explicit fbbu_free() call).
Created via BlockBuilder::acquire.
§Examples
use grafos_std::block::{BlockBuilder, BLOCK_SIZE};
let lease = BlockBuilder::new().min_blocks(16).acquire()?;
let data = [42u8; BLOCK_SIZE];
lease.block().write_block(0, &data)?;
// lease is freed when it goes out of scopeImplementations§
Source§impl BlockLease
impl BlockLease
Sourcepub fn block(&self) -> &FabricBlock
pub fn block(&self) -> &FabricBlock
Access the underlying FabricBlock handle for I/O operations.
Sourcepub fn info(&self) -> LeaseInfo
pub fn info(&self) -> LeaseInfo
Lease metadata snapshot (id, creation time, expiry, and status).
Sourcepub fn created_at_unix_secs(&self) -> u64
pub fn created_at_unix_secs(&self) -> u64
Lease creation timestamp (unix seconds).
Sourcepub fn expires_at_unix_secs(&self) -> u64
pub fn expires_at_unix_secs(&self) -> u64
Lease expiry timestamp (unix seconds).
Sourcepub fn status(&self) -> LeaseStatus
pub fn status(&self) -> LeaseStatus
Current lease status.
Trait Implementations§
Source§impl Debug for BlockLease
impl Debug for BlockLease
Auto Trait Implementations§
impl Freeze for BlockLease
impl !RefUnwindSafe for BlockLease
impl !Send for BlockLease
impl !Sync for BlockLease
impl Unpin for BlockLease
impl !UnwindSafe for BlockLease
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