buildgrid.server.cas.instance module

Storage Instances

Instances of CAS and ByteStream

class buildgrid.server.cas.instance.ContentAddressableStorageInstance(storage: StorageABC, read_only: bool = False, tree_cache_size: int | None = None, tree_cache_ttl_minutes: float = 60, tree_cache_redis: RedisProvider | None = None, enable_chunking: bool = False, chunked_by_buildbox_allowed_subjects: list[str] | None = None)

Bases: Instance

SERVICE_NAME: ClassVar[str] = 'build.bazel.remote.execution.v2.ContentAddressableStorage'

The expected FULL_NAME of the Service which will wrap this instance. This value should be declared on the class of any Instance implementations.

start() None

A method called when the grpc service is starting.

This method may be overriden if startup logic is required.

stop() None

A method called when the grpc service is shutting down.

This method may be overriden if shutdown logic is required.

find_missing_blobs(blob_digests: Sequence[Digest]) FindMissingBlobsResponse
batch_update_blobs(requests: Sequence[Request]) BatchUpdateBlobsResponse
batch_read_blobs(digests: Sequence[Digest]) BatchReadBlobsResponse
get_tree(request: GetTreeRequest) Iterator[GetTreeResponse]
property chunking_enabled: bool
property splice_enabled: bool
splice_blob(request: SpliceBlobRequest, *, client_chunked: bool = False) SpliceBlobResponse

Record the chunk mapping for a blob assembled from already-uploaded chunks.

Parameters:
  • request – the SpliceBlob request.

  • client_chunked – whether the request carried the chunked-by-buildbox header. Only honoured for an authenticated, allowlisted subject; the structural validation below always runs regardless.

split_blob(request: SplitBlobRequest) SplitBlobResponse
class buildgrid.server.cas.instance.WriteBlobState(hash: '_Hash', bytes_count: int)

Bases: object

hash: _Hash
bytes_count: int
update(data: bytes) None
validate(digest: Digest) None
class buildgrid.server.cas.instance.ByteStreamInstance(storage: StorageABC, read_only: bool = False, disable_overwrite_early_return: bool = False, stream_blob: bool = True)

Bases: Instance

SERVICE_NAME: ClassVar[str] = 'google.bytestream.ByteStream'

The expected FULL_NAME of the Service which will wrap this instance. This value should be declared on the class of any Instance implementations.

BLOCK_SIZE = 1048576
start() None

A method called when the grpc service is starting.

This method may be overriden if startup logic is required.

stop() None

A method called when the grpc service is shutting down.

This method may be overriden if shutdown logic is required.

read_cas_blob(digest: Digest, read_offset: int, read_limit: int) Iterator[ReadResponse]
write_cas_blob(digest_hash: str, digest_size: str, requests: Iterator[WriteRequest]) WriteResponse