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

Read-only worker provider; callers serialize operations using the existing executor. Provider/domain storage is external to page accounting, as with WindowProvider. No destination or mutable alias may escape read(). More...

#include <document_source.hpp>

Inheritance diagram for portals::ByteDocumentProvider:
portals::ByteDocumentProviderportals::ByteDocumentProvider portals::FileDocumentProvider portals::GzipDocumentProvider portals::MemoryDocumentProvider

Public Member Functions

virtual ~ByteDocumentProvider ()=default
 Safe final destruction after worker release.
virtual ByteDocumentCapabilities capabilities () const noexcept=0
virtual std::size_t pinnedBudgetBytes (const SourceBudget &root) const noexcept
virtual bool tryReleaseOptionalStorage () noexcept
virtual std::expected< ByteDocumentMetadata, DocumentError > metadata (std::stop_token stop)=0
virtual std::expected< ByteDocumentMetadata, DocumentError > discoverExtent (std::stop_token stop)
virtual std::expected< ByteReadResult, DocumentError > read (const ByteReadCommand &command, std::span< std::byte > destination, std::stop_token stop)=0
virtual std::expected< std::unique_ptr< ByteDocumentReadSession >, DocumentError > openReadSession (std::stop_token stop)

Detailed Description

Read-only worker provider; callers serialize operations using the existing executor. Provider/domain storage is external to page accounting, as with WindowProvider. No destination or mutable alias may escape read().

Member Function Documentation

◆ capabilities()

virtual ByteDocumentCapabilities portals::ByteDocumentProvider::capabilities ( ) const
pure virtualnoexcept
Returns
Capabilities without allocation, opening files or other I/O.

Implemented in portals::FileDocumentProvider, portals::GzipDocumentProvider, and portals::MemoryDocumentProvider.

◆ discoverExtent()

virtual std::expected< ByteDocumentMetadata, DocumentError > portals::ByteDocumentProvider::discoverExtent ( std::stop_token stop)
inlinevirtual
Parameters
stopCooperative cancellation of worker-only extent discovery.
Returns
Current revision and optional extent, or typed failure. The default only observes metadata. Adapters may discover their exact end using bounded storage without formatting document content; an unknown extent remains valid. The source serializes this operation with metadata/read and discards late cancellation.

Reimplemented in portals::GzipDocumentProvider.

◆ metadata()

virtual std::expected< ByteDocumentMetadata, DocumentError > portals::ByteDocumentProvider::metadata ( std::stop_token stop)
pure virtual
Parameters
stopCooperative cancellation.
Returns
Current exact revision/optional extent, or typed failure.

Implemented in portals::FileDocumentProvider, portals::GzipDocumentProvider, and portals::MemoryDocumentProvider.

◆ openReadSession()

virtual std::expected< std::unique_ptr< ByteDocumentReadSession >, DocumentError > portals::ByteDocumentProvider::openReadSession ( std::stop_token stop)
inlinevirtual
Parameters
stopCooperative worker cancellation.
Returns
Optional bounded read session, or UNSUPPORTED without opening the source. Appended capability; ordinary metadata/read remain unchanged for other providers.

Reimplemented in portals::FileDocumentProvider.

◆ pinnedBudgetBytes()

virtual std::size_t portals::ByteDocumentProvider::pinnedBudgetBytes ( const SourceBudget & root) const
inlinevirtualnoexcept
Parameters
rootCredit root whose mandatory retained bytes are observed.
Returns
Thread-safe allocation-free snapshot of provider-owned pinned bytes on that root. Excludes optional cache and source/view credits counted by their owners. No I/O or blocking lock is allowed.

Reimplemented in portals::GzipDocumentProvider.

◆ read()

virtual std::expected< ByteReadResult, DocumentError > portals::ByteDocumentProvider::read ( const ByteReadCommand & command,
std::span< std::byte > destination,
std::stop_token stop )
pure virtual
Parameters
commandExact revision/offset.
destinationWritable bounded storage borrowed for this call only.
stopCooperative cancellation, also checked after returning by the source.
Returns
Initialized byte count and explicit EOF, or typed failure.

Implemented in portals::FileDocumentProvider, portals::GzipDocumentProvider, and portals::MemoryDocumentProvider.

◆ tryReleaseOptionalStorage()

virtual bool portals::ByteDocumentProvider::tryReleaseOptionalStorage ( )
inlinevirtualnoexcept
Returns
Whether optional storage was released without changing document data or navigation state. Thread-safe, bounded and nonblocking; no I/O, decoding, allocation or user callback is allowed. A busy implementation may defer the request to its current worker before that worker completes.

Reimplemented in portals::GzipDocumentProvider.


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