Skip to main content

ContentStore

Trait ContentStore 

Source
pub trait ContentStore {
    // Required methods
    fn put(&self, key: &InputHash, bytes: &[u8]) -> Result<(), Error>;
    fn get(&self, key: &InputHash) -> Result<Option<Vec<u8>>, Error>;

    // Provided method
    fn contains(&self, key: &InputHash) -> Result<bool, Error> { ... }
}
Expand description

A store that maps an InputHash to opaque artifact bytes.

Required Methods§

Source

fn put(&self, key: &InputHash, bytes: &[u8]) -> Result<(), Error>

Store bytes under key. Idempotent: storing the same key twice is a no-op (this is what makes AC#5 cache-dedupe possible).

Source

fn get(&self, key: &InputHash) -> Result<Option<Vec<u8>>, Error>

Fetch the bytes for key, or None if absent.

Provided Methods§

Source

fn contains(&self, key: &InputHash) -> Result<bool, Error>

Whether key is already present — the build pipeline checks this to skip a build entirely on a cache hit.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§