From f6e90cd7f909659bc5e2d2739638c739c187b0e0 Mon Sep 17 00:00:00 2001 From: Harry Kalodner Date: Sun, 6 Mar 2022 14:48:55 -0500 Subject: [PATCH] Switch from std::filesystem to boost --- packages/arb-avm-cpp/data_storage/CMakeLists.txt | 2 +- .../data_storage/include/data_storage/arbcore.hpp | 8 +++++++- packages/arb-avm-cpp/data_storage/src/arbcore.cpp | 12 ++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/arb-avm-cpp/data_storage/CMakeLists.txt b/packages/arb-avm-cpp/data_storage/CMakeLists.txt index 3a9827cbc3..f973c6b11b 100644 --- a/packages/arb-avm-cpp/data_storage/CMakeLists.txt +++ b/packages/arb-avm-cpp/data_storage/CMakeLists.txt @@ -92,7 +92,7 @@ target_include_directories(data_storage PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../external ) -target_link_libraries(data_storage PUBLIC avm avm_values cavm Threads::Threads OpenSSL::Crypto) +target_link_libraries(data_storage PUBLIC avm avm_values cavm Threads::Threads OpenSSL::Crypto Boost::filesystem) target_code_coverage(data_storage AUTO ALL) diff --git a/packages/arb-avm-cpp/data_storage/include/data_storage/arbcore.hpp b/packages/arb-avm-cpp/data_storage/include/data_storage/arbcore.hpp index fa155949f3..a14aa88aa9 100644 --- a/packages/arb-avm-cpp/data_storage/include/data_storage/arbcore.hpp +++ b/packages/arb-avm-cpp/data_storage/include/data_storage/arbcore.hpp @@ -51,6 +51,12 @@ struct Slice; class ColumnFamilyHandle; } // namespace rocksdb +namespace boost { +namespace filesystem { +class path; +} // namespace filesystem +} // namespace boost + struct InitializeResult { rocksdb::Status status; bool finished; @@ -529,7 +535,7 @@ class ArbCore { uint256_t& number); std::variant getLastCheckpoint( ReadTransaction& tx); - void saveRocksdbCheckpoint(const std::filesystem::path& save_rocksdb_path, + void saveRocksdbCheckpoint(const boost::filesystem::path& save_rocksdb_path, ReadTransaction& tx); void setCoreError(const std::string& message); bool threadBody(ThreadDataStruct& thread_data); diff --git a/packages/arb-avm-cpp/data_storage/src/arbcore.cpp b/packages/arb-avm-cpp/data_storage/src/arbcore.cpp index f362a422c8..dc39bc7678 100644 --- a/packages/arb-avm-cpp/data_storage/src/arbcore.cpp +++ b/packages/arb-avm-cpp/data_storage/src/arbcore.cpp @@ -29,6 +29,9 @@ #include #include +#include +#include + #include #include #include @@ -369,8 +372,9 @@ InitializeResult ArbCore::applyConfig() { } if (coreConfig.database_save_on_startup) { - std::filesystem::path save_rocksdb_path(coreConfig.database_save_path); - std::filesystem::create_directories(save_rocksdb_path); + boost::filesystem::path save_rocksdb_path( + coreConfig.database_save_path); + boost::filesystem::create_directories(save_rocksdb_path); ReadTransaction tx(data_storage); saveRocksdbCheckpoint(save_rocksdb_path, tx); } @@ -1850,7 +1854,7 @@ void ArbCore::operator()() { thread_data.next_rocksdb_save_timepoint = std::chrono::steady_clock::now() + std::chrono::seconds(coreConfig.database_save_interval); - std::filesystem::create_directories(coreConfig.database_save_path); + boost::filesystem::create_directories(coreConfig.database_save_path); } try { @@ -1878,7 +1882,7 @@ void ArbCore::operator()() { #endif } void ArbCore::saveRocksdbCheckpoint( - const std::filesystem::path& save_rocksdb_path, + const boost::filesystem::path& save_rocksdb_path, ReadTransaction& tx) { struct stat info; if ((stat(save_rocksdb_path.c_str(), &info) != 0) &&