Format deprecated notices properly #353
3 changed files with 11 additions and 17 deletions
|
@ -439,6 +439,7 @@ func (ni NodeInfo) Addresses() iter.Seq[string] {
|
||||||
// Breaks iteration on f's true return.
|
// Breaks iteration on f's true return.
|
||||||
//
|
//
|
||||||
// Handler should not be nil.
|
// Handler should not be nil.
|
||||||
|
//
|
||||||
// Deprecated: use [NodeInfo.Addresses] instead.
|
// Deprecated: use [NodeInfo.Addresses] instead.
|
||||||
func (ni *NodeInfo) IterateAddresses(f func(string) bool) {
|
func (ni *NodeInfo) IterateAddresses(f func(string) bool) {
|
||||||
if ni != nil {
|
if ni != nil {
|
||||||
|
|
|
@ -201,6 +201,7 @@ func (x NodeInfo) NumberOfNetworkEndpoints() int {
|
||||||
// FrostFS system requirements.
|
// FrostFS system requirements.
|
||||||
//
|
//
|
||||||
// See also SetNetworkEndpoints.
|
// See also SetNetworkEndpoints.
|
||||||
|
//
|
||||||
// Deprecated: use [NodeInfo.NetworkEndpoints] instead.
|
// Deprecated: use [NodeInfo.NetworkEndpoints] instead.
|
||||||
func (x NodeInfo) IterateNetworkEndpoints(f func(string) bool) {
|
func (x NodeInfo) IterateNetworkEndpoints(f func(string) bool) {
|
||||||
for s := range x.NetworkEndpoints() {
|
for s := range x.NetworkEndpoints() {
|
||||||
|
@ -220,6 +221,7 @@ func (x NodeInfo) NetworkEndpoints() iter.Seq[string] {
|
||||||
|
|
||||||
// IterateNetworkEndpoints is an extra-sugared function over IterateNetworkEndpoints
|
// IterateNetworkEndpoints is an extra-sugared function over IterateNetworkEndpoints
|
||||||
// method which allows to unconditionally iterate over all node's network endpoints.
|
// method which allows to unconditionally iterate over all node's network endpoints.
|
||||||
|
//
|
||||||
// Deprecated: use [NodeInfo.NetworkEndpoints] instead.
|
// Deprecated: use [NodeInfo.NetworkEndpoints] instead.
|
||||||
func IterateNetworkEndpoints(node NodeInfo, f func(string)) {
|
func IterateNetworkEndpoints(node NodeInfo, f func(string)) {
|
||||||
node.IterateNetworkEndpoints(func(addr string) bool {
|
node.IterateNetworkEndpoints(func(addr string) bool {
|
||||||
|
@ -422,6 +424,7 @@ func (x NodeInfo) Attributes() iter.Seq2[string, string] {
|
||||||
|
|
||||||
// IterateAttributes iterates over all node attributes and passes the into f.
|
// IterateAttributes iterates over all node attributes and passes the into f.
|
||||||
// Handler MUST NOT be nil.
|
// Handler MUST NOT be nil.
|
||||||
|
//
|
||||||
// Deprecated: use [NodeInfo.Attributes] instead.
|
// Deprecated: use [NodeInfo.Attributes] instead.
|
||||||
func (x NodeInfo) IterateAttributes(f func(key, value string)) {
|
func (x NodeInfo) IterateAttributes(f func(key, value string)) {
|
||||||
a := x.m.GetAttributes()
|
a := x.m.GetAttributes()
|
||||||
|
|
|
@ -1081,20 +1081,15 @@ func (p *Pool) deleteClientFromMap(hash uint64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*treeClient, error) {
|
func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*treeClient, error) {
|
||||||
var (
|
for endpoint := range node.NetworkEndpoints() {
|
||||||
treeCl *treeClient
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
node.IterateNetworkEndpoints(func(endpoint string) bool {
|
|
||||||
var addr network.Address
|
var addr network.Address
|
||||||
if err = addr.FromString(endpoint); err != nil {
|
if err := addr.FromString(endpoint); err != nil {
|
||||||
p.log(zap.WarnLevel, "can't parse endpoint", zap.String("endpoint", endpoint), zap.Error(err))
|
p.log(zap.WarnLevel, "can't parse endpoint", zap.String("endpoint", endpoint), zap.Error(err))
|
||||||
return false
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
newTreeCl := newTreeClient(addr.URIAddr(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout)
|
newTreeCl := newTreeClient(addr.URIAddr(), p.dialOptions, p.nodeDialTimeout, p.streamTimeout)
|
||||||
if err = newTreeCl.dial(ctx); err != nil {
|
if err := newTreeCl.dial(ctx); err != nil {
|
||||||
p.log(zap.WarnLevel, "failed to dial tree client", zap.Error(err))
|
p.log(zap.WarnLevel, "failed to dial tree client", zap.Error(err))
|
||||||
|
|
||||||
// We have to close connection here after failed `dial()`.
|
// We have to close connection here after failed `dial()`.
|
||||||
|
@ -1106,20 +1101,15 @@ func (p *Pool) getNewTreeClient(ctx context.Context, node netmap.NodeInfo) (*tre
|
||||||
p.log(zap.WarnLevel, "failed to close recently dialed tree client", zap.Error(err))
|
p.log(zap.WarnLevel, "failed to close recently dialed tree client", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
treeCl = newTreeCl
|
return newTreeCl, nil
|
||||||
return true
|
}
|
||||||
})
|
|
||||||
|
|
||||||
if treeCl == nil {
|
|
||||||
return nil, fmt.Errorf("tree client wasn't initialized")
|
return nil, fmt.Errorf("tree client wasn't initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
return treeCl, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func shouldTryAgain(err error) bool {
|
func shouldTryAgain(err error) bool {
|
||||||
return !(err == nil || errors.Is(err, ErrNodeAccessDenied))
|
return !(err == nil || errors.Is(err, ErrNodeAccessDenied))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue