Expand description
The plugin traits and the contexts they are driven through.
The lifecycle is four calls and two contexts. PluginFactory::build runs
once per direction per connection with a BuildCtx: this is where config
is deserialized, side channels are reserved, and anything derived from the
stage’s fixed position is cached. Plugin::on_bytes then runs per chunk
with a Ctx, Plugin::on_tick runs on a schedule the stage asks for,
and Plugin::on_eof once at the end: the last chance for a stage holding
buffered bytes to emit them, and where a codec writes its epilogue.
The split between the two contexts is the point: everything expensive or fallible belongs to build time, so the per-chunk path is a synchronous call that either forwards a slice or writes into a buffer.
A call emits one unit by default, however many times it forwards: the
pieces concatenate, and the host delivers them as one write. A stage that
needs them kept apart says so with Ctx::boundary, which is what turns a
stage that merely accumulates bytes into one that records them.
Modules§
- exports
- The names a guest exports, so that a host looks them up from the same place a guest is documented against.
Structs§
- Build
Ctx - Handed to a
PluginFactorywhile constructing one instance. - Ctx
- Handed to a plugin for each chunk.
- Emission
- What one call to a stage produced: the bytes it emitted, how they are framed, and what it asked the host to do about its own schedule.
- External
Stage - A subprocess to run as a stage, with the relay’s bytes on its stdin and its stdout continuing downstream.
- LogRecord
- One queued log record: a level, and a string in the guest’s memory.
- Outbox
- What a call left behind for the host.
- Pipeline
Meta - Static description of the path a pipeline instance sits on.
- Stage
Info - Where a stage sits in its pipeline, and what it is called.
Enums§
- Boundaries
- What a stage does to the message boundaries passing through it.
- Emit
- What a stage decided to do with the chunk it was given.
- Execution
- Where the host runs a stage.
- Level
- Severity of a queued log record, in the order every logging library writes them.
- LogLevel
- Severity of a record a stage asked the host to log.
- Needs
- What a stage needs of the path it is placed on.
- Stage
- What a factory produced.
- Stderr
Mode - What to do with a child’s stderr.
Constants§
- TOCAT_
ABI_ VERSION - Bumped for any change to what the host reads or to what a value means: the struct below, the set of exports, or the interpretation of either. A guest reporting a different version is refused when it loads rather than being read as garbage.
- TOCAT_
BOUNDARIES_ FUSE - The units this stage was given do not reach the stage below. Anything that buffers across calls, splits, or coalesces.
- TOCAT_
BOUNDARIES_ MASK - Mask for the boundary effect in
tocat_boundaries: bits 0 and 1. - TOCAT_
BOUNDARIES_ PRESERVE - One unit in, one unit out.
- TOCAT_
BOUNDARIES_ SEAL - One unit in, one unit out, and the boundary is also written into the bytes,
so it survives a stage below that fuses. What
framedoes. - TOCAT_
BOUNDARIES_ SPLIT - The units below are read out of the bytes rather than inherited from above,
so the ones from above do not survive. What
unframedoes. - TOCAT_
DEBUG - TOCAT_
EMIT_ BUFFERED - Forward
bytes, framed bybounds. - TOCAT_
EMIT_ PASSTHROUGH - Forward the input unchanged. The host does not read the guest’s bytes at all, and nothing is copied in either direction.
- TOCAT_
EMIT_ PENDING - Forward nothing. Emitting nothing means the same thing; this exists so that a filter can say it on purpose.
- TOCAT_
ERROR - TOCAT_
FLAG_ ERROR - Fail the path, with
messageas the reason. - TOCAT_
FLAG_ HALT - End the path: upstream end of stream arriving early, and a success.
- TOCAT_
FLAG_ PACE - Wait
pace_nsbefore reading upstream again. - TOCAT_
FLAG_ REARM - Restart this stage’s tick schedule from now.
- TOCAT_
INFO - TOCAT_
LOG_ RECORD_ LEN - Bytes per record in the log array.
- TOCAT_
NEEDS_ BOTH - Both of the above.
- TOCAT_
NEEDS_ DOWNSTREAM - The units this stage emits must reach the endpoint below or a
TOCAT_BOUNDARIES_SEALstage, or what it emitted cannot be read back. - TOCAT_
NEEDS_ MASK - Mask for the requirement in
tocat_boundaries: bits 2 and 3. - TOCAT_
NEEDS_ NOTHING - The stage works on any path.
- TOCAT_
NEEDS_ UPSTREAM - Every call must carry one whole message, so boundaries have to reach this
stage from the endpoint above or from a
TOCAT_BOUNDARIES_SPLITstage. - TOCAT_
OUTBOX_ LEN - Bytes the host reads at
tocat_outbox(). - TOCAT_
TRACE - TOCAT_
WARN
Traits§
- Effect
Sink - Collects the side effects a plugin asks for during one call.
- Plugin
- One stage of a pipeline. Instances are per-direction and per-connection.
- Plugin
Factory - Constructs
Plugininstances from a declared entry.
Functions§
- pack_
boundaries - Pack what
tocat_boundariesreturns. - unpack_
boundaries - Read what
tocat_boundariesreturned.