Skip to main content

WorkspaceCache

Trait WorkspaceCache 

Source
pub trait WorkspaceCache:
    Send
    + Sync
    + 'static {
    // Required methods
    fn cache_workspace<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 Uuid,
        snapshot: &'life2 WorkspaceSnapshot,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_workspace<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<WorkspaceSnapshot>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cache_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        workspace_id: &'life1 Uuid,
        path: &'life2 str,
        entry: &'life3 CachedOverlayEntry,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn get_file<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        workspace_id: &'life1 Uuid,
        path: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CachedOverlayEntry>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_files<'life0, 'life1, 'async_trait>(
        &'life0 self,
        workspace_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cache_graph<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        workspace_id: &'life1 Uuid,
        graph_data: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_graph<'life0, 'life1, 'async_trait>(
        &'life0 self,
        workspace_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn evict<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn touch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

L2 cache interface for workspace state across pods.

Implementors store and retrieve WorkspaceSnapshots, per-file CachedOverlayEntrys, and serialised session graphs keyed by workspace UUID. All methods are async and infallible in the “cache miss” sense — they return Ok(None) rather than an error when an entry is absent.

The trait is Send + Sync so it can be stored behind Arc<dyn WorkspaceCache> and shared across Tokio tasks.

Required Methods§

Source

fn cache_workspace<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 Uuid, snapshot: &'life2 WorkspaceSnapshot, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist a workspace snapshot to the cache under its session ID.

Source

fn get_workspace<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<WorkspaceSnapshot>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a previously cached workspace snapshot.

Returns Ok(None) on a cache miss.

Source

fn cache_file<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, workspace_id: &'life1 Uuid, path: &'life2 str, entry: &'life3 CachedOverlayEntry, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Cache a single overlay file entry for (workspace_id, path).

Source

fn get_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, workspace_id: &'life1 Uuid, path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<CachedOverlayEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieve a cached overlay file entry.

Returns Ok(None) on a cache miss.

Source

fn list_files<'life0, 'life1, 'async_trait>( &'life0 self, workspace_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all file paths cached in the overlay for a workspace.

Returns an empty Vec when no files are cached.

Source

fn cache_graph<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, workspace_id: &'life1 Uuid, graph_data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist a serialised session graph blob for a workspace.

Source

fn get_graph<'life0, 'life1, 'async_trait>( &'life0 self, workspace_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a serialised session graph blob.

Returns Ok(None) on a cache miss.

Source

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

Remove all cache entries for a workspace (snapshot, files, graph).

Source

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

Update the cache TTL / last-access timestamp for a workspace.

Implementations that support TTL-based expiry should reset the clock on this call. No-op implementations accept silently.

Implementors§