This repository was archived by the owner on Nov 27, 2025. It is now read-only.
Description func UnRegister () error {
stopSignal <- true
stopSignal = make (chan bool , 1 ) // just a hack to avoid multi UnRegister deadlock
var err error
if _ , err := client .Delete (context .Background (), serviceKey ); err != nil {
log .Printf ("grpclb: deregister '%s' failed: %s" , serviceKey , err .Error ())
} else {
log .Printf ("grpclb: deregister '%s' ok." , serviceKey )
}
return err
}
var (
// Prefix should start and end with no slash
Prefix = "etcd3_naming"
client etcd3.Client
serviceKey string
stopSignal = make (chan bool , 1 )
)
func Registry (opt Opt , args ... int ) error {
serviceValue := fmt .Sprintf ("%s:%d" , opt .Host , opt .Port )
serviceKey := fmt .Sprintf ("%s/%s/%s" , Prefix , opt .Name , serviceValue )
var (
err error
client * etcd3.Client
)
if len (args ) > 0 {
client , err = etcd3 .New (etcd3.Config {
Endpoints : strings .Split (opt .Target , "," ),
})
} else {
client , err = etcd3 .NewFromURL (opt .Target )
}
... ...
}Reactions are currently unavailable