buildgrid.server.cas.tree_cache.tree_cache module

class buildgrid.server.cas.tree_cache.tree_cache.TreeCache

Bases: ABC

Abstract cache mapping root digests to their full Tree messages.

A tree cache is not bound to a storage and may be shared by multiple RootStorage objects. Tree messages are stored in and read from the storage passed to each call.

abstract put(storage: RootStorage, root_digest: Digest, root: Directory, children: Iterable[Directory]) → None

Store a tree under its root digest.

abstract get(storage: RootStorage, root_digest: Digest) → Tree | None

Retrieve a cached Tree by root digest, or None on miss.