Skip to content

Partial Messages: Generic PeerState and Iterator style publish#674

Open
MarcoPolo wants to merge 3 commits intosimplify-partial-messagesfrom
partialmsgs-generic-iter
Open

Partial Messages: Generic PeerState and Iterator style publish#674
MarcoPolo wants to merge 3 commits intosimplify-partial-messagesfrom
partialmsgs-generic-iter

Conversation

@MarcoPolo
Copy link
Contributor

Worth reviewing commit by commit and with a focus on partialmsgs.go

@MarcoPolo MarcoPolo requested a review from sukunrt February 17, 2026 01:07
@MarcoPolo MarcoPolo force-pushed the partialmsgs-generic-iter branch from f299bad to 2dc2470 Compare February 17, 2026 01:11
@MarcoPolo MarcoPolo force-pushed the partialmsgs-generic-iter branch from 2dc2470 to 13a9c3a Compare February 18, 2026 19:53
Comment on lines 189 to 204
@@ -191,6 +203,45 @@ func WithPartialMessagesExtension(pm *partialmessages.PartialMessagesExtension)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Should this be per topic?
Here we require all topics with partial messages to use PeerState as the state type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Possibly, but I think that's worth doing separately. For now we have the same PeerState across all topics.

extensions.go Outdated
return
}

resp <- pme.PublishPartial(topic, message, opts)
Copy link
Member

Choose a reason for hiding this comment

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

I don't like the control flow.

app => pubsub loop => app => sendRPC

But I see why you had to do this given the current gossipsub single goroutine system. IIUC, you can't give the app an iterator for (peer, peerstate) without copying all the state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's correct that I would have to copy the state if I wanted to give the list of peers and peerstate to the application.

But I don't think this pattern is that uncommon. Specifically the pattern of calling a function with a function parameter that you expect to be used by the function you are calling. slices.SortFunc comes to mind, but I'm sure there are many other examples.

The latest commit hopefully makes this clearer by making the PublishActions a function type that is passed into to PublishPartial.

We only need a single function from the application. Have the
application provide this function in PublishPartial instead of a
interface type.
@MarcoPolo MarcoPolo force-pushed the partialmsgs-generic-iter branch from 13a9c3a to f1f43c3 Compare February 20, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments