[PATCH] D133716: [CAS] Add LLVMCAS library with InMemoryCAS implementation

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 10:43:30 PDT 2022


steven_wu created this revision.
steven_wu added reviewers: rnk, dblaikie, dexonsmith, benlangmuir.
Herald added subscribers: ributzka, hiraditya, mgorny.
Herald added a project: All.
steven_wu requested review of this revision.
Herald added a project: LLVM.

Add llvm::cas::ObjectStore abstraction and InMemoryCAS as a in-memory
CAS object store implementation.

The ObjectStore models its objects as:

- Content: An array of bytes for the data to be stored.
- Refs: An array of references to other objects in the ObjectStore.

And each CAS Object can be idenfied with an unqine ID/Hash.

ObjectStore supports following general action:

- Expected<ID> store(Content, ArrayRef<Ref>)
- Expected<Ref> get(ID)

It also introduces following types to interact with a CAS ObjectStore:

- CASID: Hash representation for an CAS Objects with its context to help print/compare CASIDs.
- ObjectRef: A light-weight ref for an object in the ObjectStore. It is implementation defined so it can be optimized for read/store/references depending on the implementation.
- ObjectHandle: A CAS internal light-weight handle to an loaded object in the ObjectStore. Underlying data for the object is guaranteed to be available and no error handling is required to access data. This is not exposed to the users of CAS from ObjectStore APIs.
- ObjectProxy: A proxy for the users of CAS to interact with the data inside CAS Object. It bundles a ObjectHandle and an ObjectStore instance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133716

Files:
  llvm/include/llvm/ADT/StringExtras.h
  llvm/include/llvm/CAS/CASID.h
  llvm/include/llvm/CAS/CASReference.h
  llvm/include/llvm/CAS/ObjectStore.h
  llvm/lib/CAS/BuiltinCAS.cpp
  llvm/lib/CAS/BuiltinCAS.h
  llvm/lib/CAS/BuiltinObjectHasher.h
  llvm/lib/CAS/CMakeLists.txt
  llvm/lib/CAS/InMemoryCAS.cpp
  llvm/lib/CAS/ObjectStore.cpp
  llvm/lib/CMakeLists.txt
  llvm/unittests/CAS/CASTestConfig.cpp
  llvm/unittests/CAS/CASTestConfig.h
  llvm/unittests/CAS/CMakeLists.txt
  llvm/unittests/CAS/ObjectStoreTest.cpp
  llvm/unittests/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133716.459516.patch
Type: text/x-patch
Size: 69445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220912/2aab06c8/attachment.bin>


More information about the llvm-commits mailing list