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

Explicit source-owning provisional batch, confined to its creating worker. Read pages can outlive the batch, but must not be published before successful seal. Destruction closes the backend before returning metadata credit; it performs no I/O validation and cannot turn an abandoned batch into a committed result. More...

#include <document_source.hpp>

Public Member Functions

 DocumentReadBatch (DocumentReadBatch &&other) noexcept=default
DocumentReadBatch & operator= (DocumentReadBatch other) noexcept
 DocumentReadBatch (const DocumentReadBatch &)=delete
 ~DocumentReadBatch ()=default
 Destroy on the creating worker; does not terminate on misuse.
const DocumentMetadata & metadata () const noexcept
std::expected< DocumentBytePage, DocumentError > read (DocumentReadRequest request, std::stop_token stop={})
std::expected< void, DocumentError > seal (std::stop_token stop={})

Static Public Member Functions

static std::expected< DocumentReadBatch, DocumentError > create (std::shared_ptr< ByteDocumentSource > source, std::stop_token stop={})

Static Public Attributes

static constexpr std::size_t READ_BATCH_METADATA_BYTES = 4096
 Held only by an actual supported batch.

Detailed Description

Explicit source-owning provisional batch, confined to its creating worker. Read pages can outlive the batch, but must not be published before successful seal. Destruction closes the backend before returning metadata credit; it performs no I/O validation and cannot turn an abandoned batch into a committed result.

Constructor & Destructor Documentation

◆ DocumentReadBatch()

portals::DocumentReadBatch::DocumentReadBatch ( DocumentReadBatch && other)
defaultnoexcept
Parameters
otherWorker-local ownership transferred without allocation.

Member Function Documentation

◆ create()

std::expected< DocumentReadBatch, DocumentError > portals::DocumentReadBatch::create ( std::shared_ptr< ByteDocumentSource > source,
std::stop_token stop = {} )
static
Parameters
sourceStrong existing source; its creating UI thread is rejected.
stopCooperative cancellation, also checked after provider callbacks.
Returns
Worker-owned batch with captured qualified metadata, or typed failure.

◆ metadata()

const DocumentMetadata & portals::DocumentReadBatch::metadata ( ) const
inlinenoexcept
Returns
Borrowed captured metadata, valid until this batch moves or dies; no provider I/O.

◆ operator=()

DocumentReadBatch & portals::DocumentReadBatch::operator= ( DocumentReadBatch other)
noexcept
Parameters
otherReplacement worker-local batch.
Returns
This owner after safely releasing old storage.

◆ read()

std::expected< DocumentBytePage, DocumentError > portals::DocumentReadBatch::read ( DocumentReadRequest request,
std::stop_token stop = {} )
Parameters
requestExact captured revision, source namespace and bounded byte window.
stopCooperative cancellation; late cancellation discards the provisional page.
Returns
Owning provisional page, or the first batch failure. Wrong-thread calls never mutate the batch.

◆ seal()

std::expected< void, DocumentError > portals::DocumentReadBatch::seal ( std::stop_token stop = {})
Parameters
stopCooperative cancellation of final validation.
Returns
Success qualifying preceding pages, or the first failure; a successful batch is single-use.

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