Expand description
The Tool process protocol’s frames (abi.md, The Tool process
protocol), which both sides of the exchange speak: the host, a toolkit,
and any process that implements Tools by hand. What a frame carries is in
the value encoding (flow-abi), including the answers the dispatch
seam passes, Outcome and Ack, which this crate only frames.
A frame is a number, its length in bytes, then that many bytes: one
Message, declared once with flow_abi::wire!, so its codec and
its constructor numbers come from the declaration. The reply socket, where
a client outside the host replies to a call, uses the same framing and the
same messages, and each Route admits only its own kinds
(Kind::on).
Values cross in the value encoding at their declared types, so a frame
holds them as a Rest, the bytes after the message’s head: the side
that knows the types reads them (flow_abi::read_value). What describes
them, a describe answer’s and a generic call’s type descriptions,
crosses in the value encoding too (flow_abi::TypeSpec).
read_frame reads one frame from a stream within a size limit. A frame
past the limit is not kept: its head is, its kind and, for a message that
begins with run and call (Kind::names_call), those two ids,
so that an answer too large to admit still names the call it answers
(Message::reply_head); the rest is read and dropped. Frames reads
the same frames from bytes as they arrive, for a reader that must not
block on a stream.
Structs§
- Call
- A
callframe’s fields. - Frames
- Frames read from bytes as they arrive, one by one as
read_framereads them from a stream. It holds at most one frame’s bytes within the limit, or a head’s past it: the rest of a frame past the limit is dropped as it arrives, and the frame is read once the last of it has. - Log
- A
logframe’s fields. - Reply
- A
replyframe’s fields.
Enums§
- Flags
- A
call’s flags: bit 0 says the call is generic and carries its views, a generic call’sCallTypes; bit 1 says it withdraws a held call that was closed (abi.md, Withdrawing a held call). - Frame
- One frame as
read_frameread it. - Kind
- Which message a frame holds: its kind.
- Level
- A log line’s level.
- Malformed
- Why a frame’s body is not a message.
- Message
- One message of the protocol, on either route: what one frame’s body holds. Its number is the frame’s kind.
- Route
- Where a frame travels: between the host and a Tool process, or on the
reply socket, where a client outside the host replies to a call
(
abi.md, Replies from outside a call). - Served
- What an answer to
describeserves.
Constants§
- HEAD
- The fewest bytes of a frame past the size limit
read_framewill keep for its head, however small the limit: a head is kept up to this or the limit, whichever is larger.
Functions§
- read_
frame - Reads the next frame from
input, keeping a body of at mostlimitbytes.Nonewhen the input ends before a frame begins; anio::ErrorKind::UnexpectedEofwhen it ends inside one, and anio::ErrorKind::InvalidDatawhen the length is not a number. - served
- What
described, an answer todescribe, serves: its declarations when its data version speaks with this build’s. - write_
frame - Writes
messagetooutputas one frame and flushes it.