Skip to content

Commit

Permalink
Merge pull request #534 from evoskuil/master
Browse files Browse the repository at this point in the history
Rename primitives/hash to /hashhead, style.
evoskuil authored Jan 8, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 4221eaf + 33015bf commit dc6b5be
Showing 15 changed files with 79 additions and 79 deletions.
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -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 \
2 changes: 1 addition & 1 deletion builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -87,8 +87,8 @@
<ClCompile Include="..\..\..\..\test\mocks\chunk_storage.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\arrayhead.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\arraymap.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\hashhead.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\hashmap.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\head.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\iterator.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\linkage.cpp" />
<ClCompile Include="..\..\..\..\test\primitives\manager.cpp" />
Original file line number Diff line number Diff line change
@@ -84,10 +84,10 @@
<ClCompile Include="..\..\..\..\test\primitives\arraymap.cpp">
<Filter>src\primitives</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\primitives\hashmap.cpp">
<ClCompile Include="..\..\..\..\test\primitives\hashhead.cpp">
<Filter>src\primitives</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\primitives\head.cpp">
<ClCompile Include="..\..\..\..\test\primitives\hashmap.cpp">
<Filter>src\primitives</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\primitives\iterator.cpp">
Original file line number Diff line number Diff line change
@@ -115,8 +115,8 @@
<ClInclude Include="..\..\..\..\include\bitcoin\database\memory\utilities.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\arrayhead.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\arraymap.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\hashhead.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\hashmap.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\head.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\iterator.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\linkage.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\manager.hpp" />
@@ -155,8 +155,8 @@
<None Include="..\..\..\..\include\bitcoin\database\impl\memory\simple_writer.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\arrayhead.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\arraymap.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\hashhead.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\hashmap.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\head.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\iterator.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\linkage.ipp" />
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\manager.ipp" />
Original file line number Diff line number Diff line change
@@ -188,10 +188,10 @@
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\arraymap.hpp">
<Filter>include\bitcoin\database\primitives</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\hashmap.hpp">
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\hashhead.hpp">
<Filter>include\bitcoin\database\primitives</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\head.hpp">
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\hashmap.hpp">
<Filter>include\bitcoin\database\primitives</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\database\primitives\iterator.hpp">
@@ -304,10 +304,10 @@
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\arraymap.ipp">
<Filter>include\bitcoin\database\impl\primitives</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\hashmap.ipp">
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\hashhead.ipp">
<Filter>include\bitcoin\database\impl\primitives</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\head.ipp">
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\hashmap.ipp">
<Filter>include\bitcoin\database\impl\primitives</Filter>
</None>
<None Include="..\..\..\..\include\bitcoin\database\impl\primitives\iterator.ipp">
2 changes: 1 addition & 1 deletion include/bitcoin/database.hpp
Original file line number Diff line number Diff line change
@@ -44,8 +44,8 @@
#include <bitcoin/database/memory/interfaces/storage.hpp>
#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>
30 changes: 15 additions & 15 deletions include/bitcoin/database/impl/primitives/arraymap.ipp
Original file line number Diff line number Diff line change
@@ -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,35 +40,35 @@ 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
bool CLASS::restore() NOEXCEPT
{
Link count{};
return head_.verify() && head_.get_body_count(count) &&
manager_.truncate(count);
body_.truncate(count);
}

TEMPLATE
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 <typename Element, if_equal<Element::size, Size>>
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 <typename Element, if_equal<Element::size, Size>>
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<ptrdiff_t>(start))
return false;

Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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 <algorithm>
#include <bitcoin/system.hpp>
@@ -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)
{
}
Loading

0 comments on commit dc6b5be

Please sign in to comment.