Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::SparseDocumentIndex Class Reference

Worker-owned sparse index with adaptive thinning and resumable bounded scans. Serialize mutable operations using the existing executor. Lines are never materialized. Empty documents have one empty line; a final separator introduces a trailing empty line. More...

#include <document_source.hpp>

Public Member Functions

 ~SparseDocumentIndex ()
 Release fixed arena and its credit.
DocumentRevision revision () const noexcept
DocumentLinePolicy policy () const noexcept
DocumentIndexProgress progress () const noexcept
DocumentCheckpoint checkpointBeforeByte (std::uint64_t offset) const noexcept
std::expected< DocumentIndexProgress, DocumentError > advance (ByteDocumentSource &source, std::stop_token stop={})
std::expected< DocumentLineLocation, DocumentError > locateLine (ByteDocumentSource &source, std::uint64_t line, std::stop_token stop={})

Static Public Member Functions

static std::expected< std::unique_ptr< SparseDocumentIndex >, DocumentError > create (std::shared_ptr< SourceBudget > budget, DocumentRevision revision, DocumentIndexOptions options={})

Detailed Description

Worker-owned sparse index with adaptive thinning and resumable bounded scans. Serialize mutable operations using the existing executor. Lines are never materialized. Empty documents have one empty line; a final separator introduces a trailing empty line.

Member Function Documentation

◆ advance()

std::expected< DocumentIndexProgress, DocumentError > portals::SparseDocumentIndex::advance ( ByteDocumentSource & source,
std::stop_token stop = {} )
Parameters
sourceMatching source dispatched off its creating thread.
stopCooperative cancellation.
Returns
Prefix after at most scanBytes read, or typed failure.

◆ checkpointBeforeByte()

DocumentCheckpoint portals::SparseDocumentIndex::checkpointBeforeByte ( std::uint64_t offset) const
noexcept
Parameters
offsetByte anchor.
Returns
Nearest retained checkpoint not after offset, usable as a bounded scan origin.

◆ create()

std::expected< std::unique_ptr< SparseDocumentIndex >, DocumentError > portals::SparseDocumentIndex::create ( std::shared_ptr< SourceBudget > budget,
DocumentRevision revision,
DocumentIndexOptions options = {} )
static
Parameters
budgetSame root as document/views, including this reservation.
revisionExact namespace/provider revision for every scan.
optionsCheckpoint quota, byte interval and maximum work.
Returns
Reserved index or typed validation/admission/allocation failure.

◆ locateLine()

std::expected< DocumentLineLocation, DocumentError > portals::SparseDocumentIndex::locateLine ( ByteDocumentSource & source,
std::uint64_t line,
std::stop_token stop = {} )
Parameters
sourceMatching seekable source on an existing worker.
lineZero-based requested line; repeated calls resume pending work.
stopCooperative cancellation.
Returns
Exact start, PENDING after bounded work, or UNKNOWN after proven EOF.

◆ policy()

DocumentLinePolicy portals::SparseDocumentIndex::policy ( ) const
noexcept
Returns
Policy qualifying checkpoints.

◆ progress()

DocumentIndexProgress portals::SparseDocumentIndex::progress ( ) const
noexcept
Returns
Prefix knowledge without I/O.

◆ revision()

DocumentRevision portals::SparseDocumentIndex::revision ( ) const
noexcept
Returns
Index namespace/revision.

The documentation for this class was generated from the following file: