Expand description
The wire format core and helpers agree on.
Everything here is data: no process is spawned and no compiler is linked. A helper binary depends on this module to speak the protocol and on nothing else of codehelion, which is what keeps a toolchain dependency from reaching the analysis crates.
§Framing
Messages travel over the helper’s standard input and output as
length-prefixed frames: a four-byte big-endian payload length, a one-byte
encoding tag, then the payload. The tag exists so that compiler IR too large
to be worth serializing as text can travel as bytes later without changing
how a frame is found in the stream — only Encoding gains a variant.
A frame carries its own length so a reader never has to guess where a
message ends, and never has to trust the sender’s promise about total
volume: MAX_FRAME_BYTES bounds what one frame may ask a reader to
allocate, so a helper that has gone wrong cannot exhaust memory before it is
noticed.
Structs§
- Analyze
- One unit to analyze, and what is wanted from it.
- Build
Description - The conditions a tree’s code is analyzed under.
- Client
Identity - Who is connecting, and which revisions it can speak.
- Compile
Command Selector - One stable, exact selector for an entry in
compile_commands.json. - Describe
Build - The tree whose build is being asked about.
- Failure
- Why a request could not be answered.
- Helper
Identity - What a helper says about itself.
- Request
- A message from core to a helper.
- Response
- A message from a helper to core.
Enums§
- Absence
- What a run does when a helper cannot supply a capability.
- Capability
- Something a helper can be asked for.
- Encoding
- How a frame’s payload is encoded.
- Execution
- Something a helper may be permitted to run out of the project it is analyzing.
- Frame
Error - Something that went wrong reading or writing a frame.
- Request
Body - The askable things.
- Response
Body - The answers.
Constants§
- MAX_
FRAME_ BYTES - Largest payload a single frame may declare.
- PROTOCOL_
VERSION - The only protocol revision this build speaks.
Functions§
- read_
frame - Read one frame and parse it.
- write_
frame - Write
valueas one JSON frame.