Documentation ¶
Index ¶
- func CreateFromConfig(s string) (*balancerConfig.Config, error)
- func Default() *balancerConfig.Config
- func FromConfig(config string, opts ...fromConfigOption) *balancerConfig.Config
- func Prefer(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config
- func PreferLocalDC(balancer *balancerConfig.Config) *balancerConfig.Config
- func PreferLocalDCWithFallBack(balancer *balancerConfig.Config) *balancerConfig.Config
- func PreferLocations(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config
- func PreferLocationsWithFallback(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config
- func PreferWithFallback(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config
- func RandomChoice() *balancerConfig.Config
- func RoundRobin() *balancerConfig.Configdeprecated
- func SingleConn() *balancerConfig.Config
- func WithParseErrorFallbackBalancer(b *balancerConfig.Config) fromConfigOption
- func WithParseErrorHandler(errorHandler func(error)) fromConfigOption
- type Endpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFromConfig ¶ added in v3.14.1
func CreateFromConfig(s string) (*balancerConfig.Config, error)
func FromConfig ¶ added in v3.14.0
func FromConfig(config string, opts ...fromConfigOption) *balancerConfig.Config
func Prefer ¶ added in v3.12.0
func Prefer(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config
Prefer creates balancer which use endpoints by filter Balancer "balancer" defines balancing algorithm between endpoints selected with filter
func PreferLocalDC ¶
func PreferLocalDC(balancer *balancerConfig.Config) *balancerConfig.Config
PreferLocalDC creates balancer which use endpoints only in location such as initial endpoint location Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location PreferLocalDC balancer try to autodetect local DC from client side.
func PreferLocalDCWithFallBack ¶
func PreferLocalDCWithFallBack(balancer *balancerConfig.Config) *balancerConfig.Config
PreferLocalDCWithFallBack creates balancer which use endpoints only in location such as initial endpoint location Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead
func PreferLocations ¶
func PreferLocations(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config
PreferLocations creates balancer which use endpoints only in selected locations (such as "ABC", "DEF", etc.) Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location
func PreferLocationsWithFallback ¶
func PreferLocationsWithFallback(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config
PreferLocationsWithFallback creates balancer which use endpoints only in selected locations Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead
func PreferWithFallback ¶ added in v3.12.0
func PreferWithFallback(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config
PreferWithFallback creates balancer which use endpoints by filter Balancer "balancer" defines balancing algorithm between endpoints selected with filter If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead
func RandomChoice ¶
func RandomChoice() *balancerConfig.Config
func RoundRobin
deprecated
func RoundRobin() *balancerConfig.Config
Deprecated: RoundRobin is an alias to RandomChoice now Will be removed after Oct 2024. Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
func SingleConn ¶
func SingleConn() *balancerConfig.Config
func WithParseErrorFallbackBalancer ¶ added in v3.14.0
func WithParseErrorFallbackBalancer(b *balancerConfig.Config) fromConfigOption
func WithParseErrorHandler ¶ added in v3.14.0
func WithParseErrorHandler(errorHandler func(error)) fromConfigOption
Types ¶
type Endpoint ¶ added in v3.12.0
type Endpoint interface { NodeID() uint32 Address() string Location() string // Deprecated: LocalDC check "local" by compare endpoint location with discovery "selflocation" field. // It work good only if connection url always point to local dc. // Will be removed after Oct 2024. // Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated LocalDC() bool }