wasm_pkg_client::caching

Trait Cache

source
pub trait Cache {
    // Required methods
    fn put_data(
        &self,
        digest: ContentDigest,
        data: ContentStream,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn get_data(
        &self,
        digest: &ContentDigest,
    ) -> impl Future<Output = Result<Option<ContentStream>, Error>> + Send;
    fn put_release(
        &self,
        package: &PackageRef,
        release: &Release,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn get_release(
        &self,
        package: &PackageRef,
        version: &Version,
    ) -> impl Future<Output = Result<Option<Release>, Error>> + Send;
}
Expand description

A trait for a cache of data.

Required Methods§

source

fn put_data( &self, digest: ContentDigest, data: ContentStream, ) -> impl Future<Output = Result<(), Error>> + Send

Puts the data with the given hash into the cache

source

fn get_data( &self, digest: &ContentDigest, ) -> impl Future<Output = Result<Option<ContentStream>, Error>> + Send

Gets the data with the given hash from the cache. Returns None if the data is not in the cache.

source

fn put_release( &self, package: &PackageRef, release: &Release, ) -> impl Future<Output = Result<(), Error>> + Send

Puts the release data into the cache.

source

fn get_release( &self, package: &PackageRef, version: &Version, ) -> impl Future<Output = Result<Option<Release>, Error>> + Send

Gets the release data from the cache. Returns None if the data is not in the cache.

Object Safety§

This trait is not object safe.

Implementors§