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

Cold source; inspect/read reject its creating (UI) thread. Dispatch synchronous operations through the existing executor; no scheduler is created. One shared source serializes provider operations on workers. Separate sources sharing a provider require provider-level serialization. Pages can be retained by several views. More...

#include <document_source.hpp>

Public Member Functions

std::shared_ptr< SourceBudget > budget () const noexcept
SourceStamp stamp () const noexcept
ByteDocumentCapabilities capabilities () const noexcept
std::size_t maxPageBytes () const noexcept
std::size_t envelopeBytes () const noexcept
std::size_t pinnedBudgetBytes () const noexcept
bool tryReleaseOptionalStorage () noexcept
std::expected< DocumentMetadata, DocumentError > inspect (std::stop_token stop={})
std::expected< DocumentMetadata, DocumentError > inspectEnd (std::stop_token stop={})
std::expected< DocumentBytePage, DocumentError > read (DocumentReadRequest request, std::stop_token stop={})

Static Public Member Functions

static std::expected< std::shared_ptr< ByteDocumentSource >, DocumentError > create (std::shared_ptr< ByteDocumentProvider > provider, std::shared_ptr< SourceBudget > budget, DocumentSourceOptions options={})

Friends

class DocumentReadBatch

Detailed Description

Cold source; inspect/read reject its creating (UI) thread. Dispatch synchronous operations through the existing executor; no scheduler is created. One shared source serializes provider operations on workers. Separate sources sharing a provider require provider-level serialization. Pages can be retained by several views.

Member Function Documentation

◆ budget()

std::shared_ptr< SourceBudget > portals::ByteDocumentSource::budget ( ) const
inlinenoexcept
Returns
Existing shared accounting root; no I/O or new allocation is performed.

◆ capabilities()

ByteDocumentCapabilities portals::ByteDocumentSource::capabilities ( ) const
noexcept
Returns
Captured capabilities without I/O.

◆ create()

std::expected< std::shared_ptr< ByteDocumentSource >, DocumentError > portals::ByteDocumentSource::create ( std::shared_ptr< ByteDocumentProvider > provider,
std::shared_ptr< SourceBudget > budget,
DocumentSourceOptions options = {} )
static
Parameters
providerShared worker provider; creation invokes capabilities only.
budgetExisting root shared by views/replacement sources.
optionsBounded payload and metadata capacities.
Returns
Cold source without open/metadata/read I/O, or typed failure.

◆ envelopeBytes()

std::size_t portals::ByteDocumentSource::envelopeBytes ( ) const
inlinenoexcept
Returns
Existing positive source/work metadata allowance; available on UI without I/O.

◆ inspect()

std::expected< DocumentMetadata, DocumentError > portals::ByteDocumentSource::inspect ( std::stop_token stop = {})
Parameters
stopCooperative cancellation.
Returns
Qualified metadata, or worker-affinity/provider/cancellation failure.

◆ inspectEnd()

std::expected< DocumentMetadata, DocumentError > portals::ByteDocumentSource::inspectEnd ( std::stop_token stop = {})
Parameters
stopCooperative cancellation, including provider extent discovery.
Returns
Qualified metadata after optional worker-only end discovery, or typed failure. Providers without this capability retain the ordinary inspect behavior.

◆ maxPageBytes()

std::size_t portals::ByteDocumentSource::maxPageBytes ( ) const
noexcept
Returns
Immutable maximum read payload.

◆ pinnedBudgetBytes()

std::size_t portals::ByteDocumentSource::pinnedBudgetBytes ( ) const
noexcept
Returns
Nonblocking provider-owned mandatory bytes on this source's root; excludes source/page/view storage.

◆ read()

std::expected< DocumentBytePage, DocumentError > portals::ByteDocumentSource::read ( DocumentReadRequest request,
std::stop_token stop = {} )
Parameters
requestExact bounded window and caller generation.
stopCooperative cancellation; late cancellation discards the page.
Returns
Owning page or typed failure; no publication/callback occurs here.

◆ stamp()

SourceStamp portals::ByteDocumentSource::stamp ( ) const
noexcept
Returns
Immutable namespace, available without I/O.

◆ tryReleaseOptionalStorage()

bool portals::ByteDocumentSource::tryReleaseOptionalStorage ( )
noexcept
Returns
Whether bounded optional provider storage was reclaimed without I/O or blocking.

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