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

File-backed rich model with optional bounded WindowSource delivery. Creation owns the path without opening it. All I/O methods are worker-only; they do not start threads. Every operation owns its native handle and bounded block cache. No row history, dense row index, mapping or complete-file text is retained. Callers schedule operations on their existing executor. Published pages use the WindowSource budget and remain immutable. More...

#include <log_file.hpp>

Inheritance diagram for portals::FileLogModel:
portals::FileLogModelportals::FileLogModel portals::WindowProvider< LogLine > portals::LogBookmarkProvider portals::PositionResolver

Public Member Functions

SourceCapabilities capabilities () const noexcept override
ModelResource resource () const noexcept override
std::expected< ModelBookmark, SourceError > capture (const SourceReadCommand &command, const WindowRow< LogLine > &row, BookmarkOptions options, std::stop_token stop={}) const override
std::expected< PositionReply, SourceError > resolve (const PositionRequest &request, std::stop_token stop={}) const override
std::expected< SourceReadReply< LogLine >, SourceError > load (const SourceReadCommand &command, PageBuilder< LogLine > &out, std::stop_token stop) override
std::expected< SourceReadReply< LogLine >, FileLogReadFailure > loadFile (const SourceReadCommand &command, PageBuilder< LogLine > &out, std::stop_token stop)
std::expected< FileLogMetadata, FileLogFailure > metadata (std::stop_token stop={})
std::expected< std::size_t, FileLogFailure > readBytes (std::uint64_t byteOffset, std::span< std::byte > destination, std::stop_token stop={})
std::expected< FileLogSearchResult, FileLogFailure > findLiteral (std::string_view pattern, std::uint64_t byteOffset, std::size_t maxScanBytes, std::stop_token stop={})
std::optional< FileLogFailure > lastFailure () const noexcept
FileLogOptions options () const noexcept
Public Member Functions inherited from portals::WindowProvider< LogLine >
virtual ~WindowProvider ()=default
 Safe final destruction on any releasing worker.
Public Member Functions inherited from portals::LogBookmarkProvider
virtual std::expected< PositionReply, SourceError > resolveLog (const PositionRequest &request, std::weak_ptr< const WindowNotifier< LogLine > > readiness, std::stop_token stop={}) const
virtual std::expected< SourceAnchor, SourceError > readAnchor (const PositionReply &reply, SourceStamp session) const
Public Member Functions inherited from portals::PositionResolver
virtual ~PositionResolver ()=default
 Release only the resolver's own bounded metadata.

Static Public Member Functions

static std::expected< std::shared_ptr< FileLogModel >, FileLogFailure > create (std::filesystem::path path, FileLogOptions options={}, ModelResource continuation={})

Friends

class detail::FileReadSessionImpl

Detailed Description

File-backed rich model with optional bounded WindowSource delivery. Creation owns the path without opening it. All I/O methods are worker-only; they do not start threads. Every operation owns its native handle and bounded block cache. No row history, dense row index, mapping or complete-file text is retained. Callers schedule operations on their existing executor. Published pages use the WindowSource budget and remain immutable.

Member Function Documentation

◆ capabilities()

SourceCapabilities portals::FileLogModel::capabilities ( ) const
overridevirtualnoexcept
Returns
Backward, stable-row seek and available-tail support.

Implements portals::WindowProvider< LogLine >.

◆ capture()

std::expected< ModelBookmark, SourceError > portals::FileLogModel::capture ( const SourceReadCommand & command,
const WindowRow< LogLine > & row,
BookmarkOptions options,
std::stop_token stop = {} ) const
overridevirtual
Parameters
commandExact source delivery qualification.
rowWorker-borrowed record.
optionsOwning bookmark capacity.
stopCooperative worker cancellation.
Returns
Native identity and bounded witness bookmark; no row index is built.

Implements portals::LogBookmarkProvider.

◆ create()

std::expected< std::shared_ptr< FileLogModel >, FileLogFailure > portals::FileLogModel::create ( std::filesystem::path path,
FileLogOptions options = {},
ModelResource continuation = {} )
static
Parameters
pathOwned path; no filesystem access is performed here.
optionsPositive bounded limits.
continuationOptional explicit logical resource for reopen; native identity and witness are still validated by resolve. Empty issues an independent resource without file access.
Returns
Owning model or invalid-option/allocation failure.

◆ findLiteral()

std::expected< FileLogSearchResult, FileLogFailure > portals::FileLogModel::findLiteral ( std::string_view pattern,
std::uint64_t byteOffset,
std::size_t maxScanBytes,
std::stop_token stop = {} )
Parameters
patternNonempty byte literal, at most maxSearchPatternBytes; not a regular expression.
byteOffsetFirst candidate byte position.
maxScanBytesPositive work bound, at most options.maxSearchBytes and at least pattern.size().
stopCooperative worker cancellation.
Returns
First match or explicit continuation/end; search covers file bytes, not cached rows.

◆ lastFailure()

std::optional< FileLogFailure > portals::FileLogModel::lastFailure ( ) const
noexcept
Returns
Last file-specific load failure, not per-job provenance under concurrent operations. Copied under a short mutex never held during I/O; use loadFile for the exact causal failure.

◆ load()

std::expected< SourceReadReply< LogLine >, SourceError > portals::FileLogModel::load ( const SourceReadCommand & command,
PageBuilder< LogLine > & out,
std::stop_token stop )
overridevirtual
Parameters
commandBounded worker command; cursors are byte gaps in a file generation.
outExisting shared-budget page/workspace; all dynamic row payload uses its arena.
stopCooperative cancellation checked between bounded reads and records.
Returns
Page with explicit boundary, HISTORY_UNAVAILABLE after generation change, or failure. Native failures are available through lastFailure(). An unterminated final record is visible at TEMPORARY_TAIL; appending to it preserves RowId and changes its value revision.

Implements portals::WindowProvider< LogLine >.

◆ loadFile()

std::expected< SourceReadReply< LogLine >, FileLogReadFailure > portals::FileLogModel::loadFile ( const SourceReadCommand & command,
PageBuilder< LogLine > & out,
std::stop_token stop )
Parameters
commandBounded worker command.
outShared-budget page and workspace.
stopCooperative cancellation.
Returns
Same result as load, preserving this invocation's exact file diagnostic on failure.

◆ metadata()

std::expected< FileLogMetadata, FileLogFailure > portals::FileLogModel::metadata ( std::stop_token stop = {})
Parameters
stopCooperative worker cancellation.
Returns
Observed byte extent and generation.

◆ options()

FileLogOptions portals::FileLogModel::options ( ) const
noexcept
Returns
Immutable explicit file bounds.

◆ readBytes()

std::expected< std::size_t, FileLogFailure > portals::FileLogModel::readBytes ( std::uint64_t byteOffset,
std::span< std::byte > destination,
std::stop_token stop = {} )
Parameters
byteOffsetArbitrary byte position; no row lookup or row-count scan is performed.
destinationCaller-owned bounded buffer, at most ioBlockBytes bytes.
stopCooperative worker cancellation.
Returns
Bytes read, including zero at the observed extent, or a native/argument failure.

◆ resolve()

std::expected< PositionReply, SourceError > portals::FileLogModel::resolve ( const PositionRequest & request,
std::stop_token stop = {} ) const
overridevirtual
Parameters
requestOwning captured metadata and current delivery qualification.
stopCooperative worker cancellation.
Returns
Qualified bounded native validation result; no path-based identity guessing.

Implements portals::PositionResolver.

◆ resource()

ModelResource portals::FileLogModel::resource ( ) const
overridevirtualnoexcept
Returns
Cold logical identity, independent of path and delivery sessions.

Implements portals::LogBookmarkProvider.


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