Skip to content

Commit

Permalink
Switch from std::filesystem to boost
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalodner committed May 15, 2022
1 parent 037a8fb commit f6e90cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/arb-avm-cpp/data_storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -529,7 +535,7 @@ class ArbCore {
uint256_t& number);
std::variant<rocksdb::Status, CheckpointVariant> 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);
Expand Down
12 changes: 8 additions & 4 deletions packages/arb-avm-cpp/data_storage/src/arbcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include <data_storage/value/value.hpp>
#include <data_storage/value/valuecache.hpp>

#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>

#include <sys/stat.h>
#include <ethash/keccak.hpp>
#include <filesystem>
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) &&
Expand Down

0 comments on commit f6e90cd

Please sign in to comment.