Skip to main content

RecurrentStateManager

Trait RecurrentStateManager 

Source
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§

Source

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.

Source

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.

Source

fn can_allocate(&self, spec: &RecurrentStateSpec) -> bool

Check whether the manager can satisfy the allocation.

Source

fn get_handle( &self, request_id: RequestId, ) -> Option<Arc<dyn RecurrentStateHandle>>

Get handle for an existing request.

Source

fn list_handles(&self) -> Vec<(RequestId, Arc<dyn RecurrentStateHandle>)>

List all active recurrent-state handles.

Source

fn stats(&self) -> RecurrentStateManagerStats

Get aggregate manager statistics.

Source

fn reset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drop all state owned by this manager.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§