pub trait RecurrentStateManager: Send + Sync {
// Required methods
fn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 RecurrentStateSpec,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RecurrentStateHandle>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn deallocate<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn can_allocate(&self, spec: &RecurrentStateSpec) -> bool;
fn get_handle(
&self,
request_id: RequestId,
) -> Option<Arc<dyn RecurrentStateHandle>>;
fn list_handles(&self) -> Vec<(RequestId, Arc<dyn RecurrentStateHandle>)>;
fn stats(&self) -> RecurrentStateManagerStats;
fn reset<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Recurrent-state cache manager for allocation and lifecycle management.
Required Methods§
Sourcefn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 RecurrentStateSpec,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RecurrentStateHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
spec: &'life1 RecurrentStateSpec,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RecurrentStateHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Allocate recurrent state for one request.
Sourcefn deallocate<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn deallocate<'life0, 'async_trait>(
&'life0 self,
request_id: RequestId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deallocate recurrent state for one request.
Sourcefn can_allocate(&self, spec: &RecurrentStateSpec) -> bool
fn can_allocate(&self, spec: &RecurrentStateSpec) -> bool
Check whether the manager can satisfy the allocation.
Sourcefn get_handle(
&self,
request_id: RequestId,
) -> Option<Arc<dyn RecurrentStateHandle>>
fn get_handle( &self, request_id: RequestId, ) -> Option<Arc<dyn RecurrentStateHandle>>
Get handle for an existing request.
Sourcefn list_handles(&self) -> Vec<(RequestId, Arc<dyn RecurrentStateHandle>)>
fn list_handles(&self) -> Vec<(RequestId, Arc<dyn RecurrentStateHandle>)>
List all active recurrent-state handles.
Sourcefn stats(&self) -> RecurrentStateManagerStats
fn stats(&self) -> RecurrentStateManagerStats
Get aggregate manager statistics.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".