Trait dbkit_engine::allocator::Allocator
[−]
[src]
pub trait Allocator: Send + Sync { fn allocate(&self, size: usize) -> Result<OwnedChunk, DBError>; fn allocate_aligned(&self, size: usize, align: usize) -> Result<OwnedChunk, DBError>; unsafe fn resize<'a>(&self, prev: &mut OwnedChunk<'a>, size: usize) -> Option<DBError>; fn putback(&self, data: &mut OwnedChunk); fn putback_raw(&self, ptr: *mut u8, size: usize, align: usize); }
Allocator trait, used through out the operations in dbkit.
Allocators have to maintain their own synchronization
Required Methods
fn allocate(&self, size: usize) -> Result<OwnedChunk, DBError>
fn allocate_aligned(&self, size: usize, align: usize) -> Result<OwnedChunk, DBError>
unsafe fn resize<'a>(&self, prev: &mut OwnedChunk<'a>, size: usize) -> Option<DBError>
Resize; will try to resize in place if possible
fn putback(&self, data: &mut OwnedChunk)
fn putback_raw(&self, ptr: *mut u8, size: usize, align: usize)
Implementors
impl Allocator for HeapAllocator