Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Responding to Broadcasts #28

Closed
dtwitty opened this issue Aug 8, 2023 · 2 comments
Closed

FR: Responding to Broadcasts #28

dtwitty opened this issue Aug 8, 2023 · 2 comments

Comments

@dtwitty
Copy link

dtwitty commented Aug 8, 2023

I really like Foca's broadcasting feature for disseminating information. However, as far as I can tell, it is missing the ability to respond to broadcasts.

As I understand it, acknowledgements are a core part of the SWIM protocol, and can be used to send information back to the requesting node. It would be nice if users could piggy-back on this to send their own information back in response to broadcasts.

The main use case I am thinking of is Anti-Entropy. For example, node A might broadcast that it has version x of the metadata. Node B knows that version x is out-of-date (from vector clocks or some other way), so it responds back to A with the up-to-date metadata.

@caio
Copy link
Owner

caio commented Aug 12, 2023

Good point! I think we can enable this simply by adding sender visibility to the BroadcastHandler trait (guessing we'd need visibility for when Invalidates comes in to play too); Then when you detect this you simply foca.add_broadcast and let the periodic probing/gossiping take care of the dissemination for you.

I think adding a variant of broadcast to send it to a specific member could help too.

It won't be able to accommodate a use-case where you want to send the missing data only to node B since (in foca) broadcasting relies on the same mechanisms that we use to disseminate cluster updates (repeated transmissions to random targets), but I think this particular case is way better served externally where you can get a bi-directional stream between members and do a full sync without caring for packet size and whatnot.

Thoughts?

@caio
Copy link
Owner

caio commented Sep 3, 2023

I've released v0.14.0 which contains a change that allows broadcast handlers to know who sent the data they're dealing with:

https://docs.rs/foca/0.14.0/foca/trait.BroadcastHandler.html#tymethod.receive_item

Feel free to reopen with more details if that's not enough for your usecase.

@caio caio closed this as completed Sep 3, 2023
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

No branches or pull requests

2 participants