Purpose
The stream port defines the common byte-stream abstraction used by the foundation layer.
It provides:
- a borrower-facing runtime API for reading, writing, and flushing streams,
- lifecycle services for destroying
stream_t handles,
- Composition Root services for adapter registration and factory-based stream creation,
- adapter-facing contracts used to bind concrete backends to the generic
stream port,
- owner-style creator helpers for selected higher-level creation workflows.
The module is designed to separate:
- the generic stream contract,
- the concrete adapter implementations,
- the Composition Root wiring used to connect both.
Public API
Sub-APIs:
Architectural role
The stream module is a foundation port. It defines the public byte-stream boundary used by runtime code, while concrete adapter modules provide backend-specific implementations.
Typical responsibilities:
- expose the public
stream_t handle and status model,
- route borrower-facing operations through adapter-bound dispatch tables,
- manage stream handle destruction,
- support factory-based creation through public adapter descriptors and keys.
Main concepts
Borrower-facing usage
Runtime code manipulates stream_t handles through the public borrower API:
Adapter binding
Concrete adapters bind backend logic to the generic stream port through:
Factory-based creation
The Composition Root can register adapters and create streams by key through:
Related modules
Concrete adapters for this port are documented in the surrounding stream family.
See also