31 lines
503 B
Go
31 lines
503 B
Go
package corrpc
|
|
|
|
import (
|
|
"gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type Client struct {
|
|
con *grpc.ClientConn
|
|
cli CoordinatorClient
|
|
pool *Pool
|
|
fusedErr *rpc.CodeError
|
|
}
|
|
|
|
func (c *Client) Release() {
|
|
if c.con != nil {
|
|
c.pool.connPool.Release(c.pool.cfg.Address)
|
|
}
|
|
}
|
|
|
|
type TempClient struct {
|
|
Client
|
|
}
|
|
|
|
func (c *TempClient) Release() {
|
|
c.con.Close()
|
|
}
|
|
|
|
// 客户端的API要和服务端的API保持一致
|
|
var _ CoordinatorAPI = (*Client)(nil)
|