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

Worker sink; storage/output policy belongs to the host implementation. write borrows bytes only for its call and must report a partial prefix even on error. Implementations must not retain the borrowed span or invoke UI code. A blocking sink retains its own cancellation latency; the exporter cannot forcibly interrupt it. Callers serialize an entire export per sink; concurrent write/finish is unsupported. More...

#include <document_export.hpp>

Inheritance diagram for portals::DocumentExportSink:
portals::DocumentExportSinkportals::DocumentExportSink portals::DocumentFileSink

Public Member Functions

virtual ~DocumentExportSink ()=default
 Release owned output handles; no scene is retained.
virtual DocumentWriteReply write (std::span< const std::byte > bytes, std::stop_token stop)=0
virtual std::expected< void, DocumentError > finish (std::stop_token stop)

Detailed Description

Worker sink; storage/output policy belongs to the host implementation. write borrows bytes only for its call and must report a partial prefix even on error. Implementations must not retain the borrowed span or invoke UI code. A blocking sink retains its own cancellation latency; the exporter cannot forcibly interrupt it. Callers serialize an entire export per sink; concurrent write/finish is unsupported.

Member Function Documentation

◆ finish()

virtual std::expected< void, DocumentError > portals::DocumentExportSink::finish ( std::stop_token stop)
inlinevirtual
Parameters
stopCooperative cancellation; resource release must still complete.
Returns
Output finalization outcome; called exactly once after success, validation/source failure or cancellation. Cleanup must not create a new output. If an earlier failure exists, its cause is preserved and a secondary finalization failure is discarded; the result stores one cause.

Reimplemented in portals::DocumentFileSink.

◆ write()

virtual DocumentWriteReply portals::DocumentExportSink::write ( std::span< const std::byte > bytes,
std::stop_token stop )
pure virtual
Parameters
bytesBounded borrowed logical source bytes.
stopCooperative cancellation; account already accepted bytes before returning.
Returns
Exact accepted prefix and optional failure; zero without an error is invalid for nonempty input. An empty successful write begins a validated empty export without supplying payload.

Implemented in portals::DocumentFileSink.


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