Skip to main content
The Content Addressable Storage (CAS) service implements the Remote Execution API v2 CAS interface for storing and retrieving blobs based on their content digest.

Overview

The CAS service provides content-addressable blob storage where each blob is identified by its digest (hash). This enables efficient deduplication and content verification. Key features:
  • Content-addressed blob storage
  • Batch read and write operations
  • Missing blob detection
  • Directory tree traversal

Configuration

instance_name
string
required
The instance name identifying this CAS endpoint. Must match client configuration.
cas_store
string
required
Reference to the store configured in the stores section.
{
  services: {
    cas: [
      {
        instance_name: "main",
        cas_store: "MAIN_CAS_STORE"
      }
    ]
  }
}

gRPC Methods

FindMissingBlobs

Determines which blobs are missing from the CAS. Request:
instance_name
string
required
The instance name
blob_digests
Digest[]
required
List of digests to check
Response:
missing_blob_digests
Digest[]
List of digests that are not present in the CAS
Example with grpcurl:
grpcurl -plaintext \
  -d '{
    "instance_name": "main",
    "blob_digests": [
      {"hash": "abc123...", "size_bytes": 1024}
    ]
  }' \
  localhost:50051 build.bazel.remote.execution.v2.ContentAddressableStorage/FindMissingBlobs

BatchUpdateBlobs

Upload multiple blobs in a single request. Request:
instance_name
string
required
The instance name
requests
Request[]
required
Array of upload requests, each containing:
  • digest: Content digest
  • data: Blob data (bytes)
  • compressor: Optional compression (identity, zstd, deflate)
Response:
responses
Response[]
Array of responses for each blob:
  • digest: The blob digest
  • status: gRPC status (OK on success)
Batch operations are limited by max_decoding_message_size (default 4MB)

BatchReadBlobs

Download multiple blobs in a single request. Request:
instance_name
string
required
The instance name
digests
Digest[]
required
List of blob digests to read
acceptable_compressors
Compressor[]
List of acceptable compression algorithms (identity, zstd, deflate)
Response:
responses
Response[]
Array of responses for each blob:
  • digest: The blob digest
  • data: Blob data (bytes)
  • compressor: Compression used
  • status: gRPC status

GetTree

Recursively fetch a directory tree. Request:
instance_name
string
required
The instance name
root_digest
Digest
required
Digest of the root Directory message
page_size
int32
Maximum number of directories per response (default: all)
page_token
string
Token for pagination
Response (stream):
directories
Directory[]
List of Directory messages
next_page_token
string
Token for fetching next page

Error Codes

CodeDescription
NOT_FOUNDBlob or instance not found
INVALID_ARGUMENTInvalid digest format or instance name
RESOURCE_EXHAUSTEDRequest too large
INTERNALStorage backend error

Implementation Details

From nativelink-service/src/cas_server.rs:
pub struct CasServer {
    stores: HashMap<String, Store>,
}
The CAS server maintains a map of instance names to store implementations, allowing multiple isolated CAS namespaces in a single deployment.
The CAS service follows the Remote Execution API v2 specification

Build docs developers (and LLMs) love