Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Prefix = "im"
prefix is the root Dir of services in etcd
Functions ¶
func Register ¶
func Register(name string, rpcServerAddr string, target string, interval xtime.Duration, ttl xtime.Duration) (err error)
Register is the helper function to self-register service into Etcd/Consul server should call Unregister when pocess stop name - service name host - service host port - service port target - etcd dial address, for example: "http://127.0.0.1:2379;http://127.0.0.1:12379" interval - interval of self-register to etcd ttl - ttl of the register information
Types ¶
type EtcdResolver ¶
type EtcdResolver struct {
ServiceName string // service name to resolve
}
EtcdResolver is the implementaion of grpc.naming.Resolver
func NewResolver ¶
func NewResolver(serviceName string) *EtcdResolver
NewResolver return EtcdResolver with service name
func (*EtcdResolver) Resolve ¶
func (er *EtcdResolver) Resolve(target string) (naming.Watcher, error)
Resolve to resolve the service from etcd, target is the dial address of etcd target example: "http://127.0.0.1:2379;http://127.0.0.1:12379;http://127.0.0.1:22379"
type EtcdWatcher ¶
type EtcdWatcher struct {
// contains filtered or unexported fields
}
EtcdWatcher is the implementaion of grpc.naming.Watcher