package cluster

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/cluster"

Index

Constants

const (
	MaxGetConnTimeout = 10 * time.Second
)

Variables

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

nolint: gofumpt nolint: nolintlint

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,
	onBadStateCallback balancer.OnBadStateCallback,
) *Cluster

func (*Cluster) Allow

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

Allow connection in underling pool

func (*Cluster) Ban

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

Ban connection in underling pool

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.

Source Files

cluster.go

Version
v3.25.3
Published
May 15, 2022
Platform
linux/amd64
Imports
11 packages
Last checked
1 minute ago

Tools for package owners.