LLVM 22.0.0git
llvm::cas Namespace Reference

Namespaces

namespace  builtin
namespace  ondisk

Classes

class  ActionCache
 A cache from a key (that describes an action) to the result of performing that action. More...
class  BuiltinObjectHasher
 Hasher for stored objects in builtin CAS. More...
class  CacheKey
 A key for caching an operation. More...
class  CASContext
 Context for CAS identifiers. More...
class  CASID
 Unique identifier for a CAS object. More...
class  FileOffset
 FileOffset is a wrapper around uint64_t to represent the offset of data from the beginning of the file. More...
class  MappedFileRegionArena
 Allocator for an owned mapped file region that supports thread-safe and process-safe bump pointer allocation. More...
class  ObjectHandle
 Handle to a loaded object in a ObjectStore instance. More...
class  ObjectProxy
 Reference to an abstract hierarchical node, with data and references. More...
class  ObjectRef
 Reference to an object in an ObjectStore instance. More...
class  ObjectStore
 Content-addressable storage for objects. More...
class  OnDiskDataAllocator
 Sink for data. More...
class  OnDiskTrieRawHashMap
 OnDiskTrieRawHashMap is a persistent trie data structure used as hash maps. More...
class  ReferenceBase
 Base class for references to things in ObjectStore. More...

Enumerations

enum class  ValidationResult { Valid , Recovered , Skipped }
 Represents the result of validating the contents using validateOnDiskUnifiedCASDatabasesIfNeeded. More...

Functions

std::unique_ptr< ActionCachecreateInMemoryActionCache ()
 Create an action cache in memory.
Expected< std::unique_ptr< ActionCache > > createOnDiskActionCache (StringRef Path)
 Create an action cache on disk.
Expected< std::pair< std::unique_ptr< ObjectStore >, std::unique_ptr< ActionCache > > > createOnDiskUnifiedCASDatabases (StringRef Path)
 Create on-disk ObjectStore and ActionCache instances based on ondisk::UnifiedOnDiskCache, with built-in hashing.
Expected< ValidationResultvalidateOnDiskUnifiedCASDatabasesIfNeeded (StringRef Path, bool CheckHash, bool AllowRecovery, bool ForceValidation, std::optional< StringRef > LLVMCasBinaryPath)
 Validate the data in Path, if needed to ensure correctness.
std::unique_ptr< ObjectStorecreateInMemoryCAS ()
 Create an in memory CAS.
bool isOnDiskCASEnabled ()
Expected< std::unique_ptr< ObjectStore > > createOnDiskCAS (const Twine &Path)
 Create a persistent on-disk path at Path.

Enumeration Type Documentation

◆ ValidationResult

enum class llvm::cas::ValidationResult
strong

Represents the result of validating the contents using validateOnDiskUnifiedCASDatabasesIfNeeded.

Note: invalid results are handled as an Error.

Enumerator
Valid 

The data is already valid.

Recovered 

The data was invalid, but was recovered.

Skipped 

Validation was skipped, as it was not needed.

Definition at line 28 of file BuiltinUnifiedCASDatabases.h.

Function Documentation

◆ createInMemoryActionCache()

std::unique_ptr< ActionCache > llvm::cas::createInMemoryActionCache ( )

Create an action cache in memory.

Definition at line 143 of file ActionCaches.cpp.

◆ createInMemoryCAS()

std::unique_ptr< ObjectStore > llvm::cas::createInMemoryCAS ( )

Create an in memory CAS.

Definition at line 335 of file InMemoryCAS.cpp.

◆ createOnDiskActionCache()

Expected< std::unique_ptr< ActionCache > > llvm::cas::createOnDiskActionCache ( StringRef Path)

Create an action cache on disk.

Definition at line 255 of file ActionCaches.cpp.

References llvm::createStringError(), and llvm::inconvertibleErrorCode().

◆ createOnDiskCAS()

Expected< std::unique_ptr< ObjectStore > > llvm::cas::createOnDiskCAS ( const Twine & Path)

Create a persistent on-disk path at Path.

Definition at line 193 of file OnDiskCAS.cpp.

References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::sys::fs::make_absolute().

◆ createOnDiskUnifiedCASDatabases()

Expected< std::pair< std::unique_ptr< ObjectStore >, std::unique_ptr< ActionCache > > > llvm::cas::createOnDiskUnifiedCASDatabases ( StringRef Path)

◆ isOnDiskCASEnabled()

bool llvm::cas::isOnDiskCASEnabled ( )
Returns
true if LLVM_ENABLE_ONDISK_CAS configuration was enabled.

Definition at line 185 of file OnDiskCAS.cpp.

◆ validateOnDiskUnifiedCASDatabasesIfNeeded()

Expected< ValidationResult > llvm::cas::validateOnDiskUnifiedCASDatabasesIfNeeded ( StringRef Path,
bool CheckHash,
bool AllowRecovery,
bool ForceValidation,
std::optional< StringRef > LLVMCasBinaryPath )

Validate the data in Path, if needed to ensure correctness.

Parameters
Pathdirectory for the on-disk database.
CheckHashWhether to validate hashes match the data.
AllowRecoveryWhether to automatically recover from invalid data by marking the files for garbage collection.
ForceValidationWhether to force validation to occur even if it should not be necessary.
LLVMCasBinaryPathIf provided, validation is performed out-of-process using the given llvm-cas executable which protects against crashes during validation. Otherwise validation is performed in-process.
Returns
Valid if the data is already valid, Recovered if data was invalid but has been cleared, Skipped if validation is not needed, or an Error if validation cannot be performed or if the data is left in an invalid state because AllowRecovery is false.

Definition at line 27 of file BuiltinUnifiedCASDatabases.cpp.

References llvm::createStringError(), llvm::cas::builtin::BuiltinCASContext::getHashName(), llvm::inconvertibleErrorCode(), and llvm::cas::ondisk::UnifiedOnDiskCache::validateIfNeeded().