Skip to content

Extract streaming protocol (receiver)#3625

Merged
Tristan-Wilson merged 10 commits intomasterfrom
pmikolajczyk/data-streaming-receiver
Sep 12, 2025
Merged

Extract streaming protocol (receiver)#3625
Tristan-Wilson merged 10 commits intomasterfrom
pmikolajczyk/data-streaming-receiver

Conversation

@pmikolajczyk41
Copy link
Member

Follow-up to #3603: I extracted the receiver-side of the streaming protocol. This way, completing NIT-3515 should be trivial without any code copying.

In detail:

  • sender and receiver parts are put into separate files
  • abstracted away RPC method names from the sender
  • renamed batch to message in the data-streaming context
  • cleaner responsibilities cut:
    • messageStore maintains partial messages
    • DataStreamReceiver maintains protocol (signature validation, passing data down to messageStore)
    • DASRPCServer maintains the end server (exposes RPC endpoints, forwards queries down to DataStreamReceiver)
  • add // lint:require-exhaustive-initialization to all the related structs (to move related issue Use the struct-initialization linter more #3121 a bit forward)
  • minor refactor in the messageStore and partialMessage (previously batchBuilder and batch)

Copy link
Member

@Tristan-Wilson Tristan-Wilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

func calculateEffectiveChunkSize(maxStoreChunkBodySize int) (uint64, error) {
chunkSize := (maxStoreChunkBodySize - len(sendChunkJSONBoilerplate) - 512 /* headers */) / 2
func calculateEffectiveChunkSize(maxStoreChunkBodySize int, rpcMethods DataStreamingRPCMethods) (uint64, error) {
jsonOverhead := len("{\"jsonrpc\":\"2.0\",\"id\":4294967295,\"method\":\"\",\"params\":[\"\"]}") + len(rpcMethods.receiveChunk)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@Tristan-Wilson Tristan-Wilson merged commit 7d93da0 into master Sep 12, 2025
18 checks passed
@Tristan-Wilson Tristan-Wilson deleted the pmikolajczyk/data-streaming-receiver branch September 12, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants