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

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 Cluster

func New

func New(
	ctx context.Context,
	config config.Config,
	pool conn.Pool,
) 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 Getter

type Getter interface {
	// Get gets conn from cluster
	Get(ctx context.Context) (cc conn.Conn, err error)
}

type Inserter

type Inserter interface {
	// Insert inserts endpoint to cluster
	Insert(ctx context.Context, endpoint endpoint.Endpoint, opts ...crudOption)
}

type InserterRemoverExplorerLocker

type InserterRemoverExplorerLocker interface {
	Inserter
	Remover
	Explorer
	sync.Locker
}

type Remover

type Remover interface {
	// Remove removes endpoint from cluster
	Remove(ctx context.Context, endpoint endpoint.Endpoint, opts ...crudOption)
}

Source Files

cluster.go context.go

Directories

PathSynopsis
internal/cluster/entry
Version
v3.19.1
Published
Apr 8, 2022
Platform
linux/amd64
Imports
14 packages
Last checked
1 minute ago

Tools for package owners.