Block Index#

class BaseBlockIndex#

Maps logical base-model blocks to their canonical physical KV pages.

The index is a lookup structure, not an owner: ResourcePools tracks page references and CacheRecordStore tracks the records that keep pages resident. The forward map supports longest-prefix matching; the reverse map removes the exact logical mapping when the last cache reference to a page is evicted. Lookup has no ownership or LRU side effects, and publication uses first-committer-wins semantics.

Public Functions

BaseLookupResult lookupPrefix(
std::vector<BlockHash> const &hashes
) const#

Return the longest contiguous prefix present in the index without changing recency or ownership.

std::optional<PageId> lookup(BlockHash const &hash) const#
BaseInsertResult insert(BlockHash hash, PageId proposedPage)#

First committer wins: an existing key returns its canonical page without replacing it.

void erasePage(PageId page)#

Remove the exact reverse mapping for a physical page; an absent page is a no-op.

size_t size() const noexcept#
class SpecPagedStateIndex#

Maps paged speculative block boundaries to complete record-owned paths.

Unlike BaseBlockIndex, spec pages are not independently canonicalized. Every match identifies one CacheRecord so callers always consume a coherent path from one producer rather than stitching pages from unrelated records.

Public Functions

void insert(CacheRecord const &record)#

Register every paired full-block boundary in one paged spec-state record.

std::optional<SpecPagedStateMatch> lookupLongest(
std::vector<BlockHash> const &hashes,
int32_t maxBlockCount
) const#

Return the longest boundary at or below maxBlockCount without changing ownership or recency.

bool contains(
BlockHash const &terminalHash,
SpecPagedStateMatch const &match
) const#
void erase(CacheRecord const &record)#

Remove only the entries owned by record; a base-only record is a no-op.

class SpecStateIndex#

Wrapper for speculative state lookup substrates.

Public Functions

SpecPagedStateIndex const &paged() const noexcept#
SpecPagedStateIndex &paged() noexcept#
struct BaseLookupResult#

Public Members

std::vector<PageId> pageIds#
std::vector<BlockHash> matchedHashes#
struct BaseInsertResult#

Public Members

PageId canonicalPage = {}#
bool inserted = {}#
struct SpecPagedStateMatch#

One record candidate that owns a coherent paged spec-state path through pathBlockCount.

Public Members

RecordId record = {}#
int32_t pathBlockCount = {}#