pub struct OperatorMemoryContext { /* private fields */ }Expand description
Memory context passed to pipeline operators for pressure-aware spill decisions.
Lightweight and Clone-able (two Arc references). Operators that support
memory-aware spilling receive this at construction time. It provides access
to the BufferManager for pressure queries and consumer registration, and
to a per-query SpillManager for creating spill files.
Implementations§
Source§impl OperatorMemoryContext
impl OperatorMemoryContext
Sourcepub fn new(
buffer_manager: Arc<BufferManager>,
spill_manager: Arc<SpillManager>,
) -> Self
pub fn new( buffer_manager: Arc<BufferManager>, spill_manager: Arc<SpillManager>, ) -> Self
Creates a new operator memory context.
Sourcepub fn pressure_level(&self) -> PressureLevel
pub fn pressure_level(&self) -> PressureLevel
Returns the current pressure level.
Sourcepub fn should_spill(&self) -> bool
pub fn should_spill(&self) -> bool
Returns whether system pressure warrants spilling (High or Critical).
Sourcepub fn register_consumer(&self, consumer: Arc<dyn MemoryConsumer>)
pub fn register_consumer(&self, consumer: Arc<dyn MemoryConsumer>)
Registers a memory consumer with the buffer manager.
Sourcepub fn unregister_consumer(&self, name: &str)
pub fn unregister_consumer(&self, name: &str)
Unregisters a memory consumer by name.
Sourcepub fn buffer_manager(&self) -> &Arc<BufferManager>
pub fn buffer_manager(&self) -> &Arc<BufferManager>
Returns a reference to the buffer manager.
Sourcepub fn spill_manager(&self) -> &Arc<SpillManager>
pub fn spill_manager(&self) -> &Arc<SpillManager>
Returns a reference to the spill manager.
Trait Implementations§
Source§impl Clone for OperatorMemoryContext
impl Clone for OperatorMemoryContext
Source§fn clone(&self) -> OperatorMemoryContext
fn clone(&self) -> OperatorMemoryContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OperatorMemoryContext
impl !RefUnwindSafe for OperatorMemoryContext
impl Send for OperatorMemoryContext
impl Sync for OperatorMemoryContext
impl Unpin for OperatorMemoryContext
impl UnsafeUnpin for OperatorMemoryContext
impl !UnwindSafe for OperatorMemoryContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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