This commit is contained in:
man00k
2026-01-30 16:49:29 +08:00
parent 83c1e36469
commit 959901fcad
15 changed files with 190 additions and 24 deletions

View File

@@ -1,10 +1,10 @@
package qgrpc
import (
"code.infininov.com/Infini/unitech-golib/qgrpc/ping"
"code.infininov.com/Infini/unitech-golib/tlog"
"context"
"fmt"
"github.com/MAN00K/unitech_golib/qgrpc/ping"
"github.com/MAN00K/unitech_golib/tlog"
"github.com/coreos/etcd/clientv3"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
@@ -87,7 +87,7 @@ func NewClient(cfg *ClientConfig) (client *Client, err error) {
return
}
//user.User|127.0.0.1:9011 -> Server{Name: user.User Addrs: []string{127.0.0.1:9011}}
// user.User|127.0.0.1:9011 -> Server{Name: user.User Addrs: []string{127.0.0.1:9011}}
func ParseServerName(serverName string) *RpcServer {
ss := strings.Split(serverName, "|")
s := &RpcServer{Name: ss[0]}
@@ -101,12 +101,12 @@ func ParseServerName(serverName string) *RpcServer {
return s
}
//根据server-name 获得对应的连接池
// 根据server-name 获得对应的连接池
func (self *Client) GetConn(serverName string) *grpc.ClientConn {
return self.rpcServers[serverName]
}
//从etcd注销
// 从etcd注销
func (self *Server) Revoke() error {
_, err := self.etcdCli.Revoke(context.Background(), self.etcdId)
return err

View File

@@ -1,8 +1,8 @@
package qgrpc
import (
"code.infininov.com/Infini/unitech-golib/tlog"
"context"
"github.com/MAN00K/unitech_golib/tlog"
"github.com/coreos/etcd/clientv3"
"path"
"time"