package balancer
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/driver/cluster/balancer"
Index ¶
- Variables
- func NewMultiBalancer(opts ...balancerOption) *multiBalancer
- func WithBalancer(b Balancer, filter func(conn.Conn, info.Info) bool) balancerOption
- type Balancer
- type Element
Variables ¶
var ( // 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 NewMultiBalancer ¶
func NewMultiBalancer(opts ...balancerOption) *multiBalancer
func WithBalancer ¶
Types ¶
type Balancer ¶
type Balancer interface { // Next returns next connection for request. // Next MUST not return nil if it has at least one connection. Next() conn.Conn // Insert inserts new connection. Insert(conn.Conn, info.Info) Element // Update updates previously inserted connection. Update(Element, info.Info) // Remove removes previously inserted connection. Remove(Element) // Contains returns true if Balancer contains requested element. Contains(Element) bool }
Balancer is an interface that implements particular load-balancing algorithm.
Balancer methods called synchronized. That is, implementations must not provide additional goroutine safety.
func New ¶
func New(cfg config.BalancerConfig) Balancer
func Single ¶
func Single() Balancer
type Element ¶
type Element interface { }
Element is an empty interface that holds some Balancer specific data.
Source Files ¶
Directories ¶
- Version
- v3.4.3
- Published
- Nov 22, 2021
- Platform
- darwin/amd64
- Imports
- 12 packages
- Last checked
- 1 second ago –
Tools for package owners.