class BlobCache
Defined at line 37 of file ../../src/storage/blobfs/blob_cache.h
BlobCache contains a collection of weak pointers to vnodes.
This cache also helps manage the lifecycle of these vnodes, controlling what is cached when there
are no more external references.
Internally, the BlobCache contains a "live set" and "closed set" of vnodes. The "live set"
contains all Vnodes with a strong reference. The "closed set" contains references to Vnodes which
are not used, but which exist on-disk.
This class is thread-safe.
Public Methods
void BlobCache ()
Defined at line 23 of file ../../src/storage/blobfs/blob_cache.cc
void ~BlobCache ()
Defined at line 25 of file ../../src/storage/blobfs/blob_cache.cc
void Reset ()
Empties the cache, evicting all open nodes and deleting all closed nodes.
Defined at line 36 of file ../../src/storage/blobfs/blob_cache.cc
void BlobCache (const BlobCache & )
Defined at line 39 of file ../../src/storage/blobfs/blob_cache.h
void BlobCache (BlobCache && )
Defined at line 39 of file ../../src/storage/blobfs/blob_cache.h
BlobCache & operator= (const BlobCache & )
Defined at line 39 of file ../../src/storage/blobfs/blob_cache.h
BlobCache & operator= (BlobCache && )
Defined at line 39 of file ../../src/storage/blobfs/blob_cache.h
zx_status_t ForAllOpenNodes (NextNodeCallback callback)
Defined at line 57 of file ../../src/storage/blobfs/blob_cache.cc
zx_status_t Lookup (const Digest & digest, fbl::RefPtr<CacheNode> * out)
Searches for a blob by |digest|.
If a readable blob with the same name exists, it is (optionally) placed in |out|. If no such
blob is found, ZX_ERR_NOT_FOUND is returned.
|out| may be null. The same error code will be returned as if it was a valid pointer. If |out|
is not null, then the returned-by-strong-reference Vnode will exist in the "live set".
Defined at line 108 of file ../../src/storage/blobfs/blob_cache.cc
zx_status_t Add (const fbl::RefPtr<CacheNode> & vnode)
Adds a blob to the "live set" of the cache. If |vnode->ShouldCache()| is true, then this node
will remain discoverable using |Lookup()|, even if no strong references remain.
Returns ZX_ERR_ALREADY_EXISTS if this blob could not be added because a node with the same
key already exists in the cache.
Defined at line 166 of file ../../src/storage/blobfs/blob_cache.cc
zx_status_t Evict (const fbl::RefPtr<CacheNode> & vnode)
Deletes a blob from the cache. When the last strong reference is removed, it is not placed into
the "closed set" of the cache. Future calls to "Lookup" will not be able to observe this node.
Returns ZX_OK if the node was evicted from the cache. Returns ZX_ERR_NOT_FOUND if the node was
not in the cache.
Defined at line 181 of file ../../src/storage/blobfs/blob_cache.cc
Friends
class CacheNode