[#645] *: Use helper functions to build client.NodeInfo structures
Helper functions from core/client package allow to set public keys of storage nodes. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2d441a4cc6
commit
e473f3ac91
12 changed files with 67 additions and 107 deletions
|
@ -148,18 +148,16 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
|
|||
var relay func(nodeDesc) error
|
||||
if p.relay != nil {
|
||||
relay = func(node nodeDesc) error {
|
||||
addr := node.info.Addresses()
|
||||
|
||||
var info client.NodeInfo
|
||||
|
||||
info.SetAddressGroup(addr)
|
||||
client.NodeInfoFromNetmapElement(&info, node.info)
|
||||
|
||||
c, err := p.clientConstructor.Get(info)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create SDK client %s: %w", addr, err)
|
||||
return fmt.Errorf("could not create SDK client %s: %w", info.AddressGroup(), err)
|
||||
}
|
||||
|
||||
return p.relay(addr, c)
|
||||
return p.relay(info.AddressGroup(), c)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,13 +172,16 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
|
|||
}
|
||||
}
|
||||
|
||||
return &remoteTarget{
|
||||
rt := &remoteTarget{
|
||||
ctx: p.ctx,
|
||||
keyStorage: p.keyStorage,
|
||||
commonPrm: prm.common,
|
||||
addr: node.info.Addresses(),
|
||||
clientConstructor: p.clientConstructor,
|
||||
}
|
||||
|
||||
client.NodeInfoFromNetmapElement(&rt.nodeInfo, node.info)
|
||||
|
||||
return rt
|
||||
},
|
||||
relay: relay,
|
||||
fmt: p.fmtValidator,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue