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

Cold file adapter reusing FileLogModel raw worker I/O without record limits. Exact document revision advances on every observed extent or file generation change. Calls are serialized by the caller; native metadata/read handles are owned by each operation. More...

#include <document_source.hpp>

Inheritance diagram for portals::FileDocumentProvider:
portals::FileDocumentProviderportals::FileDocumentProvider portals::ByteDocumentProvider

Public Member Functions

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

Static Public Member Functions

static std::expected< std::shared_ptr< FileDocumentProvider >, DocumentError > create (std::filesystem::path path, std::size_t ioBlockBytes=64 *1024)
static std::expected< std::shared_ptr< FileDocumentProvider >, DocumentError > create (std::shared_ptr< FileLogModel > model)

Detailed Description

Cold file adapter reusing FileLogModel raw worker I/O without record limits. Exact document revision advances on every observed extent or file generation change. Calls are serialized by the caller; native metadata/read handles are owned by each operation.

Member Function Documentation

◆ capabilities()

ByteDocumentCapabilities portals::FileDocumentProvider::capabilities ( ) const
overridevirtualnoexcept
Returns
Seekable, revision may change.

Implements portals::ByteDocumentProvider.

◆ create() [1/2]

std::expected< std::shared_ptr< FileDocumentProvider >, DocumentError > portals::FileDocumentProvider::create ( std::filesystem::path path,
std::size_t ioBlockBytes = 64 *1024 )
static
Parameters
pathOwned source path; creation never opens it.
ioBlockBytesPositive maximum raw read, at most64KiB; default64KiB.
Returns
Cold adapter or typed validation/allocation failure.

◆ create() [2/2]

std::expected< std::shared_ptr< FileDocumentProvider >, DocumentError > portals::FileDocumentProvider::create ( std::shared_ptr< FileLogModel > model)
static
Parameters
modelExisting cold file model; no reopen or replacement of its identity.
Returns
Adapter sharing the model, or typed validation/allocation failure.

◆ metadata()

std::expected< ByteDocumentMetadata, DocumentError > portals::FileDocumentProvider::metadata ( std::stop_token stop)
overridevirtual
Parameters
stopCooperative cancellation.
Returns
Observe exact snapshot.

Implements portals::ByteDocumentProvider.

◆ openReadSession()

std::expected< std::unique_ptr< ByteDocumentReadSession >, DocumentError > portals::FileDocumentProvider::openReadSession ( std::stop_token stop)
overridevirtual
Parameters
stopCooperative worker cancellation.
Returns
One bounded native-handle transaction with deferred fresh-path sealing.

Reimplemented from portals::ByteDocumentProvider.

◆ read()

std::expected< ByteReadResult, DocumentError > portals::FileDocumentProvider::read ( const ByteReadCommand & command,
std::span< std::byte > destination,
std::stop_token stop )
overridevirtual
Parameters
commandExact revision and byte offset.
destinationBorrowed writable bytes.
stopCooperative cancellation.
Returns
Validate before/after raw read.

Implements portals::ByteDocumentProvider.


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