LLVM 22.0.0git
|
An on-disk key-value data store with the following properties: More...
#include "llvm/CAS/OnDiskKeyValueDB.h"
Public Types | |
using | CheckValueT |
Public Member Functions | |
Expected< ArrayRef< char > > | put (ArrayRef< uint8_t > Key, ArrayRef< char > Value) |
Associate a value with a key. | |
Expected< std::optional< ArrayRef< char > > > | get (ArrayRef< uint8_t > Key) |
size_t | getStorageSize () const |
unsigned | getHardStorageLimitUtilization () const |
Error | validate (CheckValueT CheckValue) const |
Validate the storage with a callback CheckValue to check the stored value. |
Static Public Member Functions | |
static Expected< std::unique_ptr< OnDiskKeyValueDB > > | open (StringRef Path, StringRef HashName, unsigned KeySize, StringRef ValueName, size_t ValueSize) |
Open the on-disk store from a directory. |
An on-disk key-value data store with the following properties:
Definition at line 27 of file OnDiskKeyValueDB.h.
Definition at line 66 of file OnDiskKeyValueDB.h.
Key
, or std::nullopt
if the key does not exist. Definition at line 53 of file OnDiskKeyValueDB.cpp.
References assert(), llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key, and llvm::isAddrAligned().
|
inline |
Return value is an integer between 0 and 100 for percentage.
Definition at line 49 of file OnDiskKeyValueDB.h.
|
inline |
Definition at line 44 of file OnDiskKeyValueDB.h.
|
static |
Open the on-disk store from a directory.
Path | directory for the on-disk store. The directory will be created if it doesn't exist. |
HashName | Identifier name for the hashing algorithm that is going to be used. |
KeySize | Size for the key hash bytes. |
ValueName | Identifier name for the values. |
ValueSize | Size for the value bytes. |
Definition at line 63 of file OnDiskKeyValueDB.cpp.
References ActionCacheFile, llvm::sys::path::append(), llvm::cas::ondisk::CASFormatVersion, llvm::cas::OnDiskTrieRawHashMap::create(), llvm::sys::fs::create_directories(), llvm::createFileError(), and llvm::cas::ondisk::getOverriddenMaxMappingSize().
Expected< ArrayRef< char > > OnDiskKeyValueDB::put | ( | ArrayRef< uint8_t > | Key, |
ArrayRef< char > | Value ) |
Associate a value with a key.
Key | the hash bytes for the key |
Value | the value bytes, same size as ValueSize parameter of open call. |
Key
. It may be different than Value
if another value is already associated with this key. Definition at line 34 of file OnDiskKeyValueDB.cpp.
References assert(), llvm::copy(), llvm::createStringError(), llvm::cas::OnDiskTrieRawHashMap::ValueProxy::Data, llvm::MutableArrayRef< T >::data(), llvm::InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key, llvm::invalid_argument, llvm::itostr(), LLVM_UNLIKELY, and llvm::ArrayRef< T >::size().
Error OnDiskKeyValueDB::validate | ( | CheckValueT | CheckValue | ) | const |
Validate the storage with a callback CheckValue
to check the stored value.
Definition at line 93 of file OnDiskKeyValueDB.cpp.
References llvm::createStringError(), llvm::illegal_byte_sequence, llvm::isAddrAligned(), llvm::Offset, llvm::Error::success(), and llvm::utohexstr().