Skip to main content

Crate flow_tool_protocol

Crate flow_tool_protocol 

Source
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 call frame’s fields.
Frames
Frames read from bytes as they arrive, one by one as read_frame reads 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 log frame’s fields.
Reply
A reply frame’s fields.

Enums§

Flags
A call’s flags: bit 0 says the call is generic and carries its views, a generic call’s CallTypes; bit 1 says it withdraws a held call that was closed (abi.md, Withdrawing a held call).
Frame
One frame as read_frame read 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 describe serves.

Constants§

HEAD
The fewest bytes of a frame past the size limit read_frame will 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 most limit bytes. None when the input ends before a frame begins; an io::ErrorKind::UnexpectedEof when it ends inside one, and an io::ErrorKind::InvalidData when the length is not a number.
served
What described, an answer to describe, serves: its declarations when its data version speaks with this build’s.
write_frame
Writes message to output as one frame and flushes it.