Owns a Bridge and moves bytes until EoF, failure or Cancel.
More...
#include <StormByte/buffer/pumper.hxx>
Owns a Bridge and moves bytes until EoF, failure or Cancel.
Starts the worker in the constructor. The destructor joins; it may block until the current cycle finishes. There is no Stop. The destructor does not Cancel: it lets the worker finish. Cancel is terminal (Canceled, no restart). Toggle pauses and resumes. Failed is only a real Bridge fault.
- HighWater
- Caps how much the worker will pull from the input.
nullopt (omitted knob): IO source → 0; non-IO source → backend default (constexpr in the .cxx). Explicit 0: no Pumper cap. Use 0 only when the source is an IO leaf that already limits itself. Non-IO sources are unbounded by design; omitting HighWater is the safe default. 0 on a non-IO source is the caller's choice.
- Chunk
- Bytes the worker asks Bridge::Passthrough per cycle.
0 is automatic chunking, not Bridge's "current contents". The backend never asks for 0 bytes: a Blocking IO pull of 0 would not touch the origin.
- IO pull
- If the owned Bridge reports Bridge::InputPullBlocking (stolen reader with IO::BufferedReader::ReadAhead of 0), the worker uses Bridge::Operation::Blocking. Otherwise it uses Bridge::Operation::NonBlocking.
- Telemetry
- Copies the Bridge handles at construction. Those
Shared objects stay valid after Cancel and after *this dies if the caller kept a copy. No extra counters.
An IO path stays locked while this Pumper is alive. After Cancel the owned Bridge is Closed.
◆ Pumper() [1/3]
Take a Bridge and start the worker.
- Parameters
-
| bridge | Owned bridge. Moved-from is empty. |
| parameters | Omitted knobs keep the office default. |
◆ Pumper() [2/3]
| StormByte::Buffer::Pumper::Pumper |
( |
const Pumper & |
| ) |
|
|
delete |
◆ Pumper() [3/3]
| StormByte::Buffer::Pumper::Pumper |
( |
Pumper && |
other | ) |
|
|
noexcept |
Move constructor.
Moved-from is empty and joined.
- Parameters
-
| other | Instance to take from. |
◆ ~Pumper()
| StormByte::Buffer::Pumper::~Pumper |
( |
| ) |
|
|
noexcept |
Destructor.
Joins the worker. Does not Cancel.
◆ Cancel()
| void StormByte::Buffer::Pumper::Cancel |
( |
| ) |
|
|
noexcept |
Terminal stop.
Sets Canceled. Closes the Bridge.
Idempotent. Does not set Failed. The worker will not resume. Construct a new Pumper to transfer again.
◆ Canceled()
| bool StormByte::Buffer::Pumper::Canceled |
( |
| ) |
const |
|
noexcept |
Whether Cancel ran.
- Returns
- Sticky. A canceled Pumper cannot be resumed.
◆ EoF()
| bool StormByte::Buffer::Pumper::EoF |
( |
| ) |
const |
|
noexcept |
Whether the owned Bridge reports EoF.
- Returns
true on EoF or if moved-from.
◆ Failed()
| bool StormByte::Buffer::Pumper::Failed |
( |
| ) |
const |
|
noexcept |
Whether the owned Bridge failed for real.
- Returns
- Sticky. Not set by Cancel or move-from.
◆ operator=() [1/2]
| Pumper & StormByte::Buffer::Pumper::operator= |
( |
const Pumper & |
| ) |
|
|
delete |
◆ operator=() [2/2]
| Pumper & StormByte::Buffer::Pumper::operator= |
( |
Pumper && |
other | ) |
|
|
noexcept |
Move assignment.
Moved-from is empty and joined.
- Parameters
-
| other | Instance to take from. |
- Returns
- *this.
◆ ReadTelemetry()
Read counters copied from the owned Bridge.
- Returns
- Const shared handle. Empty if moved-from.
◆ Toggle()
| void StormByte::Buffer::Pumper::Toggle |
( |
| ) |
|
|
noexcept |
◆ WriteTelemetry()
Write counters copied from the owned Bridge.
- Returns
- Const shared handle. Empty if moved-from.
The documentation for this class was generated from the following file: