Skip to content
Merged
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
12 changes: 12 additions & 0 deletions include/bitcoin/database/impl/query/query.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ bool CLASS::is_full() const NOEXCEPT
return to_bool(get_space()) && !is_fault();
}

TEMPLATE
bool CLASS::is_coalesced() const NOEXCEPT
{
return get_fork() == get_top_candidate();
}

TEMPLATE
size_t CLASS::get_space() const NOEXCEPT
{
Expand All @@ -110,6 +116,12 @@ code CLASS::reload(const typename Store::event_handler& handler) const NOEXCEPT
return store_.reload(handler);
}

TEMPLATE
code CLASS::prune(const typename Store::event_handler& handler) const NOEXCEPT
{
return store_.prune(handler);
}

TEMPLATE
code CLASS::snapshot(const typename Store::event_handler& handler) const NOEXCEPT
{
Expand Down
3 changes: 1 addition & 2 deletions include/bitcoin/database/impl/store.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,7 @@ code CLASS::prune(const event_handler& handler) NOEXCEPT
};

// Prevouts resettable if all candidates confirmed (fork is candidate top).
const query<CLASS> query_{ *this };
if (query_.get_fork() == query_.get_top_candidate())
if (query<CLASS>{ *this }.is_coalesced())
{
// zeroize table head, set body logical size to zero.
prune(ec, prevout, table_t::prevout_table);
Expand Down
6 changes: 6 additions & 0 deletions include/bitcoin/database/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,18 @@ class query
/// True if there is a disk full condition.
bool is_full() const NOEXCEPT;

/// True if candidate top is fork point header.
bool is_coalesced() const NOEXCEPT;

/// Get the space required to clear the disk full condition.
size_t get_space() const NOEXCEPT;

/// Resume from disk full condition.
code reload(const typename Store::event_handler& handler) const NOEXCEPT;

/// Prune the store while running.
code prune(const typename Store::event_handler& handler) const NOEXCEPT;

/// Snapshot the store while running.
code snapshot(const typename Store::event_handler& handler) const NOEXCEPT;

Expand Down
Loading