LLVM 22.0.0git
|
Common base class for builtin CAS implementations using the same CASContext. More...
#include "CAS/BuiltinCAS.h"
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::cas::ObjectStore | |
static Error | createUnknownObjectError (const CASID &ID) |
Protected Member Functions inherited from llvm::cas::ObjectStore | |
virtual Expected< std::optional< ObjectHandle > > | loadIfExists (ObjectRef Ref)=0 |
Load the object referenced by Ref . | |
Expected< ObjectHandle > | load (ObjectRef Ref) |
Like loadIfExists but returns an error if the object is missing. | |
virtual Error | forEachRef (ObjectHandle Node, function_ref< Error(ObjectRef)> Callback) const =0 |
Methods for handling objects. | |
virtual ObjectRef | readRef (ObjectHandle Node, size_t I) const =0 |
virtual size_t | getNumRefs (ObjectHandle Node) const =0 |
virtual Expected< ObjectRef > | storeFromOpenFileImpl (sys::fs::file_t FD, std::optional< sys::fs::file_status > Status) |
Get ObjectRef from open file. | |
StringRef | getDataString (ObjectHandle Node) |
Get a lifetime-extended StringRef pointing at Data . | |
std::unique_ptr< MemoryBuffer > | getMemoryBuffer (ObjectHandle Node, StringRef Name="", bool RequiresNullTerminator=true) |
Get a lifetime-extended MemoryBuffer pointing at Data . | |
virtual void | readRefs (ObjectHandle Node, SmallVectorImpl< ObjectRef > &Refs) const |
Read all the refs from object in a SmallVector. | |
ObjectStore (const CASContext &Context) |
Common base class for builtin CAS implementations using the same CASContext.
Definition at line 21 of file BuiltinCAS.h.
|
inline |
Definition at line 23 of file BuiltinCAS.h.
References llvm::cas::ObjectStore::ObjectStore().
Definition at line 58 of file BuiltinCAS.h.
References llvm::createStringError().
Referenced by validate().
|
inline |
Definition at line 63 of file BuiltinCAS.h.
References llvm::createStringError().
Definition at line 53 of file BuiltinCAS.h.
References llvm::createStringError().
Referenced by validate().
|
inlinefinalvirtual |
Implements llvm::cas::ObjectStore.
Definition at line 44 of file BuiltinCAS.h.
References getDataConst().
|
pure virtual |
Both builtin CAS implementations provide lifetime for free, so this can be const, and readData() and getDataSize() can be implemented on top of it.
Referenced by getData(), and getDataSize().
|
inlinefinalvirtual |
Get the size of some data.
Implements llvm::cas::ObjectStore.
Definition at line 49 of file BuiltinCAS.h.
References getDataConst(), and llvm::ArrayRef< T >::size().
Get a CASID
from a ID
, which should have been generated by CASID::print().
This succeeds as long as validateID() would pass. The object may be unknown to this CAS instance.
TODO: Remove, and update callers to use validateID() or extractHashFromID().
Implements llvm::cas::ObjectStore.
Definition at line 42 of file BuiltinCAS.cpp.
References llvm::cas::CASID::create(), llvm::cas::ObjectStore::getContext(), llvm::cas::builtin::BuiltinCASContext::parseID(), llvm::Expected< T >::takeError(), and llvm::toStringRef().
|
finalvirtual |
Store object into ObjectStore.
Implements llvm::cas::ObjectStore.
Definition at line 65 of file BuiltinCAS.cpp.
References llvm::Data, llvm::cas::BuiltinObjectHasher< HasherT >::hashObject(), and storeImpl().
|
inlinevirtual |
Definition at line 34 of file BuiltinCAS.h.
References llvm::ArrayRef(), and storeImpl().
|
pure virtual |
References llvm::Data.
Referenced by store(), and storeFromNullTerminatedRegion().
Validate the underlying object referred by CASID.
Implements llvm::cas::ObjectStore.
Definition at line 71 of file BuiltinCAS.cpp.
References createCorruptObjectError(), createUnknownObjectError(), llvm::Data, llvm::cas::ObjectStore::getReference(), llvm::cas::BuiltinObjectHasher< HasherT >::hashObject(), llvm::cas::ObjectProxy::load(), load, llvm::Ref, and llvm::Error::success().