7 #ifndef PXR_EXEC_EF_PAGE_CACHE_STORAGE_H 8 #define PXR_EXEC_EF_PAGE_CACHE_STORAGE_H 14 #include "pxr/exec/ef/api.h" 22 #include <tbb/concurrent_vector.h> 29 PXR_NAMESPACE_OPEN_SCOPE
46 template <
template <
typename>
class E,
typename D>
55 using _CacheIteratorPredicateFunction =
69 template <
typename T >
123 const _CacheIteratorPredicateFunction &predicate,
124 const VdfRequest &request,
125 std::vector<const VdfVector *> *cachedKeys)
const;
132 const _CacheIteratorPredicateFunction &predicate);
140 const _CacheIteratorPredicateFunction &predicate,
141 const VdfMaskedOutputVector &invalidationRequest);
154 const tbb::concurrent_vector<VdfIndex> &nodes);
194 const VdfMaskedOutputVector &request)
const;
201 const VdfRequest &request,
220 std::unique_ptr<Ef_PageCache> _pageCache;
225 struct _CacheableRequestEntry {
226 _CacheableRequestEntry() : version(0) {}
241 std::unique_ptr<std::atomic<bool>[]> _nodeRefs;
245 static std::atomic<size_t> _numBytesUsed;
248 static std::atomic<size_t> _numBytesLimit;
255 template <
typename T >
262 keyMaskedOutput, leafNodeCache, Ef_PageCache::New<T>());
265 PXR_NAMESPACE_CLOSE_SCOPE
A VdfNetwork is a collection of VdfNodes and their connections.
EF_API void Clear()
Clear the entire cache on all pages.
EF_API void SetEnabled(bool enable)
Enables / disables the storage.
Manages a page cache and provides methods for invalidation of cached values.
EF_API bool IsEnabled() const
Returns true if the storage is enabled, i.e.
static EF_API size_t GetNumBytesLimit()
Returns the upper cache storage memory limit, in bytes.
EF_API const VdfRequest & GetCacheableRequest(const VdfRequest &request) const
Given any request, returns another request containing the outputs, which are dependent on the key out...
This is the base class for all nodes in a VdfNetwork.
This cache is a thin wrapper around the EfDependencyCache.
A VdfMask is placed on connections to specify the data flowing through them.
An output-to-value storage for caching.
static EF_API size_t GetNumBytesUsed()
Returns the amount of memory currently used for cache storage, in bytes.
EF_API void ClearNodes(const VdfNetwork &network, const tbb::concurrent_vector< VdfIndex > &nodes)
Clears the output values associated with all the given nodes in the provided network.
This class is used to abstract away knowledge of the cache data used for each node.
Executes a VdfNetwork to compute a requested set of values.
static EF_API bool HasReachedMemoryLimit()
Returns true, if the upper memory limit has been reached, and the object is no longer allowed to allo...
This object signifies an intent to commit data to a page cache.
Organizes output-to-value caches into logical groups, called pages.
static EfPageCacheStorage * New(const VdfMaskedOutput &keyMaskedOutput, EfLeafNodeCache *leafNodeCache)
Constructor helper.
EF_API bool GetCachedKeys(const _CacheIteratorPredicateFunction &predicate, const VdfRequest &request, std::vector< const VdfVector * > *cachedKeys) const
Returns the set of keys that have been cached in the pages selected by the predicate,...
EF_API void Invalidate(const _CacheIteratorPredicateFunction &predicate)
Invalidate the page cache by clearing the entire cache on the pages determined by the invalidation pr...
An accessor that provides exclusive read/write access to the cache.
std::unordered_map< const VdfOutput *, VdfMask, TfHash > VdfOutputToMaskMap
A map from output pointer to mask.
EF_API void Resize(const VdfNetwork &network)
Resizes the internal structures of the page cache to be able to accommodate output values for the pro...
Class to hold on to an externally owned output and a mask.
EF_API ~EfPageCacheStorage()
Destructor.
A VdfOutput represents an output on a node.
static EF_API void SetMemoryUsageLimit(size_t bytes)
Sets the upper memory limit, denoting how much memory this object is allowed to allocate.
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
EF_API void WillDeleteNode(const VdfNode &node)
Call this to notify the page cache storage of nodes that have been deleted from the network.