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.

set_instance_name(instance_name: str) None

Set the instance name associated with this instance. This method may be overriden if extra referencing is required.

Parameters:

instance_name (str) – The new instance’s name.

Raises:

AssertionError – if the instance is already registered.

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_ignored_exceptions = (<class 'buildgrid._exceptions.RetriableError'>,)
find_missing_blobs(blob_digests: Sequence[Digest]) FindMissingBlobsResponse
batch_update_blobs_ignored_exceptions = (<class 'buildgrid._exceptions.RetriableError'>,)
batch_update_blobs(requests: Sequence[Request]) BatchUpdateBlobsResponse
batch_read_blobs_ignored_exceptions = (<class 'buildgrid._exceptions.RetriableError'>,)
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_ignored_exceptions = (<class 'buildgrid._exceptions.NotFoundError'>, <class 'buildgrid._exceptions.RetriableError'>)
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.

set_instance_name(instance_name: str) None

Set the instance name associated with this instance. This method may be overriden if extra referencing is required.

Parameters:

instance_name (str) – The new instance’s name.

Raises:

AssertionError – if the instance is already registered.

bytestream_read_ignored_exceptions = (<class 'buildgrid._exceptions.NotFoundError'>, <class 'buildgrid._exceptions.RetriableError'>)
read_cas_blob(digest_hash: str, digest_size: str, read_offset: int, read_limit: int) Iterator[ReadResponse]
bytestream_write_ignored_exceptions = (<class 'buildgrid._exceptions.NotFoundError'>, <class 'buildgrid._exceptions.RetriableError'>)
write_cas_blob(digest_hash: str, digest_size: str, requests: Iterator[WriteRequest]) WriteResponse