Skip to main content

SlotAllocator

Trait SlotAllocator 

Source
pub trait SlotAllocator: Send + Sync {
    // Required methods
    fn allocate(&self) -> FsResult<u64>;
    fn free(&self, block_id: u64) -> FsResult<()>;
    fn is_allocated(&self, block_id: u64) -> bool;
}
Expand description

Trait for allocating and freeing block slots.

Required Methods§

Source

fn allocate(&self) -> FsResult<u64>

Allocate a free block and return its ID.

Source

fn free(&self, block_id: u64) -> FsResult<()>

Return a block to the free pool.

Source

fn is_allocated(&self, block_id: u64) -> bool

Check if a block is currently allocated.

Implementors§