Skip to content

Commit

Permalink
GH-2045 Add get_data_dir()
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 14, 2024
1 parent fe1d3bb commit a482982
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/chain/fork_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace eosio::chain {
fork_multi_index_type index;
bsp root; // Only uses the block_header_state_legacy portion
bsp head;
std::filesystem::path datadir;
const std::filesystem::path datadir;

explicit fork_database_impl( const std::filesystem::path& data_dir ) : datadir(data_dir) {}

Expand Down Expand Up @@ -102,6 +102,11 @@ namespace eosio::chain {
my->open_impl( validator );
}

template<class bsp>
std::filesystem::path fork_database<bsp>::get_data_dir() const {
return my->datadir;
}

template<class bsp>
void fork_database_impl<bsp>::open_impl( validator_t& validator ) {
if (!std::filesystem::is_directory(datadir))
Expand Down
2 changes: 2 additions & 0 deletions libraries/chain/include/eosio/chain/fork_database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ namespace eosio::chain {
explicit fork_database( const std::filesystem::path& data_dir );
~fork_database();

std::filesystem::path get_data_dir() const;

void open( validator_t& validator );
void close();

Expand Down

0 comments on commit a482982

Please sign in to comment.