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 a new module to watch host-file #425

Open
BinChang opened this issue Jun 24, 2016 · 2 comments
Open

Add a new module to watch host-file #425

BinChang opened this issue Jun 24, 2016 · 2 comments

Comments

@BinChang
Copy link

To use tChannel in a peer-to-peer fashion, without hyperbanh, we usually store server nodes in a host-file. A host-file watcher like (uber/tchannel-node#325) will things much easier. Several services in Uber (especially in marketplace) could benefit from this.

This is sort of urgent, I could draft a PR if you guys are all busy with more important stuff.

@prashantv
Copy link
Contributor

@BinChang would be great if you could draft a PR for this. The core TChannel library provides this PeerList object which lets others manage peers:
https://godoc.org/github.com/uber/tchannel-go#Channel.Peers

I think file watching logic should not live inside of the core tchannel-go package, but in a separate subpackage. I would expect some API like:

import "github.com/uber/tchannel-go/peermanager"

// assume we have an existing channel, ch
hostWatcher, err := peermanager.NewFileSyncer(ch.Peers(), "hosts.json")

This would then spin up a goroutine that would watch the hosts file, and manage calls to Peers.Add and Peers.Remove when the file has changed.

Let me know if you have any questions. I'll send you a link to some internal peer updaters we have as well.

@BinChang
Copy link
Author

SGTM.

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