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: bool = False)
Bases:
StorageABC
- abstract delete_blob(digest: Digest) None
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() Iterator[Digest]
Generator to iterate through the digests in LRU order
- abstract get_total_size(include_marked: bool = True) int
Return the sum of the size of all blobs within the index.
If include_marked is True, it will also include the size of blobs that have been marked deleted.
- abstract mark_n_bytes_as_deleted(n_bytes: int, dry_run: bool = False, include_marked: bool = True, protect_blobs_after: datetime | None = None, renew_windows: bool = True) Tuple[List[Digest], List[Digest]]
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.include_marked (bool) – Consider items already marked for deletion.
- Returns:
- Two lists of digests that were marked as deleted. The first list
contains items that are inlined, the other list contains larger blobs contained in a separate storage.
- Return type:
list