LLVM 22.0.0git
Classes | Typedefs
llvm::cas::builtin Namespace Reference

Classes

class  BuiltinCAS
 Common base class for builtin CAS implementations using the same CASContext. More...
 
class  BuiltinCASContext
 CASContext for LLVM builtin CAS using BLAKE3 hash type. More...
 

Typedefs

using HasherT = BLAKE3
 Current hash type for the builtin CAS.
 
using HashType = decltype(HasherT::hash(std::declval< ArrayRef< uint8_t > & >()))
 

Typedef Documentation

◆ HasherT

Current hash type for the builtin CAS.

FIXME: This should be configurable via an enum to allow configuring the hash function. The enum should be sent into createInMemoryCAS() and createOnDiskCAS().

This is important (at least) for future-proofing, when we want to make new CAS instances use BLAKE7, but still know how to read/write BLAKE3.

Even just for BLAKE3, it would be useful to have these values:

BLAKE3     => 32B hash from BLAKE3
BLAKE3_16B => 16B hash from BLAKE3 (truncated)

... where BLAKE3_16 uses TruncatedBLAKE3<16>.

Motivation for a truncated hash is that it's cheaper to store. It's not clear if we always (or ever) need the full 32B, and for an ephemeral in-memory CAS, we almost certainly don't need it.

Note that the cost is linear in the number of objects for the builtin CAS, since we're using internal offsets and/or pointers as an optimization.

However, it's possible we'll want to hook up a local builtin CAS to, e.g., a distributed generic hash map to use as an ActionCache. In that scenario, the transitive closure of the structured objects that are the results of the cached actions would need to be serialized into the map, something like:

"action:<schema>:<key>" -> "0123"
"object:<schema>:0123"  -> "3,4567,89AB,CDEF,9,some data"
"object:<schema>:4567"  -> ...
"object:<schema>:89AB"  -> ...
"object:<schema>:CDEF"  -> ...

These references would be full cost.

Definition at line 54 of file BuiltinCASContext.h.

◆ HashType

using llvm::cas::builtin::HashType = typedef decltype(HasherT::hash(std::declval<ArrayRef<uint8_t> &>()))

Definition at line 55 of file BuiltinCASContext.h.