Adds a CAS logging interface to track mutations of the CAS and action
cache database files. This is designed to aid in the debugging of
data corruption and other issues with the low-level on-disk
representation.
To enable logging, set the environment variable LLVM_CAS_LOG to 1 or 2.
Level 2 includes logging of all allocations inside the index, action
cache, and datapool, which increases the overhead. The log file is
placed inside the top-level directory of the unified cache. For now it
is a human-readable textual format with one line per entry.
This PR bypasses sandbox in the on-disk CAS implementation to match the
downstream patch: https://github.com/swiftlang/llvm-project/pull/12022
This isn't strictly necessary right now, since Clang doesn't integrate
with CAS upstream, but it'll make the future integration easier.
For some older Linux distro that still ships deprecated sysctl header,
there can be deprecation warnings when building LLVMCAS. This also
results LLVMCAS to use the deprecated sysctl function, while it is only
intended to be used on Darwin platforms.
Fix the issue by only including sysctl on Apple platforms. Also move the
platform dependent `getBootTime` code into OnDiskCommon.cpp.
Add a new abstraction layer UnifiedOnDiskCache that adds new functions
of disk space management and data validation that builds on top of
OnDiskGraphDB and OnDiskKeyValueDB.
Build upon UnifiedOnDiskCache, it is OnDiskCAS that implements
ObjectStore and ActionCache interface for LLVM tools to interact with
CAS storage.