1#ifndef AR_AYONUSDRESOLVER_RESOLVER_CONTEXT_CACHE_H
2#define AR_AYONUSDRESOLVER_RESOLVER_CONTEXT_CACHE_H
4#include "../cache/assetIdentifierDef.h"
7#include <nlohmann/json.hpp>
12#include <shared_mutex>
14#include <unordered_map>
16PXR_NAMESPACE_USING_DIRECTIVE
23 const std::unordered_map<std::string, std::string> &rootReplaceData);
102 std::unordered_set<AssetIdentifier, AssetIdentifierHash>
m_PreCache;
103 std::unordered_set<AssetIdentifier, AssetIdentifierHash>
m_AyonCache;
110 std::optional<std::unique_ptr<AyonApi>>
m_ayon;
cache element class used to represent an Usd asset in cache for the resolver
Definition: assetIdentifierDef.h:17
Definition: resolverContextCache.h:20
nlohmann::json m_pinningFileData
Definition: resolverContextCache.h:30
std::unordered_map< std::string, std::string > m_rootReplaceData
Definition: resolverContextCache.h:32
AssetIdentifier getAssetData(const std::string &resolveKey)
return AssetIdentifier populated with root rootReplaceData from the pinning file using the pinning fi...
Definition: resolverContextCache.cpp:68
~PinningFileHandler()=default
std::filesystem::path m_pinningFilePath
Definition: resolverContextCache.h:29
Handles everything related to asset caching.
Definition: resolverContextCache.h:40
void insert(AssetIdentifier &sourceAssetIdent)
Move the asset into the preCache.
Definition: resolverContextCache.cpp:142
void removeCachedObject(const std::string &key)
Delete an entry from the cache.
Definition: resolverContextCache.cpp:263
bool isCacheStatic() const
Check if cache is static (no dynamic resolution)
Definition: resolverContextCache.cpp:369
std::unordered_set< AssetIdentifier, AssetIdentifierHash > m_AyonCache
Definition: resolverContextCache.h:103
void printCache() const
Print every object in the cache for debugging.
Definition: resolverContextCache.cpp:113
bool m_staticCache
Definition: resolverContextCache.h:111
void migratePreCacheIntoAyonCache()
Move the precache into the AyonCache to free the precache.
Definition: resolverContextCache.cpp:156
std::shared_mutex m_AyonCacheSharedMutex
Definition: resolverContextCache.h:107
std::shared_mutex m_CommonCacheSharedMutex
Definition: resolverContextCache.h:108
ResolverContextCache()
Definition: resolverContextCache.cpp:87
std::unordered_set< AssetIdentifier, AssetIdentifierHash > m_CommonCache
Definition: resolverContextCache.h:104
~ResolverContextCache()
Definition: resolverContextCache.cpp:107
std::optional< PinningFileHandler > m_pinningFileHandler
Definition: resolverContextCache.h:113
std::optional< std::unique_ptr< AyonApi > > m_ayon
Definition: resolverContextCache.h:110
std::unordered_set< AssetIdentifier, AssetIdentifierHash > m_PreCache
Definition: resolverContextCache.h:102
std::shared_mutex m_PreCacheSharedMutex
Definition: resolverContextCache.h:106
void ClearCache()
Clear the complete cache.
Definition: resolverContextCache.cpp:357
void setCacheFromPinningFile(const std::string &pinningFilePath)
Set up the cache from a pinning file.
AssetIdentifier getAsset(const std::string &assetIdentifier, const CacheName selectedCache, const bool isAyonPath)
Return an asset by searching the selected cache.
Definition: resolverContextCache.cpp:167
CacheName
Definition: resolverContextCache.h:18