@@ -37,21 +37,41 @@ func (filterLocalDC) String() string {
3737 return "LocalDC"
3838}
3939
40- // PreferLocalDC creates balancer which use endpoints only in location such as initial endpoint location
41- // Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location
42- // PreferLocalDC balancer try to autodetect local DC from client side.
40+ // Deprecated: use PreferNearestDC instead
41+ // Will be removed after March 2025.
42+ // Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
4343func PreferLocalDC (balancer * balancerConfig.Config ) * balancerConfig.Config {
4444 balancer .Filter = filterLocalDC {}
45- balancer .DetectLocalDC = true
45+ balancer .DetectNearestDC = true
4646
4747 return balancer
4848}
4949
50- // PreferLocalDCWithFallBack creates balancer which use endpoints only in location such as initial endpoint location
50+ // PreferNearestDC creates balancer which use endpoints only in location such as initial endpoint location
5151// Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location
52- // If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead
52+ // PreferNearestDC balancer try to autodetect local DC from client side.
53+ func PreferNearestDC (balancer * balancerConfig.Config ) * balancerConfig.Config {
54+ balancer .Filter = filterLocalDC {}
55+ balancer .DetectNearestDC = true
56+
57+ return balancer
58+ }
59+
60+ // Deprecated: use PreferNearestDCWithFallBack instead
61+ // Will be removed after March 2025.
62+ // Read about versioning policy: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#deprecated
5363func PreferLocalDCWithFallBack (balancer * balancerConfig.Config ) * balancerConfig.Config {
54- balancer = PreferLocalDC (balancer )
64+ balancer = PreferNearestDC (balancer )
65+ balancer .AllowFallback = true
66+
67+ return balancer
68+ }
69+
70+ // PreferNearestDCWithFallBack creates balancer which use endpoints only in location such as initial endpoint location
71+ // Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location
72+ // If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead
73+ func PreferNearestDCWithFallBack (balancer * balancerConfig.Config ) * balancerConfig.Config {
74+ balancer = PreferNearestDC (balancer )
5575 balancer .AllowFallback = true
5676
5777 return balancer
0 commit comments