|
| | Bridge (ReadOnly &in, WriteOnly &out) noexcept |
| | Two non-IO tips.
|
| |
template<typename In , typename Out >
requires (Type::DerivedFrom<std::remove_cvref_t<In>, IO::BufferedReader> && Type::DerivedFrom<std::remove_cvref_t<Out>, IO::BufferedWriter>) |
| STORMBYTE_FORCE_INLINE | Bridge (In &&in, Out &&out) noexcept |
| | Two IO leaves.
|
| |
template<typename Out >
requires Type::DerivedFrom<std::remove_cvref_t<Out>, IO::BufferedWriter> |
| STORMBYTE_FORCE_INLINE | Bridge (ReadOnly &in, Out &&out) noexcept |
| | Non-IO source, IO sink stolen.
|
| |
template<typename In >
requires Type::DerivedFrom<std::remove_cvref_t<In>, IO::BufferedReader> |
| STORMBYTE_FORCE_INLINE | Bridge (In &&in, WriteOnly &out) noexcept |
| | IO source stolen, non-IO sink.
|
| |
| | Bridge (const Bridge &)=delete |
| |
| | Bridge (Bridge &&other) noexcept |
| | Move constructor.
|
| |
| | ~Bridge () noexcept |
| | Destructor.
|
| |
| Bridge & | operator= (const Bridge &)=delete |
| |
| Bridge & | operator= (Bridge &&other) noexcept |
| | Move assignment.
|
| |
| void | Close () noexcept |
| | Release owned tips.
|
| |
| bool | EoF () const noexcept |
| | Whether the read tip reports end-of-stream.
|
| |
| bool | Failed () const noexcept |
| | Whether a tip has failed for real.
|
| |
| bool | InputIsIO () const noexcept |
| | Whether the read tip is a stolen IO leaf.
|
| |
| bool | InputPullBlocking () const noexcept |
| | Whether Pumper must Blocking-pull this source.
|
| |
| enum State | State () const noexcept |
| | Session lifetime.
|
| |
| StormByte::ByteSize | Passthrough (StormByte::ByteSize n, Operation operation=Operation::Blocking) |
| | Move bytes from the read tip to the write tip.
|
| |
| const StormByte::Safe::Shared< StormByte::Buffer::ReadTelemetry > | ReadTelemetry () const noexcept |
| | Read counters.
|
| |
| const StormByte::Safe::Shared< StormByte::Buffer::WriteTelemetry > | WriteTelemetry () const noexcept |
| | Write counters.
|
| |
Manual bridge between two StormByte-Buffer ends.
Connects a read tip to a write tip. Bytes cross only when the caller invokes Passthrough. There is no worker and no occupancy cap at this layer. Continuous transfer is Pumper.
- Ownership
- Non-IO tips are ReadOnly / WriteOnly references. The buffers must outlive the Bridge. IO tips are taken by move as the concrete leaf so a second reader or writer cannot race Passthrough. Stolen leaves live in
StormByte::Safe::Unique on Base's heap.
- Lifecycle
- A Bridge is one shot. State::Open while tips are attached. Close, a consumed source EoF and move-from go to State::Closed. A real tip fault goes to State::Failed. Failed is only that last case. There is no rewind and no seek on the session. After State::Closed or State::Failed the instance cannot be re-armed; construct a new Bridge to transfer again.
Close detaches non-IO tips and releases stolen IO leaves. IO destructors close the origin, so Windows can unlink the path. In-memory tips do not lock a file. Idempotent. Close does not set Failed. A session that is already State::Failed stays Failed and still drops the tips.
- Passthrough
- One call is one atomic transfer.
TryAgain on the write tip is retried until the requested write completes or the tip fails. That is not the same as Operation::Blocking: Blocking applies only to the read side.
n == 0 is the current contents of the read tip (non-IO occupancy, or IO::BufferedReader::Available). Available on IO does not touch the origin.
If State is not State::Open, Passthrough returns 0 and does nothing. A NonBlocking call that yields zero bytes is not the end of the session.
A non-IO source that is not readable (ReadOnly::IsReadable is false, including after SetError) is a tip fault, not EoF. A closed empty source is EoF. Those two are not the same.
- Telemetry
- This Bridge always holds a
Shared copy of the read and write counters. A non-IO tip uses a basic StormByte::Buffer::ReadTelemetry / StormByte::Buffer::WriteTelemetry created here. The Bridge updates those counters on each successful transfer. An IO tip donates the leaf handle at attach. The leaf updates that object; the Bridge only caches the handle so Close does not drop it. Survivors that copied the Shared keep the last values when *this dies.
- See also
- ReadOnly, WriteOnly, IO::BufferedReader, IO::BufferedWriter