Skip to content

Commit

Permalink
#1878 switch historic state to use rocksdb
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Jul 29, 2024
1 parent caa817a commit 85443c2
Show file tree
Hide file tree
Showing 7 changed files with 529 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libdevcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ target_link_libraries(devcore PUBLIC skale-buildinfo Boost::filesystem Boost::sy
#target_link_libraries(devcore PRIVATE ${LEVELDB_LIBRARIES})

if( BUILD_LEVELDB )
target_link_libraries(devcore PRIVATE leveldb skutils)
target_link_libraries(devcore PRIVATE leveldb rocksdb skutils)
else()
target_link_libraries(devcore PRIVATE leveldb::leveldb skutils)
target_link_libraries(devcore PRIVATE leveldb::leveldb rocksdb skutils)
endif()
5 changes: 5 additions & 0 deletions libdevcore/DBFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "DBFactory.h"
#include "FileSystem.h"
#include "LevelDB.h"
#include "RocksDB.h"
#include "libethcore/Exceptions.h"

namespace dev::db {
Expand Down Expand Up @@ -143,6 +144,10 @@ std::unique_ptr< DatabaseFace > DBFactory::createHistoric(
return std::unique_ptr< DatabaseFace >( new LevelDB( _path, LevelDB::defaultReadOptions(),
LevelDB::defaultWriteOptions(), LevelDB::defaultDBOptions(), s_reopenPeriodMs ) );
break;
case DatabaseKind::RocksDB:
return std::unique_ptr< DatabaseFace >( new RocksDB( _path, RocksDB::defaultReadOptions(),
RocksDB::defaultWriteOptions(), RocksDB::defaultDBOptions(), s_reopenPeriodMs ) );
break;
default:
assert( false );
return {};
Expand Down
2 changes: 1 addition & 1 deletion libdevcore/DBFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

namespace dev::db {

enum class DatabaseKind { LevelDB };
enum class DatabaseKind { LevelDB, RocksDB };

/// Provide a set of program options related to databases
///
Expand Down
Loading

0 comments on commit 85443c2

Please sign in to comment.