31#include "core/bytes.h"
void encode_block(Bytes &out, ByteView body)
Append [u32 len][body] to out.
constexpr uint32_t kMaxBlockSize
body cap
Block try_take_block(const uint8_t *data, size_t size)
Try to take one block from the front of [data, data+size) without copying.
void encode_message(Bytes &out, FrameHeader header, ByteView payload)
Append [type][flags][channel][payload] to out (no length prefix).
constexpr size_t kLengthPrefixSize
constexpr size_t kHeaderSize
type+flags+channel
Message parse_message(ByteView inner)
Parse an inner message from inner (header + payload). ok false if short.
MessageType
Inner-message kind. Application traffic uses App, addressed by channel.
@ Pex
peer exchange — gossip of known peer addresses (PeerExchange)
@ Typed
typed JSON message exchange (MessageJson)
@ Storage
distributed key-value store (StorageManager)
@ Control
core control plane (peer exchange…)
@ Ping
liveness / RTT (PingService)
A decoded inner message. payload is a non-owning view into the source bytes.
ByteView body
the block body (when Ok); views the input
size_t consumed
bytes to consume from the buffer (when Ok)
enum librats::framer::Block::Status status