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)

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.

hash_type() int
max_batch_total_size_bytes() int
find_missing_blobs(blob_digests: Sequence[Digest]) FindMissingBlobsResponse
batch_update_blobs(requests: Sequence[Request]) BatchUpdateBlobsResponse
batch_read_blobs(digests: Sequence[Digest]) BatchReadBlobsResponse
lookup_tree_cache(root_digest: Digest) Tree | None

Find full Tree from cache

put_tree_cache(root_digest: Digest, root: Directory, children: Iterable[Directory]) None

Put Tree with a full list of directories into CAS

get_tree(request: GetTreeRequest) Iterator[GetTreeResponse]
class buildgrid.server.cas.instance.ByteStreamInstance(storage: StorageABC, read_only: bool = False, disable_overwrite_early_return: bool = False)

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