pub struct MockKvCacheManager { /* private fields */ }Expand description
Mock KV cache manager — tracks allocations in memory, simulates block limits.
Implementations§
Trait Implementations§
Source§impl KvCacheManager for MockKvCacheManager
impl KvCacheManager for MockKvCacheManager
Source§fn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 AllocationRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvCacheHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn allocate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 AllocationRequest,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn KvCacheHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Allocate cache for new sequence
Source§fn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
_handle: &'life1 mut dyn KvCacheHandle,
_additional_tokens: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extend<'life0, 'life1, 'async_trait>(
&'life0 self,
_handle: &'life1 mut dyn KvCacheHandle,
_additional_tokens: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extend existing cache to accommodate more tokens
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,
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 cache (handle becomes invalid)
Source§fn can_allocate(&self, request: &AllocationRequest) -> bool
fn can_allocate(&self, request: &AllocationRequest) -> bool
Check if can allocate requested cache size
Source§fn stats(&self) -> CacheManagerStats
fn stats(&self) -> CacheManagerStats
Get cache statistics
Source§fn gc<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CacheGcStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn gc<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CacheGcStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Force garbage collection of unused caches
Source§fn set_pressure_callback(
&self,
_callback: Box<dyn Fn(MemoryPressure) + Send + Sync>,
)
fn set_pressure_callback( &self, _callback: Box<dyn Fn(MemoryPressure) + Send + Sync>, )
Set memory pressure callback
Source§fn get_handle(&self, request_id: RequestId) -> Option<Arc<dyn KvCacheHandle>>
fn get_handle(&self, request_id: RequestId) -> Option<Arc<dyn KvCacheHandle>>
Get handle for existing request (if exists)
Source§fn list_handles(&self) -> Vec<(RequestId, Arc<dyn KvCacheHandle>)>
fn list_handles(&self) -> Vec<(RequestId, Arc<dyn KvCacheHandle>)>
List all active cache handles
Auto Trait Implementations§
impl !Freeze for MockKvCacheManager
impl !RefUnwindSafe for MockKvCacheManager
impl !UnwindSafe for MockKvCacheManager
impl Send for MockKvCacheManager
impl Sync for MockKvCacheManager
impl Unpin for MockKvCacheManager
impl UnsafeUnpin for MockKvCacheManager
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