9#ifndef LLVM_CAS_UNIFIEDONDISKCACHE_H
10#define LLVM_CAS_UNIFIEDONDISKCACHE_H
41class UnifiedOnDiskCache {
63 unsigned HashByteSize,
92 bool CheckHash,
bool AllowRecovery,
bool ForceValidation,
93 std::optional<StringRef> LLVMCasBinary);
147 UnifiedOnDiskCache();
153 uint64_t getPrimaryStorageSize()
const;
155 std::string RootPath;
156 std::atomic<uint64_t> SizeLimit;
160 std::atomic<bool> NeedsGarbageCollection;
161 std::string PrimaryDBDir;
163 std::unique_ptr<OnDiskGraphDB> UpstreamGraphDB;
164 std::unique_ptr<OnDiskGraphDB> PrimaryGraphDB;
166 std::unique_ptr<OnDiskKeyValueDB> UpstreamKVDB;
167 std::unique_ptr<OnDiskKeyValueDB> PrimaryKVDB;
static cl::opt< unsigned > SizeLimit("eif-limit", cl::init(6), cl::Hidden, cl::desc("Size limit in Hexagon early if-conversion"))
This declares OnDiskGraphDB, an ondisk CAS database with a fixed length hash.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
FaultInPolicy
How to fault-in nodes if an upstream database is used.
@ FullTree
Copy the the entire graph of a node.
An on-disk key-value data store with the following properties:
OnDiskGraphDB & getGraphDB()
The OnDiskGraphDB instance for the open directory.
uint64_t getStorageSize() const
friend class OnDiskGraphDB
static ValueBytes getValueFromObjectID(ObjectID ID)
static Expected< std::unique_ptr< UnifiedOnDiskCache > > open(StringRef Path, std::optional< uint64_t > SizeLimit, StringRef HashName, unsigned HashByteSize, OnDiskGraphDB::FaultInPolicy FaultInPolicy=OnDiskGraphDB::FaultInPolicy::FullTree)
Open a UnifiedOnDiskCache instance for a directory.
Error close(bool CheckSizeLimit=true)
This is called implicitly at destruction time, so it is not required for a client to call this.
static ObjectID getObjectIDFromValue(ArrayRef< char > Value)
Helper function to convert the value stored in KeyValueDB and ObjectID.
friend class OnDiskKeyValueDB
bool needsGarbageCollection() const
static Expected< ValidationResult > validateIfNeeded(StringRef Path, StringRef HashName, unsigned HashByteSize, bool CheckHash, bool AllowRecovery, bool ForceValidation, std::optional< StringRef > LLVMCasBinary)
Validate the data in Path, if needed to ensure correctness.
bool hasExceededSizeLimit() const
OnDiskKeyValueDB & getKeyValueDB()
The OnDiskGraphDB instance for the open directory.
std::array< char, sizeof(uint64_t)> ValueBytes
Error collectGarbage()
Remove unused data from the current UnifiedOnDiskCache.
void setSizeLimit(std::optional< uint64_t > SizeLimit)
Set the size for limiting growth.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key