diff --git a/Makefile.am b/Makefile.am
index 9e18911c..e276eb17 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,8 +78,8 @@ test_libbitcoin_database_test_SOURCES = \
test/mocks/map_store.hpp \
test/primitives/arrayhead.cpp \
test/primitives/arraymap.cpp \
+ test/primitives/hashhead.cpp \
test/primitives/hashmap.cpp \
- test/primitives/head.cpp \
test/primitives/iterator.cpp \
test/primitives/linkage.cpp \
test/primitives/manager.cpp \
@@ -161,8 +161,8 @@ include_bitcoin_database_impl_primitivesdir = ${includedir}/bitcoin/database/imp
include_bitcoin_database_impl_primitives_HEADERS = \
include/bitcoin/database/impl/primitives/arrayhead.ipp \
include/bitcoin/database/impl/primitives/arraymap.ipp \
+ include/bitcoin/database/impl/primitives/hashhead.ipp \
include/bitcoin/database/impl/primitives/hashmap.ipp \
- include/bitcoin/database/impl/primitives/head.ipp \
include/bitcoin/database/impl/primitives/iterator.ipp \
include/bitcoin/database/impl/primitives/linkage.ipp \
include/bitcoin/database/impl/primitives/manager.ipp \
@@ -208,8 +208,8 @@ include_bitcoin_database_primitivesdir = ${includedir}/bitcoin/database/primitiv
include_bitcoin_database_primitives_HEADERS = \
include/bitcoin/database/primitives/arrayhead.hpp \
include/bitcoin/database/primitives/arraymap.hpp \
+ include/bitcoin/database/primitives/hashhead.hpp \
include/bitcoin/database/primitives/hashmap.hpp \
- include/bitcoin/database/primitives/head.hpp \
include/bitcoin/database/primitives/iterator.hpp \
include/bitcoin/database/primitives/linkage.hpp \
include/bitcoin/database/primitives/manager.hpp \
diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt
index 65648399..a8f89882 100644
--- a/builds/cmake/CMakeLists.txt
+++ b/builds/cmake/CMakeLists.txt
@@ -286,8 +286,8 @@ if (with-tests)
"../../test/mocks/map_store.hpp"
"../../test/primitives/arrayhead.cpp"
"../../test/primitives/arraymap.cpp"
+ "../../test/primitives/hashhead.cpp"
"../../test/primitives/hashmap.cpp"
- "../../test/primitives/head.cpp"
"../../test/primitives/iterator.cpp"
"../../test/primitives/linkage.cpp"
"../../test/primitives/manager.cpp"
diff --git a/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj b/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj
index 248a8e7f..28866f44 100644
--- a/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj
+++ b/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj
@@ -87,8 +87,8 @@
+
-
diff --git a/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters
index 3511be7f..cd78a6de 100644
--- a/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters
+++ b/builds/msvc/vs2022/libbitcoin-database-test/libbitcoin-database-test.vcxproj.filters
@@ -84,10 +84,10 @@
src\primitives
-
+
src\primitives
-
+
src\primitives
diff --git a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj
index 7db4fa20..808eac5c 100644
--- a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj
+++ b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj
@@ -115,8 +115,8 @@
+
-
@@ -155,8 +155,8 @@
+
-
diff --git a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters
index 9851ef0f..f55a0a0e 100644
--- a/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters
+++ b/builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters
@@ -188,10 +188,10 @@
include\bitcoin\database\primitives
-
+
include\bitcoin\database\primitives
-
+
include\bitcoin\database\primitives
@@ -304,10 +304,10 @@
include\bitcoin\database\impl\primitives
-
+
include\bitcoin\database\impl\primitives
-
+
include\bitcoin\database\impl\primitives
diff --git a/include/bitcoin/database.hpp b/include/bitcoin/database.hpp
index cc456e1d..ff4a735b 100644
--- a/include/bitcoin/database.hpp
+++ b/include/bitcoin/database.hpp
@@ -44,8 +44,8 @@
#include
#include
#include
+#include
#include
-#include
#include
#include
#include
diff --git a/include/bitcoin/database/impl/primitives/arraymap.ipp b/include/bitcoin/database/impl/primitives/arraymap.ipp
index e669588e..53213f65 100644
--- a/include/bitcoin/database/impl/primitives/arraymap.ipp
+++ b/include/bitcoin/database/impl/primitives/arraymap.ipp
@@ -28,7 +28,7 @@ namespace database {
TEMPLATE
CLASS::arraymap(storage& header, storage& body, const Link& buckets) NOEXCEPT
- : head_(header, buckets), manager_(body)
+ : head_(header, buckets), body_(body)
{
}
@@ -40,19 +40,19 @@ bool CLASS::create() NOEXCEPT
{
Link count{};
return head_.create() && head_.get_body_count(count) &&
- manager_.truncate(count);
+ body_.truncate(count);
}
TEMPLATE
bool CLASS::close() NOEXCEPT
{
- return head_.set_body_count(manager_.count());
+ return head_.set_body_count(body_.count());
}
TEMPLATE
bool CLASS::backup() NOEXCEPT
{
- return head_.set_body_count(manager_.count());
+ return head_.set_body_count(body_.count());
}
TEMPLATE
@@ -60,7 +60,7 @@ bool CLASS::restore() NOEXCEPT
{
Link count{};
return head_.verify() && head_.get_body_count(count) &&
- manager_.truncate(count);
+ body_.truncate(count);
}
TEMPLATE
@@ -68,7 +68,7 @@ bool CLASS::verify() const NOEXCEPT
{
Link count{};
return head_.verify() && head_.get_body_count(count) &&
- (count == manager_.count());
+ (count == body_.count());
}
// sizing
@@ -95,13 +95,13 @@ size_t CLASS::head_size() const NOEXCEPT
TEMPLATE
size_t CLASS::body_size() const NOEXCEPT
{
- return manager_.size();
+ return body_.size();
}
TEMPLATE
Link CLASS::count() const NOEXCEPT
{
- return manager_.count();
+ return body_.count();
}
// query interface
@@ -110,19 +110,19 @@ Link CLASS::count() const NOEXCEPT
TEMPLATE
code CLASS::get_fault() const NOEXCEPT
{
- return manager_.get_fault();
+ return body_.get_fault();
}
TEMPLATE
size_t CLASS::get_space() const NOEXCEPT
{
- return manager_.get_space();
+ return body_.get_space();
}
TEMPLATE
code CLASS::reload() NOEXCEPT
{
- return manager_.reload();
+ return body_.reload();
}
// query interface
@@ -154,7 +154,7 @@ template >
bool CLASS::find(const Key& key, Element& element) const NOEXCEPT
{
// This override avoids duplicated memory_ptr construct in get(first()).
- const auto ptr = manager_.get();
+ const auto ptr = body_.get();
return read(ptr, first(ptr, head_.top(key), key), element);
}
@@ -163,7 +163,7 @@ template >
bool CLASS::get(const Link& link, Element& element) const NOEXCEPT
{
// This override is the normal form.
- return read(manager_.get(), link, element);
+ return read(body_.get(), link, element);
}
TEMPLATE
@@ -173,7 +173,7 @@ bool CLASS::put(const Key& key, const Element& element) NOEXCEPT
using namespace system;
const auto count = element.count();
const auto link = allocate(count);
- const auto ptr = manager_.get(link);
+ const auto ptr = body_.get(link);
if (!ptr)
return false;
@@ -199,7 +199,7 @@ bool CLASS::read(const memory_ptr& ptr, const Link& link,
return false;
using namespace system;
- const auto start = manager::link_to_position(link);
+ const auto start = body::link_to_position(link);
if (is_limited(start))
return false;
diff --git a/include/bitcoin/database/impl/primitives/head.ipp b/include/bitcoin/database/impl/primitives/hashhead.ipp
similarity index 95%
rename from include/bitcoin/database/impl/primitives/head.ipp
rename to include/bitcoin/database/impl/primitives/hashhead.ipp
index 5634768b..68d01d8c 100644
--- a/include/bitcoin/database/impl/primitives/head.ipp
+++ b/include/bitcoin/database/impl/primitives/hashhead.ipp
@@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-#ifndef LIBBITCOIN_DATABASE_PRIMITIVES_HEAD_IPP
-#define LIBBITCOIN_DATABASE_PRIMITIVES_HEAD_IPP
+#ifndef LIBBITCOIN_DATABASE_PRIMITIVES_HASHHEAD_IPP
+#define LIBBITCOIN_DATABASE_PRIMITIVES_HASHHEAD_IPP
#include
#include
@@ -30,7 +30,7 @@ namespace libbitcoin {
namespace database {
TEMPLATE
-CLASS::head(storage& head, const Link& buckets) NOEXCEPT
+CLASS::hashhead(storage& head, const Link& buckets) NOEXCEPT
: file_(head), buckets_(buckets)
{
}
diff --git a/include/bitcoin/database/impl/primitives/hashmap.ipp b/include/bitcoin/database/impl/primitives/hashmap.ipp
index 51b7079a..f8685c14 100644
--- a/include/bitcoin/database/impl/primitives/hashmap.ipp
+++ b/include/bitcoin/database/impl/primitives/hashmap.ipp
@@ -28,7 +28,7 @@ namespace database {
TEMPLATE
CLASS::hashmap(storage& header, storage& body, const Link& buckets) NOEXCEPT
- : head_(header, buckets), manager_(body)
+ : head_(header, buckets), body_(body)
{
}
@@ -40,19 +40,19 @@ bool CLASS::create() NOEXCEPT
{
Link count{};
return head_.create() && head_.get_body_count(count) &&
- manager_.truncate(count);
+ body_.truncate(count);
}
TEMPLATE
bool CLASS::close() NOEXCEPT
{
- return head_.set_body_count(manager_.count());
+ return head_.set_body_count(body_.count());
}
TEMPLATE
bool CLASS::backup() NOEXCEPT
{
- return head_.set_body_count(manager_.count());
+ return head_.set_body_count(body_.count());
}
TEMPLATE
@@ -60,7 +60,7 @@ bool CLASS::restore() NOEXCEPT
{
Link count{};
return head_.verify() && head_.get_body_count(count) &&
- manager_.truncate(count);
+ body_.truncate(count);
}
TEMPLATE
@@ -68,7 +68,7 @@ bool CLASS::verify() const NOEXCEPT
{
Link count{};
return head_.verify() && head_.get_body_count(count) &&
- (count == manager_.count());
+ (count == body_.count());
}
// sizing
@@ -95,13 +95,13 @@ size_t CLASS::head_size() const NOEXCEPT
TEMPLATE
size_t CLASS::body_size() const NOEXCEPT
{
- return manager_.size();
+ return body_.size();
}
TEMPLATE
Link CLASS::count() const NOEXCEPT
{
- return manager_.count();
+ return body_.count();
}
// query interface
@@ -110,19 +110,19 @@ Link CLASS::count() const NOEXCEPT
TEMPLATE
code CLASS::get_fault() const NOEXCEPT
{
- return manager_.get_fault();
+ return body_.get_fault();
}
TEMPLATE
size_t CLASS::get_space() const NOEXCEPT
{
- return manager_.get_space();
+ return body_.get_space();
}
TEMPLATE
code CLASS::reload() NOEXCEPT
{
- return manager_.reload();
+ return body_.reload();
}
// query interface
@@ -159,19 +159,19 @@ typename CLASS::iterator CLASS::it(const Key& key) const NOEXCEPT
TEMPLATE
Link CLASS::allocate(const Link& size) NOEXCEPT
{
- return manager_.allocate(size);
+ return body_.allocate(size);
}
TEMPLATE
memory_ptr CLASS::get_memory() const NOEXCEPT
{
- return manager_.get();
+ return body_.get();
}
TEMPLATE
Key CLASS::get_key(const Link& link) NOEXCEPT
{
- const auto ptr = manager_.get(link);
+ const auto ptr = body_.get(link);
if (!ptr || system::is_lesser(ptr->size(), index_size))
return {};
@@ -230,7 +230,7 @@ template >
bool CLASS::set(const Link& link, const Element& element) NOEXCEPT
{
using namespace system;
- const auto ptr = manager_.get(link);
+ const auto ptr = body_.get(link);
if (!ptr)
return false;
@@ -280,7 +280,7 @@ bool CLASS::put_link(Link& link, const Key& key,
using namespace system;
const auto count = element.count();
link = allocate(count);
- const auto ptr = manager_.get(link);
+ const auto ptr = body_.get(link);
if (!ptr)
return false;
@@ -308,7 +308,7 @@ bool CLASS::put(const Link& link, const Key& key,
const Element& element) NOEXCEPT
{
using namespace system;
- const auto ptr = manager_.get(link);
+ const auto ptr = body_.get(link);
if (!ptr)
return false;
@@ -330,7 +330,7 @@ bool CLASS::put(const Link& link, const Key& key,
TEMPLATE
bool CLASS::commit(const Link& link, const Key& key) NOEXCEPT
{
- const auto ptr = manager_.get(link);
+ const auto ptr = body_.get(link);
if (!ptr)
return false;
@@ -364,7 +364,7 @@ bool CLASS::read(const memory_ptr& ptr, const Link& link,
return false;
using namespace system;
- const auto start = manager::link_to_position(link);
+ const auto start = body::link_to_position(link);
if (is_limited(start))
return false;
@@ -395,7 +395,7 @@ Link CLASS::first(const memory_ptr& ptr, Link link, const Key& key) NOEXCEPT
while (!link.is_terminal())
{
// get element offset (fault)
- const auto offset = ptr->offset(manager::link_to_position(link));
+ const auto offset = ptr->offset(body::link_to_position(link));
if (is_null(offset))
return {};
diff --git a/include/bitcoin/database/primitives/arraymap.hpp b/include/bitcoin/database/primitives/arraymap.hpp
index 049325cb..282bd841 100644
--- a/include/bitcoin/database/primitives/arraymap.hpp
+++ b/include/bitcoin/database/primitives/arraymap.hpp
@@ -121,14 +121,14 @@ class arraymap
static constexpr auto is_slab = (Size == max_size_t);
using head = database::arrayhead;
- using manager = database::manager;
+ using body = database::manager;
// Thread safe (index/top/push).
// Not thread safe (create/open/close/backup/restore).
head head_;
// Thread safe.
- manager manager_;
+ body body_;
};
template
diff --git a/include/bitcoin/database/primitives/head.hpp b/include/bitcoin/database/primitives/hashhead.hpp
similarity index 91%
rename from include/bitcoin/database/primitives/head.hpp
rename to include/bitcoin/database/primitives/hashhead.hpp
index c540b88f..f31ee252 100644
--- a/include/bitcoin/database/primitives/head.hpp
+++ b/include/bitcoin/database/primitives/hashhead.hpp
@@ -28,15 +28,15 @@ namespace libbitcoin {
namespace database {
template
-class head
+class hashhead
{
public:
- DEFAULT_COPY_MOVE_DESTRUCT(head);
+ DEFAULT_COPY_MOVE_DESTRUCT(hashhead);
using bytes = typename Link::bytes;
- /// An array head has zero buckets (and cannot call index()).
- head(storage& head, const Link& buckets) NOEXCEPT;
+ /// A hash head has zero buckets (and cannot call index()).
+ hashhead(storage& head, const Link& buckets) NOEXCEPT;
/// Sizing (thread safe).
size_t size() const NOEXCEPT;
@@ -87,9 +87,9 @@ class head
} // namespace libbitcoin
#define TEMPLATE template
-#define CLASS head
+#define CLASS hashhead
-#include
+#include
#undef CLASS
#undef TEMPLATE
diff --git a/include/bitcoin/database/primitives/hashmap.hpp b/include/bitcoin/database/primitives/hashmap.hpp
index 66d78b17..90a240a1 100644
--- a/include/bitcoin/database/primitives/hashmap.hpp
+++ b/include/bitcoin/database/primitives/hashmap.hpp
@@ -22,7 +22,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -175,15 +175,15 @@ class hashmap
static constexpr auto is_slab = (Size == max_size_t);
static constexpr auto index_size = Link::size + array_count;
- using head = database::head;
- using manager = database::manager;
+ using head = database::hashhead;
+ using body = database::manager;
// Thread safe (index/top/push).
// Not thread safe (create/open/close/backup/restore).
head head_;
// Thread safe.
- manager manager_;
+ body body_;
};
template
diff --git a/include/bitcoin/database/primitives/primitives.hpp b/include/bitcoin/database/primitives/primitives.hpp
index fbcd7b2b..c7de17db 100644
--- a/include/bitcoin/database/primitives/primitives.hpp
+++ b/include/bitcoin/database/primitives/primitives.hpp
@@ -21,7 +21,7 @@
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/test/primitives/head.cpp b/test/primitives/hashhead.cpp
similarity index 86%
rename from test/primitives/head.cpp
rename to test/primitives/hashhead.cpp
index 3d13c616..5d348b51 100644
--- a/test/primitives/head.cpp
+++ b/test/primitives/hashhead.cpp
@@ -37,8 +37,8 @@ static_assert(buckets == 20u);
using link = linkage;
using key = data_array;
-using djb2_header = head;
-using unique_header = head;
+using djb2_header = hashhead;
+using unique_header = hashhead;
class nullptr_storage
: public test::chunk_storage
@@ -52,7 +52,7 @@ class nullptr_storage
}
};
-BOOST_AUTO_TEST_CASE(head__create__size__expected)
+BOOST_AUTO_TEST_CASE(hashhead__create__size__expected)
{
data_chunk data;
test::chunk_storage store{ data };
@@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(head__create__size__expected)
BOOST_REQUIRE_EQUAL(data.size(), head_size);
}
-BOOST_AUTO_TEST_CASE(head__verify__uncreated__false)
+BOOST_AUTO_TEST_CASE(hashhead__verify__uncreated__false)
{
data_chunk data;
test::chunk_storage store{ data };
@@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(head__verify__uncreated__false)
BOOST_REQUIRE(!head.verify());
}
-BOOST_AUTO_TEST_CASE(head__verify__created__false)
+BOOST_AUTO_TEST_CASE(hashhead__verify__created__false)
{
data_chunk data;
test::chunk_storage store{ data };
@@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(head__verify__created__false)
BOOST_REQUIRE(head.verify());
}
-BOOST_AUTO_TEST_CASE(head__get_body_count__created__zero)
+BOOST_AUTO_TEST_CASE(hashhead__get_body_count__created__zero)
{
data_chunk data;
test::chunk_storage store{ data };
@@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(head__get_body_count__created__zero)
BOOST_REQUIRE_EQUAL(count, zero);
}
-BOOST_AUTO_TEST_CASE(head__set_body_count__get__expected)
+BOOST_AUTO_TEST_CASE(hashhead__set_body_count__get__expected)
{
data_chunk data;
test::chunk_storage store{ data };
@@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(head__set_body_count__get__expected)
BOOST_REQUIRE_EQUAL(count, expected);
}
-BOOST_AUTO_TEST_CASE(head__unique_hash__null_key__expected)
+BOOST_AUTO_TEST_CASE(hashhead__unique_hash__null_key__expected)
{
constexpr key null_key{};
const auto expected = system::unique_hash(null_key) % buckets;
@@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE(head__unique_hash__null_key__expected)
BOOST_REQUIRE_EQUAL(head.index(null_key), expected);
}
-BOOST_AUTO_TEST_CASE(head__djb2_hash__null_key__expected)
+BOOST_AUTO_TEST_CASE(hashhead__djb2_hash__null_key__expected)
{
constexpr key null_key{};
const auto expected = system::djb2_hash(null_key) % buckets;
@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(head__djb2_hash__null_key__expected)
BOOST_REQUIRE_EQUAL(head.index(null_key), expected);
}
-BOOST_AUTO_TEST_CASE(head__top__link__terminal)
+BOOST_AUTO_TEST_CASE(hashhead__top__link__terminal)
{
test::chunk_storage store;
djb2_header head{ store, buckets };
@@ -144,7 +144,7 @@ BOOST_AUTO_TEST_CASE(head__top__link__terminal)
BOOST_REQUIRE(head.top(9).is_terminal());
}
-BOOST_AUTO_TEST_CASE(head__top__nullptr__terminal)
+BOOST_AUTO_TEST_CASE(hashhead__top__nullptr__terminal)
{
nullptr_storage store;
djb2_header head{ store, buckets };
@@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(head__top__nullptr__terminal)
BOOST_REQUIRE(head.top(9).is_terminal());
}
-BOOST_AUTO_TEST_CASE(head__top__key__terminal)
+BOOST_AUTO_TEST_CASE(hashhead__top__key__terminal)
{
constexpr key null_key{};
@@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(head__top__key__terminal)
BOOST_REQUIRE(head.top(null_key).is_terminal());
}
-BOOST_AUTO_TEST_CASE(head__push__link__terminal)
+BOOST_AUTO_TEST_CASE(hashhead__push__link__terminal)
{
test::chunk_storage store;
djb2_header head{ store, buckets };
@@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE(head__push__link__terminal)
BOOST_REQUIRE_EQUAL(head.top(link_key), expected);
}
-BOOST_AUTO_TEST_CASE(head__push__key__terminal)
+BOOST_AUTO_TEST_CASE(hashhead__push__key__terminal)
{
test::chunk_storage store;
djb2_header head{ store, buckets };