pool

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAll

func CloseAll()

CloseAll closed all connection and destroys the pool

func FreeClusterConn added in v1.5.2

func FreeClusterConn()

func InitClusterConn added in v1.5.2

func InitClusterConn(hosts [][]string, port int, db, username, password, dsnParams string, secure, skipVerify bool, maxOpenConns int) (err error)

Each shard has a clickhouse.Conn which connects to one replica inside the shard. We need more control than replica single-point-failure.

func NumShard added in v1.5.2

func NumShard() (cnt int)

Types

type ShardConn added in v1.5.2

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

ShardConn a datastructure for storing the clickhouse connection

func GetShardConn added in v1.5.2

func GetShardConn(batchNum int64) (sc *ShardConn)

GetShardConn select a clickhouse shard based on batchNum

func (*ShardConn) Close added in v1.5.2

func (sc *ShardConn) Close()

Close closes the current replica connection

func (*ShardConn) GetReplica added in v1.5.2

func (sc *ShardConn) GetReplica() (replica string)

GetReplica returns the replica to which db connects

func (*ShardConn) NextGoodReplica added in v1.5.2

func (sc *ShardConn) NextGoodReplica(failedVer int) (db clickhouse.Conn, dbVer int, err error)

NextGoodReplica connects to next good replica

Jump to

Keyboard shortcuts

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