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 = errors.New("cluster closed")

	// ErrClusterEmpty returned when no connections left in cluster.
	ErrClusterEmpty = errors.New("cluster empty")

	// ErrUnknownEndpoint returned when no connections left in cluster.
	ErrUnknownEndpoint = errors.New("unknown endpoint")

	// ErrNilBalancerElement returned when requested on a nil Balancer element.
	ErrNilBalancerElement = errors.New("nil balancer element")

	// ErrUnknownBalancerElement returned when requested on a unknown Balancer element.
	ErrUnknownBalancerElement = errors.New("unknown balancer element")

	// ErrUnknownTypeOfBalancerElement returned when requested on a unknown types of Balancer element.
	ErrUnknownTypeOfBalancerElement = errors.New("unknown types of balancer element")
)

Functions

func DiffEndpoints

func DiffEndpoints(curr, next []endpoint.Endpoint, eq, add, del func(i, j int))

func SortEndpoints

func SortEndpoints(es []endpoint.Endpoint)

func WithEndpoint

func WithEndpoint(ctx context.Context, endpoint Endpoint) context.Context

func WithoutLock

func WithoutLock() crudOption

Types

type CRUD

type CRUD interface {
	// Insert inserts endpoint to cluster
	Insert(ctx context.Context, endpoint endpoint.Endpoint, opts ...crudOption) conn.Conn

	// Update updates endpoint in cluster
	Update(ctx context.Context, endpoint endpoint.Endpoint, opts ...crudOption) conn.Conn

	// Remove removes endpoint from cluster
	Remove(ctx context.Context, endpoint endpoint.Endpoint, opts ...crudOption) conn.Conn

	// Get gets conn from cluster
	Get(ctx context.Context, opts ...crudOption) (cc conn.Conn, err error)
}

type CRUDExplorerLocker

type CRUDExplorerLocker interface {
	CRUD
	Explorer
	Locker
}

type Cluster

type Cluster interface {
	closer.Closer
	CRUD
	Pessimizer
	Explorer
	Locker
	conn.PoolGetter
}

func New

func New(
	ctx context.Context,
	config config.Config,
	balancer balancer.Balancer,
) Cluster

type Endpoint

type Endpoint interface {
	NodeID() uint32
}

func ContextEndpoint

func ContextEndpoint(ctx context.Context) (e Endpoint, ok bool)

type Explorer

type Explorer interface {
	SetExplorer(repeater repeater.Repeater)
	Force()
}

type Locker

type Locker interface {
	Lock()
	Unlock()
}

type Pessimizer

type Pessimizer interface {
	Pessimize(ctx context.Context, endpoint endpoint.Endpoint) error
}

Source Files

cluster.go context.go

Directories

PathSynopsis
internal/cluster/entry
Version
v3.11.12
Published
Mar 5, 2022
Platform
windows/amd64
Imports
15 packages
Last checked
11 seconds ago

Tools for package owners.