|
- package clirpc
-
- import (
- "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
- "google.golang.org/grpc"
- )
-
- type Client struct {
- con *grpc.ClientConn
- cli ClientClient
- fusedErr *rpc.CodeError
- }
-
- func NewClient(con *grpc.ClientConn) *Client {
- return &Client{
- con: con,
- cli: NewClientClient(con),
- }
- }
-
- func NewFusedClient(err *rpc.CodeError) *Client {
- return &Client{
- fusedErr: err,
- }
- }
-
- type PoolClient struct {
- Client
- pool *Pool
- }
-
- func (c *PoolClient) Release() {
- if c.con != nil {
- c.pool.connPool.Release(c.pool.cfg.Address)
- }
- }
-
- type TempClient struct {
- Client
- }
-
- func (c *TempClient) Release() {
- c.con.Close()
- }
|