Expand description
Frames: a big-endian u32 length, then that many bytes of CBOR.
Enums§
Constants§
- MAX_
FRAME - The largest frame a peer accepts. Requests and replies are metadata; a page of items is far smaller. The limit keeps a peer from making the other allocate without bound.
- MAX_
REPLY - RPC replies can span frames, but never exceed this aggregate budget.
- MAX_
REQUEST_ TYPE - The most characters of a request’s
typethatrequest_typeandrpc_request_typeread: a client chooses it, up to a whole frame of it, and every type the protocol has is far shorter.
Functions§
- decode
- Decode one frame’s payload.
- encode
- Encode
valueas one frame’s payload. - encode_
limited - Encode without allocating past
limit, including for an oversized value. - encoded_
len - How many bytes
valueencodes to, without keeping them: what a page’s budget is measured against. - read_
frame - read_
frame_ bytes - Read one frame’s payload, refusing an oversized one before reading it.
- read_
frame_ bytes_ within - As
read_frame_bytes, refusing a frame longer thanmax(at mostMAX_FRAME) before anything is allocated for it. - read_
frame_ within - As
read_frame, refusing a frame longer thanmax. - read_
reply - read_
reply_ within - As
read_reply, refusing a reply longer thanmax(at mostMAX_REPLY) once its length is read, before any of it is held: what a request whose answer has a smaller bound of its own reads it with. - request_
type - The
typeof a request payload, even one this build cannot decode, so the server can name it incrate::Error::Unsupported. - rpc_
request_ type - Extract a request tag from the mandatory RPC wrapper, including unknown tags.
- write_
frame - Write
valueas one frame. One overMAX_FRAMEis refused before anything is written, so the writer can send something else instead. - write_
reply - RPC reply: total encoded length, followed by length-prefixed chunks. The complete message is checked before any bytes are written.