LLVM: llvm::cas::builtin::BuiltinCAS Class Reference (original) (raw)
Common base class for builtin CAS implementations using the same CASContext. More...
#include "[CAS/BuiltinCAS.h](BuiltinCAS%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| BuiltinCAS () | |
| Expected< CASID > | parseID (StringRef Reference) final |
| Get a CASID from a ID, which should have been generated by CASID::print(). | |
| Expected< ObjectRef > | store (ArrayRef< ObjectRef > Refs, ArrayRef< char > Data) final |
| Store object into ObjectStore. | |
| virtual Expected< ObjectRef > | storeImpl (ArrayRef< uint8_t > ComputedHash, ArrayRef< ObjectRef > Refs, ArrayRef< char > Data)=0 |
| virtual Expected< ObjectRef > | storeFromNullTerminatedRegion (ArrayRef< uint8_t > ComputedHash, sys::fs::mapped_file_region Map) |
| virtual ArrayRef< char > | getDataConst (ObjectHandle Node) const =0 |
| Both builtin CAS implementations provide lifetime for free, so this can be const, and readData() and getDataSize() can be implemented on top of it. | |
| ArrayRef< char > | getData (ObjectHandle Node, bool RequiresNullTerminator) const final |
| uint64_t | getDataSize (ObjectHandle Node) const final |
| Get the size of some data. | |
| Error | createUnknownObjectError (const CASID &ID) const |
| Error | createCorruptObjectError (const CASID &ID) const |
| Error | createCorruptStorageError () const |
| Error | validateObject (const CASID &ID) final |
| Validate the underlying object referred by CASID. | |
| Public Member Functions inherited from llvm::cas::ObjectStore | |
| virtual CASID | getID (ObjectRef Ref) const =0 |
| Get an ID for Ref. | |
| virtual std::optional< ObjectRef > | getReference (const CASID &ID) const =0 |
| Get an existing reference to the object called ID. | |
| virtual Expected< bool > | isMaterialized (ObjectRef Ref) const =0 |
| virtual Error | validate (bool CheckHash) const =0 |
| Validate the entire ObjectStore. | |
| LLVM_ABI_FOR_TEST Expected< ObjectProxy > | createProxy (ArrayRef< ObjectRef > Refs, StringRef Data) |
| Helper functions to store object and returns a ObjectProxy. | |
| Expected< ObjectRef > | storeFromString (ArrayRef< ObjectRef > Refs, StringRef String) |
| Store object from StringRef. | |
| Expected< ObjectRef > | storeFromOpenFile (sys::fs::file_t FD, std::optional< sys::fs::file_status > Status=std::nullopt) |
| Default implementation reads FD and calls storeNode(). | |
| LLVM_ABI Expected< ObjectProxy > | getProxy (const CASID &ID) |
| Create ObjectProxy from CASID. If the object doesn't exist, get an error. | |
| LLVM_ABI Expected< ObjectProxy > | getProxy (ObjectRef Ref) |
| Create ObjectProxy from ObjectRef. | |
| Expected< std::optional< ObjectProxy > > | getProxyIfExists (ObjectRef Ref) |
| uint64_t | readData (ObjectHandle Node, raw_ostream &OS, uint64_t Offset=0, uint64_t MaxBytes=-1ULL) const |
| Read the data from Data into OS. | |
| virtual Error | setSizeLimit (std::optional< uint64_t > SizeLimit) |
| Set the size for limiting growth of on-disk storage. | |
| virtual Expected< std::optional< uint64_t > > | getStorageSize () const |
| virtual Error | pruneStorageData () |
| Prune local storage to reduce its size according to the desired size limit. | |
| Error | validateTree (ObjectRef Ref) |
| Validate the whole node tree. | |
| Expected< ObjectRef > | importObject (ObjectStore &Upstream, ObjectRef Other) |
| Import object from another CAS. | |
| virtual void | print (raw_ostream &) const |
| Print the ObjectStore internals for debugging purpose. | |
| void | dump () const |
| const CASContext & | getContext () const |
| Get CASContext. | |
| virtual | ~ObjectStore ()=default |
| 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 24 of file BuiltinCAS.h.
| llvm::cas::builtin::BuiltinCAS::BuiltinCAS ( ) | inline |
|---|
◆ createCorruptObjectError()
| Error llvm::cas::builtin::BuiltinCAS::createCorruptObjectError ( const CASID & ID) const | inline |
|---|
◆ createCorruptStorageError()
| Error llvm::cas::builtin::BuiltinCAS::createCorruptStorageError ( ) const | inline |
|---|
◆ createUnknownObjectError()
| Error llvm::cas::builtin::BuiltinCAS::createUnknownObjectError ( const CASID & ID) const | inline |
|---|
◆ getData()
◆ getDataConst()
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().
◆ getDataSize()
◆ parseID()
◆ store()
◆ storeFromNullTerminatedRegion()
◆ storeImpl()
◆ validateObject()
The documentation for this class was generated from the following files:
- lib/CAS/BuiltinCAS.h
- lib/CAS/BuiltinCAS.cpp