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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§