pub struct RemoteCacheClient { /* private fields */ }Expand description
HTTP client for the mbx remote cache protocol.
The client validates digests, response sizes, media types, and redirects at the protocol boundary. It is safe to share between asynchronous tasks.
Implementations§
Source§impl RemoteCacheClient
impl RemoteCacheClient
Sourcepub fn new(config: RemoteCacheConfig) -> Result<Self>
pub fn new(config: RemoteCacheConfig) -> Result<Self>
Construct a client and validate its URL and authentication settings.
Sourcepub async fn check_connection(&self) -> Result<()>
pub async fn check_connection(&self) -> Result<()>
Connect to the server, authenticate, and negotiate protocol capabilities.
This performs no cache reads or writes. It is intended for diagnostics that need to distinguish a valid client configuration from a reachable, compatible remote cache.
Sourcepub async fn get_blob_pack(
&self,
digests: &[CacheDigest],
staging_dir: &Path,
) -> Result<Option<RemoteBlobPack>>
pub async fn get_blob_pack( &self, digests: &[CacheDigest], staging_dir: &Path, ) -> Result<Option<RemoteBlobPack>>
Download verified CAS objects using the server’s negotiated blob-pack extension.
None means the server does not support blob packs. Objects omitted by a
supported server are absent from blobs, so callers can retry them through
the ordinary single-blob endpoint.
Sourcepub async fn get_action_result(
&self,
action: &CacheDigest,
) -> Result<Option<RemoteActionResult>>
pub async fn get_action_result( &self, action: &CacheDigest, ) -> Result<Option<RemoteActionResult>>
Fetch and validate an action-result record, returning None on a miss.
Sourcepub async fn put_action_result(&self, result: &RemoteActionResult) -> Result<()>
pub async fn put_action_result(&self, result: &RemoteActionResult) -> Result<()>
Canonically serialize and store an action-result record.
Sourcepub async fn get_action_manifest(
&self,
key: &CacheDigest,
) -> Result<Option<RemoteActionManifest>>
pub async fn get_action_manifest( &self, key: &CacheDigest, ) -> Result<Option<RemoteActionManifest>>
Fetch a task action manifest and the entity tag needed to update it.
Sourcepub async fn put_action_manifest(
&self,
key: &CacheDigest,
bytes: &[u8],
expected_etag: Option<&str>,
) -> Result<ManifestPutOutcome>
pub async fn put_action_manifest( &self, key: &CacheDigest, bytes: &[u8], expected_etag: Option<&str>, ) -> Result<ManifestPutOutcome>
Store a task action manifest, optionally requiring an entity-tag match.
Sourcepub async fn get_blob(
&self,
digest: &CacheDigest,
media_type: &'static str,
) -> Result<Vec<u8>>
pub async fn get_blob( &self, digest: &CacheDigest, media_type: &'static str, ) -> Result<Vec<u8>>
Download a small blob into memory and verify its digest.
Sourcepub async fn get_blob_file(
&self,
digest: &CacheDigest,
staging_dir: &Path,
) -> Result<NamedTempFile>
pub async fn get_blob_file( &self, digest: &CacheDigest, staging_dir: &Path, ) -> Result<NamedTempFile>
Download a blob to a temporary file and verify its digest.
Sourcepub async fn put_blob(&self, upload: &BlobUpload) -> Result<()>
pub async fn put_blob(&self, upload: &BlobUpload) -> Result<()>
Verify and upload a content-addressed blob.