Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ target_link_libraries(clice-core PUBLIC
kota::codec::toml
kota::option
simdjson::simdjson
lmdb
)

file(GLOB CLICE_DRIVER_SOURCES CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/driver/*.cc")
Expand Down
25 changes: 24 additions & 1 deletion cmake/package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,27 @@ set(KOTA_CODEC_ENABLE_FLATBUFFERS ON)
set(KOTA_ENABLE_EXCEPTIONS OFF)
set(KOTA_ENABLE_RTTI OFF)

FetchContent_MakeAvailable(kotatsu spdlog croaring)
# lmdb — index blob database backend (index::BlobDatabase). Upstream ships
# no CMake; the two-file static library is defined below. Pinned to the
# 0.9 stable line.
FetchContent_Declare(
lmdb
GIT_REPOSITORY https://github.com/LMDB/lmdb.git
GIT_TAG LMDB_0.9.31
GIT_SHALLOW TRUE
)

FetchContent_MakeAvailable(kotatsu spdlog croaring lmdb)

add_library(lmdb STATIC
${lmdb_SOURCE_DIR}/libraries/liblmdb/mdb.c
${lmdb_SOURCE_DIR}/libraries/liblmdb/midl.c)
target_include_directories(lmdb SYSTEM PUBLIC ${lmdb_SOURCE_DIR}/libraries/liblmdb)
# Third-party C, not held to the project's warning set.
if(MSVC)
target_compile_options(lmdb PRIVATE /w)
else()
target_compile_options(lmdb PRIVATE -w)
endif()
find_package(Threads REQUIRED)
target_link_libraries(lmdb PUBLIC Threads::Threads)
6 changes: 3 additions & 3 deletions src/driver/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ kota::task<> run_indexing_task(MasterServer& server, std::string root, int& exit
// or an unreadable global blob disabled persistence) the run would
// only warm this process's memory and a rerun would start from
// nothing — fail instead of pretending.
if(!server.workspace.index_storage) {
if(!server.workspace.index_db) {
LOG_ERROR("Cannot persist the index at {}; see the log for the cause and rerun",
std::string_view(server.workspace.config.project.cache_dir));
exit_code = 1;
Expand Down Expand Up @@ -211,7 +211,7 @@ int run_stats_once(llvm::StringRef root, std::uint32_t top, bool allow_retry) {
Workspace workspace;
workspace.config = std::move(config);
workspace.store.emplace(std::move(*store));
workspace.index_storage = index::make_fs_index_storage(*workspace.store);
workspace.index_db = index::open_database(*workspace.store, workspace.config.project.index_db);
// A namespace whose directory scan failed looks empty while its blobs
// exist — reporting "Index is empty" with exit code 0 would be a lie.
if(auto ec = workspace.store->scan_error()) {
Expand All @@ -231,7 +231,7 @@ int run_stats_once(llvm::StringRef root, std::uint32_t top, bool allow_retry) {
}
// load() detaches the storage when the global blob exists but cannot
// be read — a transient IO error, not an empty index.
if(workspace.index_storage == nullptr) {
if(workspace.index_db == nullptr) {
LOG_ERROR("Failed to read the index cache at {}; the cache was left untouched",
std::string_view(workspace.config.project.cache_dir));
return 1;
Expand Down
Loading
Loading