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

add GossiperMaker, GetGossip(), and UTs #119

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

britterm
Copy link

@britterm britterm commented Sep 23, 2019

This PR adds support for custom surrogate Gossiper implementations, as well as the ability to access surrogate Gossip channels.

If a GossiperMaker is not set, or the assigned GossiperMaker returns nil, the default surrogate implementation will be used for that channel.

This change will allow mesh clients to dynamically provision Gossipers for channels instead of defining them all up-front. An example use case would be to use channels as dynamic "namespaces" for data feeds. The data in the feeds could all be the same, or the channel name could indicate what type of data is in the feed. The GossiperMaker could assign different Gossipers to each channel as they are discovered. These channels would be retrievable and usable with the new GetGossip() method on the router.

~/Development/workspace/git/forks/mesh master
❯ go build

~/Development/workspace/git/forks/mesh master
❯ go test
->[|02:00:00:02:00:00(nick)]: connection added (new peer)
->[|02:00:00:02:00:00(nick)]: connection fully established
->[|01:00:00:01:00:00(nick)]: connection added (new peer)
->[|01:00:00:01:00:00(nick)]: connection fully established
->[|03:00:00:03:00:00(nick)]: connection added (new peer)
->[|03:00:00:03:00:00(nick)]: connection fully established
->[|02:00:00:02:00:00(nick)]: connection added (new peer)
->[|02:00:00:02:00:00(nick)]: connection fully established
->[|01:00:00:01:00:00(nick)]: connection added
->[|01:00:00:01:00:00(nick)]: connection fully established
->[|03:00:00:03:00:00(nick)]: connection added
->[|03:00:00:03:00:00(nick)]: connection fully established
->[|03:00:00:03:00:00(nick)]: connection deleted
->[|03:00:00:03:00:00(nick)]: connection deleted
->[|02:00:00:02:00:00(nick)]: connection added (new peer)
->[|02:00:00:02:00:00(nick)]: connection fully established
->[|01:00:00:01:00:00(nick)]: connection added (new peer)
->[|01:00:00:01:00:00(nick)]: connection fully established
->[|02:00:00:02:00:00(nick)]: connection added (new peer)
->[|02:00:00:02:00:00(nick)]: connection fully established
->[|03:00:00:03:00:00(nick)]: connection added (new peer)
->[|03:00:00:03:00:00(nick)]: connection fully established
->[|02:00:00:02:00:00(nick)]: connection added (new peer)
->[|02:00:00:02:00:00(nick)]: connection fully established
->[|01:00:00:01:00:00(nick)]: connection added (new peer)
->[|01:00:00:01:00:00(nick)]: connection fully established
->[|02:00:00:02:00:00(nick)]: connection added (new peer)
->[|02:00:00:02:00:00(nick)]: connection fully established
->[|03:00:00:03:00:00(nick)]: connection added (new peer)
->[|03:00:00:03:00:00(nick)]: connection fully established
PASS
ok  	_/Users/britterm/Development/workspace/git/forks/mesh	0.172s

@britterm britterm marked this pull request as ready for review September 23, 2019 14:58
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