LLVM 24.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...
struct  NamedValuesEntry
 Represents an entry in NamedValuesSchema. More...
class  NamedValuesProxy
 A proxy for a loaded CAS Object in NamedValuesSchema. More...
class  NamedValuesSchema
 A schema for representing an array of named nodes in a CAS. More...
class  NodeSchema
 A base class for schemas built on top of CAS nodes. 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, e.g. More...

Functions

LLVM_ABI std::unique_ptr< ActionCache > createInMemoryActionCache ()
 Create an action cache in memory.
LLVM_ABI Expected< std::unique_ptr< ActionCache > > createOnDiskActionCache (StringRef Path)
 Create an action cache on disk.
LLVM_ABI 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.
LLVM_ABI Expected< ValidationResult > validateOnDiskUnifiedCASDatabasesIfNeeded (StringRef Path, bool CheckHash, bool ForceValidation)
 Validate the builtin on-disk CAS in Path in-process, if needed.
LLVM_ABI Expected< ValidationResult > recoverOnDiskUnifiedCASDatabases (StringRef Path)
 Recover the builtin on-disk CAS in Path after a failed validation.
LLVM_ABI std::unique_ptr< ObjectStore > createInMemoryCAS ()
 Create an in memory CAS.
LLVM_ABI bool isOnDiskCASEnabled ()
LLVM_ABI Expected< std::unique_ptr< ObjectStore > > createOnDiskCAS (const Twine &Path)
 Create a persistent on-disk path at Path.
LLVM_ABI Expected< std::pair< std::shared_ptr< ObjectStore >, std::shared_ptr< ActionCache > > > createPluginCASDatabases (StringRef PluginPath, StringRef OnDiskPath, ArrayRef< std::pair< std::string, std::string > > PluginArgs)
 Create ObjectStore and ActionCache instances backed by a plugin that implements the C API in "llvm-c/CAS/PluginAPI_functions.h".
LLVM_ABI Expected< ValidationResult > validatePluginCASDatabasesIfNeeded (StringRef PluginPath, StringRef OnDiskPath, ArrayRef< std::pair< std::string, std::string > > PluginArgs, bool CheckHash, bool ForceValidation)
 Validate the on-disk data of a plugin-backed CAS in-process if needed, by calling the plugin's llcas_cas_validate_if_needed.
LLVM_ABI Expected< ValidationResult > recoverPluginCASDatabases (StringRef PluginPath, StringRef OnDiskPath, ArrayRef< std::pair< std::string, std::string > > PluginArgs)
 Recover the on-disk data of a plugin-backed CAS after a failed validatePluginCASDatabasesIfNeeded, by calling the plugin's llcas_cas_recover_ondisk_data.

Variables

template class LLVM_TEMPLATE_ABI BuiltinObjectHasher< BLAKE3 >

Enumeration Type Documentation

◆ ValidationResult

enum class llvm::cas::ValidationResult
strong

Represents the result of validating the contents, e.g.

using validateOnDiskUnifiedCASDatabasesIfNeeded, or of recovering from a failed validation, e.g. using recoverOnDiskUnifiedCASDatabases.

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 or recovery was skipped, as it was not needed.

Definition at line 19 of file ValidationResult.h.

Function Documentation

◆ createInMemoryActionCache()

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

Create an action cache in memory.

Definition at line 144 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 245 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 264 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)

◆ createPluginCASDatabases()

Expected< std::pair< std::shared_ptr< ObjectStore >, std::shared_ptr< ActionCache > > > llvm::cas::createPluginCASDatabases ( StringRef PluginPath,
StringRef OnDiskPath,
ArrayRef< std::pair< std::string, std::string > > PluginArgs )

Create ObjectStore and ActionCache instances backed by a plugin that implements the C API in "llvm-c/CAS/PluginAPI_functions.h".

Parameters
PluginPathpath of the dynamic library to load.
OnDiskPathlocal path that the plugin should use for any on-disk resources/caches.
PluginArgsname/value pairs passed to the plugin as custom options; they are opaque to the client.

Definition at line 578 of file PluginCAS.cpp.

◆ isOnDiskCASEnabled()

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

Definition at line 256 of file OnDiskCAS.cpp.

◆ recoverOnDiskUnifiedCASDatabases()

Expected< ValidationResult > llvm::cas::recoverOnDiskUnifiedCASDatabases ( StringRef Path)

Recover the builtin on-disk CAS in Path after a failed validation.

See ondisk::UnifiedOnDiskCache::recover.

Definition at line 41 of file BuiltinUnifiedCASDatabases.cpp.

References llvm::createStringError(), llvm::inconvertibleErrorCode(), and llvm::cas::ondisk::UnifiedOnDiskCache::recover().

◆ recoverPluginCASDatabases()

Expected< ValidationResult > llvm::cas::recoverPluginCASDatabases ( StringRef PluginPath,
StringRef OnDiskPath,
ArrayRef< std::pair< std::string, std::string > > PluginArgs )

Recover the on-disk data of a plugin-backed CAS after a failed validatePluginCASDatabasesIfNeeded, by calling the plugin's llcas_cas_recover_ondisk_data.

Returns
Recovered if the data has been recovered, Skipped if recovery is not needed (e.g. a concurrent process already recovered), or an Error if recovery cannot be performed (including if the plugin does not support it).

Definition at line 652 of file PluginCAS.cpp.

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

◆ validateOnDiskUnifiedCASDatabasesIfNeeded()

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

◆ validatePluginCASDatabasesIfNeeded()

Expected< ValidationResult > llvm::cas::validatePluginCASDatabasesIfNeeded ( StringRef PluginPath,
StringRef OnDiskPath,
ArrayRef< std::pair< std::string, std::string > > PluginArgs,
bool CheckHash,
bool ForceValidation )

Validate the on-disk data of a plugin-backed CAS in-process if needed, by calling the plugin's llcas_cas_validate_if_needed.

The plugin decides whether validation is needed.

Clients that want to be resilient to unexpected crashes during validation may call this from a separate process (e.g. via llvm-cas -validate-if-needed) and call recoverPluginCASDatabases if it fails.

Parameters
PluginPathpath of the dynamic library to load.
OnDiskPathlocal path that the plugin uses for any on-disk resources/caches.
PluginArgsname/value pairs passed to the plugin as custom options; they are opaque to the client.
CheckHashWhether to validate hashes match the data.
ForceValidationWhether to force validation to occur even if it should not be necessary.
Returns
Valid if the data is valid, Skipped if validation is not needed, or an Error if validation cannot be performed (including if the plugin does not support it) or the data is invalid.

Definition at line 636 of file PluginCAS.cpp.

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

Variable Documentation

◆ BuiltinObjectHasher< BLAKE3 >