pool

package
v0.0.0-...-f62d9cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxConn = fmt.Errorf("maximum connections reached")

Functions

This section is empty.

Types

type ConnPool

type ConnPool struct {
	sync.RWMutex

	Name    string
	Address string
	MaxConn int32
	MaxIdle int32
	Cnt     int64

	New func(name string) (NConn, error)
	// contains filtered or unexported fields
}

conn pool

func NewConnPool

func NewConnPool(name string, address string, maxConn int32, maxIdle int32) *ConnPool

func (*ConnPool) Destroy

func (u *ConnPool) Destroy()

func (*ConnPool) Fetch

func (u *ConnPool) Fetch() (NConn, error)

func (*ConnPool) ForceClose

func (u *ConnPool) ForceClose(conn NConn)

func (*ConnPool) Proc

func (u *ConnPool) Proc() string

func (*ConnPool) Release

func (u *ConnPool) Release(conn NConn)

type NConn

type NConn interface {
	io.Closer
	Name() string
	Closed() bool
}

type RpcClient

type RpcClient struct {
	// contains filtered or unexported fields
}

func NewRpcClient

func NewRpcClient(cli *rpc.Client, name string) *RpcClient

func NewRpcClientWithCodec

func NewRpcClientWithCodec(codec rpc.ClientCodec, name string) *RpcClient

func (RpcClient) Call

func (u RpcClient) Call(method string, args interface{}, reply interface{}) error

func (RpcClient) Close

func (u RpcClient) Close() error

func (RpcClient) Closed

func (u RpcClient) Closed() bool

func (RpcClient) Name

func (u RpcClient) Name() string

type RpcConnPools

type RpcConnPools struct {
	sync.RWMutex
	M           map[string]*ConnPool
	MaxConn     int
	MaxIdle     int
	ConnTimeout int
	CallTimeout int
}

func CreateRpcConnPools

func CreateRpcConnPools(maxConn, maxIdle, connTimeout, callTimeout int, cluster []string) *RpcConnPools

func (*RpcConnPools) Call

func (u *RpcConnPools) Call(addr, method string, args interface{}, resp interface{}) error

func (*RpcConnPools) Destroy

func (u *RpcConnPools) Destroy()

func (*RpcConnPools) Get

func (u *RpcConnPools) Get(address string) (*ConnPool, bool)

func (*RpcConnPools) Proc

func (u *RpcConnPools) Proc() []string

type TsDBClient

type TsDBClient struct {
	// contains filtered or unexported fields
}

func (TsDBClient) Close

func (u TsDBClient) Close() error

func (TsDBClient) Closed

func (u TsDBClient) Closed() bool

func (TsDBClient) Name

func (u TsDBClient) Name() string

type TsDBConnPools

type TsDBConnPools struct {
	// contains filtered or unexported fields
}

func NewTsDBConnPool

func NewTsDBConnPool(address string, maxConn, maxIdle, connTimeout, callTimeout int) *TsDBConnPools

func (*TsDBConnPools) Destroy

func (t *TsDBConnPools) Destroy()

func (*TsDBConnPools) Send

func (t *TsDBConnPools) Send(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL