Replace legacy SendMsg/RecvMsg with type-safe Send/Recv on NodeStream#255
Draft
Replace legacy SendMsg/RecvMsg with type-safe Send/Recv on NodeStream#255
Conversation
Contributor
|
Here's the code health analysis summary for commits Analysis Summary
|
- Add payload and msg_type fields to ordering.Metadata proto - Regenerate proto files - Add toMetadata/fromMetadata conversion methods in encoding.go - Remove custom Codec, ContentSubtype, and init() codec registration - Update server.go to use srv.Send/srv.Recv - Update channel.go to use stream.Send/stream.Recv - Update channel.getStream() to return typed stream - Remove grpc.CallContentSubtype from mgr.go - Remove codec registration from test init() functions Co-authored-by: meling <810999+meling@users.noreply.github.com>
…obust Co-authored-by: meling <810999+meling@users.noreply.github.com>
Co-authored-by: meling <810999+meling@users.noreply.github.com>
Co-authored-by: meling <810999+meling@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor legacy use of RecvMsg and SendMsg in NodeStream
Replace legacy SendMsg/RecvMsg with type-safe Send/Recv on NodeStream
Feb 7, 2026
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.
server.goandchannel.gocallSendMsg/RecvMsgonBidiStreamingServerandBidiStreamingClient, which bypasses the type-safeSend/Recvmethods and violates the gRPC documentation: "No other methods in the ServerStream should be called directly." This was required by the custom gRPC codec that packedMetadata+ application message into a custom wire format.Approach
Embed the application message payload directly in
ordering.Metadata, eliminating the custom codec entirely. gRPC now uses the standard proto codec.Proto changes
bytes payload = 5anduint32 msg_type = 6toMetadatato carry the serialized application message and direction (request/response)Runtime changes
encoding.go: ReplacedCodec,ContentSubtype,init()registration, andnewMessage()with two conversion functions:toMetadata()— serializes application message intoMetadata.payloadfor sendingfromMetadata()— reconstructsMessagefrom receivedMetadatausing proto registry lookupserver.go:srv.SendMsg(msg)→srv.Send(md),srv.RecvMsg(req)→srv.Recv()channel.go:stream.SendMsg(req.msg)→stream.Send(md),stream.RecvMsg(resp)→stream.Recv();getStream()now returns typedordering.Gorums_NodeStreamClientinstead ofgrpc.ClientStreammgr.go: Removedgrpc.CallContentSubtype(ContentSubtype)from default dial optionsTest cleanup
init()blocks fromserver_test.go,config_test.go,rpc_test.go,mgr_test.goTestManagerLoggingassertion robust against line number changeschannel_test.gostream comparison typesNet result: -35 lines, no custom codec, type-safe stream operations throughout.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.