HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pageCacheCommitRequest.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_EXEC_EF_PAGE_CACHE_COMMIT_REQUEST_H
8 #define PXR_EXEC_EF_PAGE_CACHE_COMMIT_REQUEST_H
9 
10 ///\file
11 
12 #include "pxr/pxr.h"
13 
14 #include "pxr/exec/ef/api.h"
16 
17 #include <vector>
18 
20 
22 class EfPageCacheStorage;
24 class VdfRequest;
25 
26 ///////////////////////////////////////////////////////////////////////////////
27 ///
28 /// \class EfPageCacheCommitRequest
29 ///
30 /// \brief This object signifies an intent to commit data to a page cache. It
31 /// ensures that the page exists and that it is ready to accept the
32 /// data. The object also stores an input value block, which denotes
33 /// the cache page to be used for the commit operation.
34 ///
36 {
37 public:
38  /// Constructor.
39  ///
40  /// Creates a new commit request with the specified input values, denoting
41  /// the cache page (key), as well as the page cache storage to which the
42  /// data will be committed.
43  ///
44  EF_API
46  const EfInputValueBlock &inputs,
48 
49  /// Destructor.
50  ///
51  EF_API
53 
54  /// Returns the input value block containing the key output value.
55  ///
56  const EfInputValueBlock &GetInputs() const {
57  return _inputs;
58  }
59 
60  /// Returns the output value cache where values will be committed to.
61  ///
63  return _cache;
64  }
65 
66  /// Returns \c true if any output in the specified \c request is
67  /// still not cached.
68  ///
69  EF_API
70  bool IsUncached(const VdfRequest &request) const;
71 
72  /// Returns the subset of \p request, which is still not cached.
73  ///
74  EF_API
75  VdfRequest GetUncached(const VdfRequest &request) const;
76 
77  /// Commits data for the outputs denoted by the \p request to the
78  /// cache, reading their values from the specified \p executor.
79  ///
80  /// Returns \c true if all the data has been cached.
81  ///
82  /// Sets \p bytesCommitted (which must be non-null) to the size of the
83  /// stored data, in bytes.
84  ///
85  EF_API
86  bool Commit(
87  const VdfExecutorInterface &executor,
88  const VdfRequest &request,
89  size_t *bytesCommitted);
90 
91 private:
92  // The input value block containing the key output value.
93  EfInputValueBlock _inputs;
94 
95  // The output-to-value cache on the page indexed by the key value.
96  Ef_OutputValueCache *_cache;
97 
98  // A pointer to the page cache storage class.
99  EfPageCacheStorage *_storage;
100 
101 };
102 
103 /// A vector of page cache commit requests.
104 ///
105 typedef std::vector<EfPageCacheCommitRequest> EfPageCacheCommitRequestVector;
106 
108 
109 #endif
Manages a page cache and provides methods for invalidation of cached values.
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
EF_API bool IsUncached(const VdfRequest &request) const
An output-to-value storage for caching. The class provides accessor types for thread-safe, as well as unprotected access.
EF_API VdfRequest GetUncached(const VdfRequest &request) const
This object signifies an intent to commit data to a page cache. It ensures that the page exists and t...
std::vector< EfPageCacheCommitRequest > EfPageCacheCommitRequestVector
EF_API ~EfPageCacheCommitRequest()
An input value block is a vector of (output, value) pairs, each of which will be used to initialize a...
const EfInputValueBlock & GetInputs() const
Ef_OutputValueCache * GetCache() const
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
EF_API EfPageCacheCommitRequest(const EfInputValueBlock &inputs, EfPageCacheStorage *storage)
EF_API bool Commit(const VdfExecutorInterface &executor, const VdfRequest &request, size_t *bytesCommitted)
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values...
#define EF_API
Definition: api.h:25