5#include <portals/log_file_error.hpp>
6#include <portals/log_navigation.hpp>
7#include <portals/window_source.hpp>
10#include <memory_resource>
25 LogLine(std::uint64_t offset, std::string_view utf8, std::pmr::memory_resource *resource);
65class FileReadSessionImpl;
82 static std::expected<std::shared_ptr<FileLogModel>,
FileLogFailure>
99 std::stop_token stop = {})
const override;
108 std::stop_token stop)
override;
116 std::expected<FileLogMetadata, FileLogFailure>
metadata(std::stop_token stop = {});
122 std::expected<std::size_t, FileLogFailure>
readBytes(std::uint64_t byteOffset, std::span<std::byte> destination,
123 std::stop_token stop = {});
130 std::expected<FileLogSearchResult, FileLogFailure>
findLiteral(std::string_view pattern, std::uint64_t byteOffset,
131 std::size_t maxScanBytes, std::stop_token stop = {});
140 friend class detail::FileReadSessionImpl;
143 std::uint64_t identityHigh{};
144 std::uint64_t identityLow{};
145 std::uint64_t byteExtent{};
146 std::uint64_t modified{};
150 std::expected<std::uint64_t, FileLogFailure> beginOperation(std::stop_token stop)
const;
151 std::expected<std::uint64_t, FileLogFailure> observe(Observation observation, std::uint64_t operation,
152 std::stop_token stop)
const;
154 std::filesystem::path path_;
158 mutable std::mutex mutex_;
159 mutable Observation observed_;
160 mutable std::uint64_t generation_{};
161 mutable std::uint64_t operationSequence_{};
162 mutable std::uint64_t observedOperation_{};
163 std::optional<FileLogFailure> failure_;
File-backed rich model with optional bounded WindowSource delivery. Creation owns the path without op...
Definition log_file.hpp:74
std::optional< FileLogFailure > lastFailure() const noexcept
std::expected< FileLogSearchResult, FileLogFailure > findLiteral(std::string_view pattern, std::uint64_t byteOffset, std::size_t maxScanBytes, std::stop_token stop={})
std::expected< SourceReadReply< LogLine >, FileLogReadFailure > loadFile(const SourceReadCommand &command, PageBuilder< LogLine > &out, std::stop_token stop)
std::expected< SourceReadReply< LogLine >, SourceError > load(const SourceReadCommand &command, PageBuilder< LogLine > &out, std::stop_token stop) override
static std::expected< std::shared_ptr< FileLogModel >, FileLogFailure > create(std::filesystem::path path, FileLogOptions options={}, ModelResource continuation={})
std::expected< PositionReply, SourceError > resolve(const PositionRequest &request, std::stop_token stop={}) const override
std::expected< FileLogMetadata, FileLogFailure > metadata(std::stop_token stop={})
FileLogOptions options() const noexcept
std::expected< std::size_t, FileLogFailure > readBytes(std::uint64_t byteOffset, std::span< std::byte > destination, std::stop_token stop={})
SourceCapabilities capabilities() const noexcept override
std::expected< ModelBookmark, SourceError > capture(const SourceReadCommand &command, const WindowRow< LogLine > &row, BookmarkOptions options, std::stop_token stop={}) const override
ModelResource resource() const noexcept override
Bounded worker extension for log positions; unrelated to total extent. The provider owns its logical ...
Definition log_navigation.hpp:26
Copyable bookmark owning metadata only; never retains model, snapshot, view or page....
Definition model_position.hpp:66
One reserved worker-only builder. Never expose its writable resource after publication.
Definition window_source.hpp:224
Worker provider; the source captures capabilities once and never calls load on UI.
Definition window_source.hpp:323
Public Portals API.
Definition action.hpp:8
SourceError
Source protocol and admission failures, independent of a provider's storage format.
Definition source_budget.hpp:14
@ INVALID_ARGUMENT
Invalid options, enum, identity or command shape.
Definition source_budget.hpp:15
Checked bookmark capacity, independent of logical source length.
Definition model_position.hpp:57
Copyable diagnostic; nativeCode is errno/GetLastError for native failures, otherwise zero.
Definition log_file_error.hpp:31
Fixed bounds independent of file length; no row index is constructed.
Definition log_file.hpp:29
std::size_t maxSearchPatternBytes
Maximum literal pattern; ceiling 4096 bytes.
Definition log_file.hpp:33
std::size_t maxRecordBytes
Maximum record payload; ceiling 64 KiB.
Definition log_file.hpp:30
std::size_t ioBlockBytes
Single-operation block cache; ceiling 64 KiB.
Definition log_file.hpp:31
std::size_t maxSearchBytes
Maximum bytes examined by one literal-search call.
Definition log_file.hpp:32
Exact failure of one worker load; safe to copy into that job's completion.
Definition log_file.hpp:51
SourceError sourceError
Delivery protocol failure.
Definition log_file.hpp:52
FileLogReadFailure(SourceError error)
Definition log_file.hpp:56
FileLogReadFailure(SourceError error, FileLogFailure cause)
Definition log_file.hpp:60
std::optional< FileLogFailure > fileFailure
Native/domain cause, absent for protocol-only failures.
Definition log_file.hpp:53
One bounded search step; repeat from nextByteOffset when reachedEnd is false.
Definition log_file.hpp:43
std::optional< std::uint64_t > matchByteOffset
First literal match within this step.
Definition log_file.hpp:44
std::uint64_t generation
Generation searched by this step.
Definition log_file.hpp:46
bool reachedEnd
This opened file's observed byte boundary was reached.
Definition log_file.hpp:47
std::uint64_t nextByteOffset
Resume position, including overlap needed for a split match.
Definition log_file.hpp:45
Immutable UTF-8 record with its original byte position; separators are excluded.
Definition log_file.hpp:18
std::uint64_t byteOffset
Position of the first byte in the source file generation.
Definition log_file.hpp:19
std::pmr::string text
Owning UTF-8 payload allocated in the delivery page.
Definition log_file.hpp:20
LogLine(std::uint64_t offset, std::string_view utf8, std::pmr::memory_resource *resource)
Logical resource namespace, distinct from its current delivery session. Reuse an existing SourceStamp...
Definition model_position.hpp:21
Immutable qualified navigation request; does not start work by itself.
Definition model_position.hpp:134
Immutable navigation capabilities of the delivery channel, not of the complete model.
Definition window_source.hpp:73
Immutable worker command; maxRows is an upper bound, never an extent.
Definition window_source.hpp:90
Immutable source namespace; replacement sessions must share their old budget root.
Definition window_source.hpp:27
Immutable typed row; use arena storage for all dynamically owned payload.
Definition window_source.hpp:101