RemoteCacheBackend

Trait RemoteCacheBackend 

Source
pub trait RemoteCacheBackend: Send + Sync {
    // Required methods
    fn upload_artifact<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 CacheKey,
        artifact: &'life2 Artifact,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn fetch_artifact<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 CacheKey,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Artifact>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn has_artifact<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 CacheKey,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for remote cache backends.

Backends are responsible for storing and retrieving artifacts. All operations are async and should support streaming for large artifacts.

Required Methods§

Source

fn upload_artifact<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 CacheKey, artifact: &'life2 Artifact, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Uploads an artifact to the remote cache.

§Arguments
  • key - The cache key for this artifact
  • artifact - The artifact to upload
§Errors

Returns an error if upload fails. Errors should be non-fatal and allow fallback to local execution.

Source

fn fetch_artifact<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 CacheKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Artifact>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches an artifact from the remote cache.

§Arguments
  • key - The cache key to fetch
§Returns

Returns Some(artifact) if found, None if not found.

§Errors

Returns an error only for unexpected failures (network errors, etc.). Cache misses should return Ok(None).

Source

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

Checks if an artifact exists in the remote cache.

§Arguments
  • key - The cache key to check
§Returns

Returns true if the artifact exists, false otherwise.

§Errors

Returns an error only for unexpected failures. Cache misses should return Ok(false).

Implementors§