pool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

This package opens and retains a pool of distinct DBMS connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbmsEntry added in v0.2.0

type DbmsEntry struct {
	Entry
	// contains filtered or unexported fields
}

DbmsEntry represents a standard Dbms connection.

type DbmsPool added in v0.2.0

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

DbmsPool is a map of pool entries identified by a unique name.

func NewDbmsPool added in v0.2.0

func NewDbmsPool(rps int) DbmsPool

NewDbmsPool initializes a DbmsPool struct with the given rps. See also database.RateLimitedDbmsConn.

func (DbmsPool) Get added in v0.2.0

func (pool DbmsPool) Get(name string) Entry

Get retrieves an Entry from pool.

func (DbmsPool) Keepalive added in v1.0.0

func (pool DbmsPool) Keepalive(interval time.Duration, logger logr.Logger)

Keepalive starts a periodic ping to each endpoint, if an endpoint becomes unreachable, an error is logged.

func (DbmsPool) Register added in v0.2.0

func (pool DbmsPool) Register(name string, driver string, dsn database.Dsn) error

Register registers a new database.Dbms in the pool.

func (DbmsPool) RegisterDbms added in v0.2.0

func (pool DbmsPool) RegisterDbms(dbms database.Dbms, driver string) error

RegisterDbms is a utility function around Register. It iterates over database.Dbms.Endpoints and registers a connection for each endpoint.

type Entry added in v0.2.0

type Entry interface {
	database.Driver
}

Entry specifies the generic interface for an entry of DbmsPool.

type Pool added in v0.2.0

type Pool interface {
	Get(name string) Entry
	Register(name string, driver string, dsn database.Dsn) error
	Keepalive(interval time.Duration, logger logr.Logger)
}

Pool specifies the generic interface for a Pool of DBMS connections.

Jump to

Keyboard shortcuts

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