Skip to main content

Module wire

Module wire 

Source
Expand description

Real KIP-595 peer-RPC body codec.

The engine’s loop reasons in terms of the flat PeerRequest and PeerResponse enums. This module maps each variant to and from the genuine generated KIP-595 message bodies. Those bodies are header-less, because the framing layer in server.rs and network.rs adds the request header and the response header. The captured wire versions are Vote v2, BeginQuorumEpoch v1, EndQuorumEpoch v1, and Fetch v18. Krabka-to-Krabka replication rides these exact bytes.

The metadata log is the single KRaft topic __cluster_metadata, partition 0, so every RPC body carries exactly one topic and exactly one partition. Kafka’s VoteResponse carries no pre-vote field. A candidate matches a reply to its round from its own Prospective or Candidate role, so Krabka encodes a byte-faithful VoteResponse and the core infers the round itself (KIP-996).

The shared constants and integer conversions live in codec, the request bodies in request, and the response bodies in response.

Structs§

FetchAnswer
A Fetch answer, in the one shape Kafka’s KafkaRaftClient.buildFetchResponse gives both a served fetch and a refused one.
FetchSnapshotPartition
The one partition of a FetchSnapshot answer that names a partition.
LeaderEndpoint
The host and port a leader is reached at.
PreferredCandidate
A voter that an EndQuorumEpoch names as a preferred successor.
QuorumLeader
What a quorum RPC response says about the responder’s view of the leader, as Kafka’s RaftUtil.singleton*Response helpers fill it.
SnapshotChunk
A served chunk of a snapshot.

Enums§

PeerRequest
A peer RPC request body, as encoded by the sending engine and decoded by the receiving engine’s inbound dispatch.
PeerResponse
A peer RPC response body. The sending engine decodes it back into the matching Receive*Response event, or applies it directly for Fetch.

Constants§

FETCH_SNAPSHOT_VERSION
The versions PeerRequest encodes each peer RPC at. Public because a broker-only observer sends FetchSnapshot itself, and the version on its request header has to be the one the body was encoded at.
FETCH_VERSION
The versions PeerRequest encodes each peer RPC at. Public because a broker-only observer sends FetchSnapshot itself, and the version on its request header has to be the one the body was encoded at.
QUORUM_EPOCH_VERSION
The versions PeerRequest encodes each peer RPC at. Public because a broker-only observer sends FetchSnapshot itself, and the version on its request header has to be the one the body was encoded at.
VOTE_VERSION
The versions PeerRequest encodes each peer RPC at. Public because a broker-only observer sends FetchSnapshot itself, and the version on its request header has to be the one the body was encoded at. Captured flexible wire versions, byte-validated against fixture frames.

Functions§

decode_begin
Decodes a BeginQuorumEpoch request body (api 53).
decode_end
Decodes an EndQuorumEpoch request body (api 54).
decode_fetch
Decodes a Fetch request body (api 1).
decode_fetch_snapshot
Decodes a FetchSnapshot request body (api 59).
decode_vote
Decodes a Vote request body (api 52).
encode_begin_quorum_epoch_response
Encodes a BeginQuorumEpoch response body (api 53) at version, with the same shape rules as encode_vote_response.
encode_end_quorum_epoch_response
Encodes an EndQuorumEpoch response body (api 54) at version, with the same shape rules as encode_vote_response.
encode_fetch_snapshot_answer
Encodes a FetchSnapshot response body (api 59) at version, as Kafka’s RaftUtil.singletonFetchSnapshotResponse builds it.
encode_fetch_top_level_error
Encodes Kafka’s bare top-level Fetch error response at version: new FetchResponseData().setErrorCode(error), with no topic.
encode_vote_response
Encodes a Vote response body (api 52) at version, the version of the request it answers.
fetch_replica_id
Kafka’s FetchRequest.replicaId: the top-level ReplicaId up to v14, the ReplicaState from v15.