LLVM 24.0.0git
BuiltinUnifiedCASDatabases.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "BuiltinCAS.h"
13
14using namespace llvm;
15using namespace llvm::cas;
16
17Expected<std::pair<std::unique_ptr<ObjectStore>, std::unique_ptr<ActionCache>>>
19 std::shared_ptr<ondisk::UnifiedOnDiskCache> UniDB;
20 if (Error E = builtin::createBuiltinUnifiedOnDiskCache(Path).moveInto(UniDB))
21 return std::move(E);
23 auto AC = builtin::createActionCacheFromUnifiedOnDiskCache(std::move(UniDB));
24 return std::make_pair(std::move(CAS), std::move(AC));
25}
26
29 bool ForceValidation) {
30#if LLVM_ENABLE_ONDISK_CAS
33 sizeof(builtin::HashType), CheckHash, builtin::hashingFunc,
34 ForceValidation);
35#else
36 return createStringError(inconvertibleErrorCode(), "OnDiskCache is disabled");
37#endif
38}
39
42#if LLVM_ENABLE_ONDISK_CAS
44#else
45 return createStringError(inconvertibleErrorCode(), "OnDiskCache is disabled");
46#endif
47}
This file contains the declaration of the ActionCache class, which is the base class for ActionCache ...
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
static StringRef getHashName()
Get the name of the hash for any table identifiers.
static LLVM_ABI Expected< ValidationResult > recover(StringRef Path)
Recover from invalid data in Path after a failed validateIfNeeded, by marking all the data for garbag...
static LLVM_ABI Expected< ValidationResult > validateIfNeeded(StringRef Path, StringRef HashName, unsigned HashByteSize, bool CheckHash, OnDiskGraphDB::HashingFuncT HashFn, bool ForceValidation)
Validate the data in Path in-process, if it has not been validated since the last system boot.
std::unique_ptr< ObjectStore > createObjectStoreFromUnifiedOnDiskCache(std::shared_ptr< ondisk::UnifiedOnDiskCache > UniDB)
void hashingFunc(ArrayRef< ArrayRef< uint8_t > > Refs, ArrayRef< char > Data, SmallVectorImpl< uint8_t > &Result)
Convenience wrapper for BuiltinObjectHasher.
decltype(HasherT::hash(std::declval< ArrayRef< uint8_t > & >())) HashType
std::unique_ptr< ActionCache > createActionCacheFromUnifiedOnDiskCache(std::shared_ptr< ondisk::UnifiedOnDiskCache > UniDB)
Expected< std::unique_ptr< ondisk::UnifiedOnDiskCache > > createBuiltinUnifiedOnDiskCache(StringRef Path)
Create a UnifiedOnDiskCache instance that uses BLAKE3 hashing.
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,...
LLVM_ABI Expected< ValidationResult > recoverOnDiskUnifiedCASDatabases(StringRef Path)
Recover the builtin on-disk CAS in Path after a failed validation.
LLVM_ABI Expected< ValidationResult > validateOnDiskUnifiedCASDatabasesIfNeeded(StringRef Path, bool CheckHash, bool ForceValidation)
Validate the builtin on-disk CAS in Path in-process, if needed.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition Error.cpp:94
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition Error.h:1321