buildgrid.server.cas.storage.index.index_abc module

IndexABC

The abstract base class for storage indices. An index is a special type of Storage that facilitates storing blob metadata. It must wrap another Storage.

Derived classes must implement all methods of both this interface and the StorageABC interface.

class buildgrid.server.cas.storage.index.index_abc.IndexABC(*, fallback_on_get=False)

Bases: buildgrid.server.cas.storage.storage_abc.StorageABC

abstract delete_blob(digest)

Delete a blob from the index. Return True if the blob was deleted, or False otherwise.

TODO: This method will be promoted to StorageABC in a future commit.

abstract least_recent_digests()

Generator to iterate through the digests in LRU order

abstract get_total_size()

Return the sum of the size of all blobs within the index

abstract mark_n_bytes_as_deleted(n_bytes)

Mark a given number of bytes’ worth of index entries as deleted.

The entries are marked as deleted in LRU order until the total size marked as deleted is at least the requested number of bytes. If any entries are already marked as deleted, they are used first when attempting to reach the required number of bytes.

Parameters

n_bytes (int) – The number of bytes of index entries to mark as deleted. When the sum of the size_bytes of index entries meets or exceeds this value, the affected digests will be returned.

Returns

The list of digests that were marked as deleted.

Return type

list