Add topic_data writer with wire-format tests#12
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
writer.topic_datatoprotocol.zig, completing the producer-side serialization of a Produce request's topic data.Per the Produce request spec (
topic_data => topic_id (partition_data)),topic_datais a COMPACT array. The writer mirrors the existingwriter.partition_data: it writes the element count as a compact array size, then for each topic writes the 16-byte UUIDtopic_idfollowed by thepartition_datacompact array (delegating topartition_data).Why
produce_reqalready serializes the fixed part of the request, andpartition_dataserializes a partition array, but there was no function to write the topic data array that sits between them on the wire. This fills that gap so the Produce request body can be fully serialized.Tests
Two wire-format tests in the exact-bytes style of the existing
partition_datatests:topic_data writes count, ids, and partition_data— one topic with two partitions (one with records, one with null records), asserting the array count, UUID, and nested partition bytes.topic_data writes empty array— asserts just the compact array size (0x01) for zero topics.zig build test --summary all→ 26/26 pass;zig buildis clean.Scope
Writer only, no reader — mirroring the deliberately writer-only
partition_data. Noclient.zig/klog.zigwiring; left for a follow-up.