conn_pool

package
v3.14.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 3

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
	MaxConns int
	MaxIdle  int
	Cnt      int64
	New      func(name string) (NConn, error)
	// contains filtered or unexported fields
}

func NewConnPool

func NewConnPool(name string, address string, maxConns int, maxIdle int) *ConnPool

func (*ConnPool) Destroy

func (this *ConnPool) Destroy()

func (*ConnPool) Fetch

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

func (*ConnPool) ForceClose

func (this *ConnPool) ForceClose(conn NConn)

func (*ConnPool) Proc

func (this *ConnPool) Proc() string

func (*ConnPool) Release

func (this *ConnPool) Release(conn NConn)

type InfluxdbClient

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

InfluxdbClient, 要实现io.Closer接口

func (InfluxdbClient) Call

func (this InfluxdbClient) Call(items []*cmodel.JudgeItem) error

func (InfluxdbClient) Close

func (this InfluxdbClient) Close() error

func (InfluxdbClient) Closed

func (this InfluxdbClient) Closed() bool

func (InfluxdbClient) Name

func (this InfluxdbClient) Name() string

type InfluxdbConnPools

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

ConnPools Manager

func CreateInfluxdbConnPools

func CreateInfluxdbConnPools(maxConns, maxIdle, connTimeout, callTimeout int, cluster []InfluxdbConnection) *InfluxdbConnPools

func (*InfluxdbConnPools) Call

func (this *InfluxdbConnPools) Call(addr string, items []*cmodel.JudgeItem) error

同步发送, 完成发送或超时后 才能返回

func (*InfluxdbConnPools) Destroy

func (this *InfluxdbConnPools) Destroy()

func (*InfluxdbConnPools) Get

func (this *InfluxdbConnPools) Get(address string) (*ConnPool, bool)

func (*InfluxdbConnPools) Proc

func (this *InfluxdbConnPools) Proc() []string

type InfluxdbConnection

type InfluxdbConnection struct {
	Address  string
	Username string
	Password string
	Protocol string
	DBName   string
}

func (InfluxdbConnection) GetURL

func (this InfluxdbConnection) GetURL() string

type NConn

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

type RpcClient

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

RpcCient, 要实现io.Closer接口

func (RpcClient) Call

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

func (RpcClient) Close

func (this RpcClient) Close() error

func (RpcClient) Closed

func (this RpcClient) Closed() bool

func (RpcClient) Name

func (this RpcClient) Name() string

type SafeRpcConnPools

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

ConnPools Manager

func CreateSafeRpcConnPools

func CreateSafeRpcConnPools(maxConns, maxIdle, connTimeout, callTimeout int, cluster []string) *SafeRpcConnPools

func (*SafeRpcConnPools) Call

func (this *SafeRpcConnPools) Call(addr, method string, args interface{}, resp interface{}) error

同步发送, 完成发送或超时后 才能返回

func (*SafeRpcConnPools) Destroy

func (this *SafeRpcConnPools) Destroy()

func (*SafeRpcConnPools) Get

func (this *SafeRpcConnPools) Get(address string) (*ConnPool, bool)

func (*SafeRpcConnPools) Proc

func (this *SafeRpcConnPools) Proc() []string

type StagingConnPoolHelper

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

func NewStagingConnPoolHelper

func NewStagingConnPoolHelper(address string, maxConns, maxIdle, connTimeout, callTimeout int) *StagingConnPoolHelper

func (*StagingConnPoolHelper) Call

func (this *StagingConnPoolHelper) Call(method string, args interface{}, resp interface{}) error

A synchronous call; return if completed or time-out

func (*StagingConnPoolHelper) Destroy

func (this *StagingConnPoolHelper) Destroy()

type TsdbClient

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

TSDB

func (TsdbClient) Close

func (this TsdbClient) Close() error

func (TsdbClient) Closed

func (this TsdbClient) Closed() bool

func (TsdbClient) Name

func (this TsdbClient) Name() string

type TsdbConnPoolHelper

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

func NewTsdbConnPoolHelper

func NewTsdbConnPoolHelper(address string, maxConns, maxIdle, connTimeout, callTimeout int) *TsdbConnPoolHelper

func (*TsdbConnPoolHelper) Destroy

func (this *TsdbConnPoolHelper) Destroy()

func (*TsdbConnPoolHelper) Send

func (this *TsdbConnPoolHelper) Send(data []byte) (err error)

Jump to

Keyboard shortcuts

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