From 3a497a3c536d2fef9bc3d998eda4317937edad07 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 28 Sep 2021 08:36:41 +0300 Subject: [PATCH] [#645] object/put: Pass NodeInfo instead of AddressGroup to relay func Replace `network.AddressGroup` parameter type of relay function with `client.NodeInfo`. Signed-off-by: Leonard Lyubich --- pkg/services/object/put/prm.go | 5 ++--- pkg/services/object/put/streamer.go | 5 ++--- pkg/services/object/put/v2/streamer.go | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go index 61e042db..d8235c82 100644 --- a/pkg/services/object/put/prm.go +++ b/pkg/services/object/put/prm.go @@ -3,7 +3,6 @@ package putsvc import ( "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/object" - "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" ) @@ -15,7 +14,7 @@ type PutInitPrm struct { traverseOpts []placement.Option - relay func(network.AddressGroup, client.Client) error + relay func(client.NodeInfo, client.Client) error } type PutChunkPrm struct { @@ -46,7 +45,7 @@ func (p *PutInitPrm) WithObject(v *object.RawObject) *PutInitPrm { return p } -func (p *PutInitPrm) WithRelay(f func(network.AddressGroup, client.Client) error) *PutInitPrm { +func (p *PutInitPrm) WithRelay(f func(client.NodeInfo, client.Client) error) *PutInitPrm { if p != nil { p.relay = f } diff --git a/pkg/services/object/put/streamer.go b/pkg/services/object/put/streamer.go index 2734e512..9f0bc950 100644 --- a/pkg/services/object/put/streamer.go +++ b/pkg/services/object/put/streamer.go @@ -7,7 +7,6 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/core/client" "github.com/nspcc-dev/neofs-node/pkg/core/netmap" - "github.com/nspcc-dev/neofs-node/pkg/network" "github.com/nspcc-dev/neofs-node/pkg/services/object/util" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/transformer" @@ -20,7 +19,7 @@ type Streamer struct { target transformer.ObjectTarget - relay func(network.AddressGroup, client.Client) error + relay func(client.NodeInfo, client.Client) error maxPayloadSz uint64 // network config } @@ -157,7 +156,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget { return fmt.Errorf("could not create SDK client %s: %w", info.AddressGroup(), err) } - return p.relay(info.AddressGroup(), c) + return p.relay(info, c) } } diff --git a/pkg/services/object/put/v2/streamer.go b/pkg/services/object/put/v2/streamer.go index 4386e4e3..df07a67b 100644 --- a/pkg/services/object/put/v2/streamer.go +++ b/pkg/services/object/put/v2/streamer.go @@ -125,13 +125,13 @@ func (s *streamer) CloseAndRecv() (*object.PutResponse, error) { return fromPutResponse(resp), nil } -func (s *streamer) relayRequest(addr network.AddressGroup, c client.Client) error { +func (s *streamer) relayRequest(info client.NodeInfo, c client.Client) error { // open stream resp := new(object.PutResponse) var firstErr error - addr.IterateAddresses(func(addr network.Address) (stop bool) { + info.AddressGroup().IterateAddresses(func(addr network.Address) (stop bool) { var err error defer func() {