package cluster

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

Index

Constants

const (
	MaxGetConnTimeout = 10 * time.Second
)

Variables

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"))
)

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) 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.

func (*Cluster) Unban

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

Unban connection in underling pool

Source Files

cluster.go

Version
v3.24.3-rc1
Published
May 5, 2022
Platform
darwin/amd64
Imports
11 packages
Last checked
4 minutes ago

Tools for package owners.