Skip to main content

RemoteCache

Trait RemoteCache 

Source
pub trait RemoteCache: Send + Sync {
    // Required methods
    fn lookup(&self, action: &RemoteAction) -> Result<Option<RemoteHit>>;
    fn download(&self, blobs: &[Blob]) -> Result<Vec<Vec<u8>>>;
    fn decode_tree(&self, bytes: &[u8]) -> Result<DecodedTree>;
    fn upload(
        &self,
        action: &RemoteAction,
        produced: &RemoteUpload,
        blobs: &dyn BlobSource,
    ) -> Result<Uploaded>;
    fn execute(&self, action: &RemoteAction) -> Result<Executed>;
}
Expand description

A cache of results shared between machines, asked and filled by the action that made them, and able to run an action itself.

Blocking, and called from several worker threads at once. Every failure is an Error::Adapter naming PortName::RemoteCache; a miss is not a failure.

Required Methods§

Source

fn lookup(&self, action: &RemoteAction) -> Result<Option<RemoteHit>>

The result the remote holds for action, as it was stored and not yet checked; None when it holds none.

§Errors

Returns an error when the remote cannot be reached or answers in a way this port cannot read.

Source

fn download(&self, blobs: &[Blob]) -> Result<Vec<Vec<u8>>>

The bytes of each of blobs, in the same order.

§Errors

Returns an error when the remote cannot be reached, or does not hold one of them.

Source

fn decode_tree(&self, bytes: &[u8]) -> Result<DecodedTree>

What a directory tree the remote stores holds: its files in path order, or the first thing in it a build cannot place, a symlink or an empty directory, named by its path below the tree’s root.

§Errors

Returns an error when the port cannot decode at all; bytes it cannot read as a tree are DecodedTree::Unreadable.

Source

fn upload( &self, action: &RemoteAction, produced: &RemoteUpload, blobs: &dyn BlobSource, ) -> Result<Uploaded>

Stores what a run produced as the result for action, with the input files and the output and log blobs it names. The output and log blobs are read from blobs.

§Errors

Returns an error when the remote cannot be reached or refuses what it is sent.

Source

fn execute(&self, action: &RemoteAction) -> Result<Executed>

Asks the remote to run action, and returns how it ended: the result, as it was answered and not yet checked, or the reason there is none.

§Errors

Returns an error when the remote cannot be reached, does not run actions, or answers in a way this port cannot read.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§