cluster

package
v3.24.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGetConnTimeout = 10 * time.Second
)

Variables

View Source
var (
	// ErrClusterClosed returned when requested on a closed cluster.
	ErrClusterClosed = xerrors.Wrap(fmt.Errorf("cluster closed"))

	// ErrClusterEmpty returned when no connections left in cluster.
	ErrClusterEmpty = xerrors.Wrap(fmt.Errorf("cluster empty"))
)

Functions

This section is empty.

Types

type Cluster

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

func New

func New(
	ctx context.Context,
	config config.Config,
	pool conn.Pool,
	endpoints []endpoint.Endpoint,
) *Cluster

func (*Cluster) Close

func (c *Cluster) Close(ctx context.Context) (err error)

func (*Cluster) Get

func (c *Cluster) Get(ctx context.Context) (cc conn.Conn, err error)

Get returns next available connection. It returns error on given deadline cancellation or when cluster become closed.

func (*Cluster) Pessimize

func (c *Cluster) Pessimize(ctx context.Context, cc conn.Conn, cause error)

Pessimize connection in underling pool

func (*Cluster) Unpessimize

func (c *Cluster) Unpessimize(ctx context.Context, cc conn.Conn)

Unpessimize connection in underling pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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