Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add submodule lmdbxx which is a c++ wrapper for lmdb #4724

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@
[submodule "submodules/fmt"]
path = submodules/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "submodules/lmdbxx"]
path = submodules/lmdbxx
url = https://github.com/hoytech/lmdbxx.git
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ if(COVERAGE)
endif()

if(MSVC)
add_definitions(/MP)
add_compile_options(/MP)
add_compile_options(/Zc:__cplusplus) # Tell MSVC to emit correct version
# number in the __cplusplus macro
endif()

set(CPACK_PACKAGE_VENDOR "Nano Currency")
Expand Down Expand Up @@ -674,6 +676,9 @@ add_library(
submodules/lmdb/libraries/liblmdb/mdb.c
submodules/lmdb/libraries/liblmdb/midl.c)

include_directories(submodules/lmdb/libraries/liblmdb)
include_directories(submodules/lmdbxx/include)

if(WIN32)
target_link_libraries(lmdb ntdll)
endif()
Expand Down
12 changes: 4 additions & 8 deletions nano/core_test/block_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,7 @@ TEST (mdb_block_store, upgrade_v21_v22)
nano::store::lmdb::component store (logger, path, nano::dev::constants);
auto transaction (store.tx_begin_write ());
ASSERT_EQ (store.version.get (transaction), store.version_current);
MDB_dbi unchecked_handle{ 0 };
ASSERT_EQ (MDB_NOTFOUND, mdb_dbi_open (store.env.tx (transaction), "unchecked", 0, &unchecked_handle));
ASSERT_THROW (::lmdb::dbi::open (store::lmdb::tx (transaction), "unchecked", 0), ::lmdb::not_found_error);
};

// Testing current version doesn't contain the unchecked table
Expand All @@ -1387,8 +1386,7 @@ TEST (mdb_block_store, upgrade_v21_v22)
nano::store::lmdb::component store (logger, path, nano::dev::constants);
auto transaction (store.tx_begin_write ());
store.version.put (transaction, 21);
MDB_dbi unchecked_handle{ 0 };
ASSERT_FALSE (mdb_dbi_open (store.env.tx (transaction), "unchecked", MDB_CREATE, &unchecked_handle));
auto unchecked_handle = ::lmdb::dbi::open (store::lmdb::tx (transaction), "unchecked", MDB_CREATE);
ASSERT_EQ (store.version.get (transaction), 21);
}

Expand All @@ -1411,8 +1409,7 @@ TEST (mdb_block_store, upgrade_v23_v24)
nano::store::lmdb::component store (logger, path, nano::dev::constants);
auto transaction (store.tx_begin_write ());
ASSERT_EQ (store.version.get (transaction), store.version_current);
MDB_dbi frontiers_handle{ 0 };
ASSERT_EQ (MDB_NOTFOUND, mdb_dbi_open (store.env.tx (transaction), "frontiers", 0, &frontiers_handle));
ASSERT_THROW (::lmdb::dbi::open (store::lmdb::tx (transaction), "frontiers", 0), ::lmdb::not_found_error);
};

// Testing current version doesn't contain the frontiers table
Expand All @@ -1423,8 +1420,7 @@ TEST (mdb_block_store, upgrade_v23_v24)
nano::store::lmdb::component store (logger, path, nano::dev::constants);
auto transaction (store.tx_begin_write ());
store.version.put (transaction, 23);
MDB_dbi frontiers_handle{ 0 };
ASSERT_FALSE (mdb_dbi_open (store.env.tx (transaction), "frontiers", MDB_CREATE, &frontiers_handle));
auto frontiers_handle = ::lmdb::dbi::open (store::lmdb::tx (transaction), "frontiers", MDB_CREATE);
ASSERT_EQ (store.version.get (transaction), 23);
}

Expand Down
Loading
Loading