pool

package
v5.0.0-...-0775b3c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pool handles the database connection pool.

Index

Constants

View Source
const DefaultLivenessCheckThreshold = math.MaxInt64

DefaultLivenessCheckThreshold disables the liveness check of connections Liveness checks are performed before a connection is deemed idle enough to be reset

Variables

This section is empty.

Functions

func NewServer

func NewServer() *server

Types

type Connect

type Pool

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

func New

func New(maxSize int, maxAge time.Duration, connect Connect, logger log.Logger, logId string) *Pool

func (*Pool) Borrow

func (p *Pool) Borrow(ctx context.Context, serverNames []string, wait bool, boltLogger log.BoltLogger, idlenessThreshold time.Duration) (db.Connection, error)

func (*Pool) CleanUp

func (p *Pool) CleanUp(ctx context.Context) error

CleanUp prunes all old connection on all the servers, this makes sure that servers gets removed from the map at some point in time. If there is a noticed failed connect still active we should wait a while with removal to get prioritization right.

func (*Pool) Close

func (p *Pool) Close(ctx context.Context) error

func (*Pool) Return

func (p *Pool) Return(ctx context.Context, c db.Connection) error

type PoolClosed

type PoolClosed struct {
}

func (*PoolClosed) Error

func (e *PoolClosed) Error() string

type PoolFull

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

func (*PoolFull) Error

func (e *PoolFull) Error() string

type PoolTimeout

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

func (*PoolTimeout) Error

func (e *PoolTimeout) Error() string

Jump to

Keyboard shortcuts

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