buildgrid.server.cas.storage.storage_abc module

StorageABC

The abstract base class for storage providers.

class buildgrid.server.cas.storage.storage_abc.StorageABC

Bases: abc.ABC

abstract has_blob(digest)

Return True if the blob with the given instance/digest exists.

abstract get_blob(digest)

Return a file-like object containing the blob.

If the blob isn’t present in storage, return None.

abstract delete_blob(digest)

Delete the blob from storage if it’s present.

abstract begin_write(digest)

Return a file-like object to which a blob’s contents could be written.

abstract commit_write(digest, write_session)

Commit the write operation. write_session must be an object returned by begin_write.

The storage object is not responsible for verifying that the data written to the write_session actually matches the digest. The caller must do that.

missing_blobs(digests)

Return a container containing the blobs not present in CAS.

bulk_update_blobs(blobs)

Given a container of (digest, value) tuples, add all the blobs to CAS. Return a list of Status objects corresponding to the result of uploading each of the blobs.

Unlike in commit_write, the storage object will verify that each of the digests matches the provided data.

bulk_read_blobs(digests)

Given an iterable container of digests, return a {hash: file-like object} dictionary corresponding to the blobs represented by the input digests.

put_message(message)

Store the given Protobuf message in CAS, returning its digest.

get_message(digest, message_type)

Retrieve the Protobuf message with the given digest and type from CAS. If the blob is not present, returns None.