1 Star 0 Fork 0

simon / smallnest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
peer2peer_discovery.go 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
simon 提交于 2021-09-04 14:58 . 旧版
package client
// Peer2PeerDiscovery is a peer-to-peer service discovery.
// It always returns the static server.
type Peer2PeerDiscovery struct {
server string
metadata string
}
// NewPeer2PeerDiscovery returns a new Peer2PeerDiscovery.
func NewPeer2PeerDiscovery(server, metadata string) (ServiceDiscovery, error) {
return &Peer2PeerDiscovery{server: server, metadata: metadata}, nil
}
// Clone clones this ServiceDiscovery with new servicePath.
func (d *Peer2PeerDiscovery) Clone(servicePath string) (ServiceDiscovery, error) {
return d, nil
}
// SetFilter sets the filer.
func (d *Peer2PeerDiscovery) SetFilter(filter ServiceDiscoveryFilter) {
}
// GetServices returns the static server
func (d *Peer2PeerDiscovery) GetServices() []*KVPair {
return []*KVPair{&KVPair{Key: d.server, Value: d.metadata}}
}
// WatchService returns a nil chan.
func (d *Peer2PeerDiscovery) WatchService() chan []*KVPair {
return nil
}
func (d *Peer2PeerDiscovery) RemoveWatcher(ch chan []*KVPair) {}
func (d *Peer2PeerDiscovery) Close() {
}
1
https://gitee.com/simon_git_code/smallnest.git
git@gitee.com:simon_git_code/smallnest.git
simon_git_code
smallnest
smallnest
e483c3e07d35

搜索帮助

53164aa7 5694891 3bd8fe86 5694891