Bitcoin full node and query server

Feb 26, 2025

View in context in the libbitcoin Slack #general mirror.

evoskuil04:28
The resulting bucket read method looks like this:
TEMPLATE
inline Link CLASS::top(const Link& index) const NOEXCEPT
{
    using namespace system;
    const auto raw = file_.get_raw(link_to_position(index));
    if (is_null(raw))
        return {};

    if constexpr (Align)
    {
        std::atomic_ref<integer> head(unsafe_byte_cast<integer>(raw));
        return head.load(std::memory_order_acquire);
    }
    else
    {
        const auto& head = to_array<size_>(raw);
        mutex_.lock_shared();
        const auto top = head;
        mutex_.unlock_shared();
        return top;
    }
}