pub struct ExecutionMemoryContext { /* private fields */ }Expand description
Execution context with memory awareness.
This context provides memory allocation for query execution operators and adjusts chunk sizes based on memory pressure.
Implementations§
Source§impl ExecutionMemoryContext
impl ExecutionMemoryContext
Sourcepub fn new(manager: Arc<BufferManager>) -> Self
pub fn new(manager: Arc<BufferManager>) -> Self
Creates a new execution memory context.
Sourcepub fn allocate(&mut self, size: usize) -> Option<MemoryGrant>
pub fn allocate(&mut self, size: usize) -> Option<MemoryGrant>
Requests memory for execution buffers.
Returns None if the allocation cannot be satisfied.
Sourcepub fn allocate_tracked(&mut self, size: usize) -> bool
pub fn allocate_tracked(&mut self, size: usize) -> bool
Allocates and stores a grant internally.
The grant will be released when this context is dropped.
Sourcepub fn pressure_level(&self) -> PressureLevel
pub fn pressure_level(&self) -> PressureLevel
Returns the current pressure level.
Sourcepub fn should_reduce_chunk_size(&self) -> bool
pub fn should_reduce_chunk_size(&self) -> bool
Returns whether chunk size should be reduced due to memory pressure.
Sourcepub fn adjusted_chunk_size(&self, requested: usize) -> usize
pub fn adjusted_chunk_size(&self, requested: usize) -> usize
Computes adjusted chunk size based on memory pressure.
Sourcepub fn optimal_chunk_size(&self) -> usize
pub fn optimal_chunk_size(&self) -> usize
Returns the optimal chunk size for the current memory state.
Sourcepub fn total_allocated(&self) -> usize
pub fn total_allocated(&self) -> usize
Returns total bytes allocated through this context.
Sourcepub fn manager(&self) -> &Arc<BufferManager>
pub fn manager(&self) -> &Arc<BufferManager>
Returns the buffer manager.
Sourcepub fn release_all(&mut self)
pub fn release_all(&mut self)
Releases all tracked grants.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExecutionMemoryContext
impl !RefUnwindSafe for ExecutionMemoryContext
impl Send for ExecutionMemoryContext
impl Sync for ExecutionMemoryContext
impl Unpin for ExecutionMemoryContext
impl !UnwindSafe for ExecutionMemoryContext
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