Trait datafusion::execution::memory_manager::MemoryConsumer
source · pub trait MemoryConsumer: Send + Sync {
fn name(&self) -> String;
fn id(&self) -> &MemoryConsumerId;
fn memory_manager(&self) -> Arc<MemoryManager>;
fn type_(&self) -> &ConsumerType;
fn spill<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn mem_used(&self) -> usize;
fn partition_id(&self) -> usize { ... }
fn try_grow<'life0, 'async_trait>(
&'life0 self,
required: usize
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn grow(&self, required: usize) { ... }
fn shrink(&self, freed: usize) { ... }
}
Expand description
A memory consumer that either takes up memory (of type ConsumerType::Tracking
)
or grows/shrinks memory usage based on available memory (of type ConsumerType::Requesting
).
Required Methods
sourcefn id(&self) -> &MemoryConsumerId
fn id(&self) -> &MemoryConsumerId
Unique id of the consumer
sourcefn memory_manager(&self) -> Arc<MemoryManager>
fn memory_manager(&self) -> Arc<MemoryManager>
Ptr to MemoryManager
sourcefn type_(&self) -> &ConsumerType
fn type_(&self) -> &ConsumerType
Type of the consumer
Provided Methods
sourcefn partition_id(&self) -> usize
fn partition_id(&self) -> usize
Partition that the consumer belongs to
sourcefn try_grow<'life0, 'async_trait>(
&'life0 self,
required: usize
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn try_grow<'life0, 'async_trait>(
&'life0 self,
required: usize
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Grow memory by required
to buffer more data in memory,
this may trigger spill before grow when the memory threshold is
reached for this consumer.