[#645] *: Construct clients from client.NodeInfo in API client cache
There is a need to have the ability to expand the data needed for client construction. Replace `network.AddressGroup` parameter of client cache interfaces with `client.NodeInfo`. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
91cc33bdb9
commit
7b228b7603
25 changed files with 114 additions and 72 deletions
5
pkg/network/cache/client.go
vendored
5
pkg/network/cache/client.go
vendored
|
@ -4,6 +4,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||
clientcore "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||
)
|
||||
|
||||
|
@ -28,7 +29,9 @@ func NewSDKClientCache(opts ...client.Option) *ClientCache {
|
|||
}
|
||||
|
||||
// Get function returns existing client or creates a new one.
|
||||
func (c *ClientCache) Get(netAddr network.AddressGroup) (client.Client, error) {
|
||||
func (c *ClientCache) Get(info clientcore.NodeInfo) (client.Client, error) {
|
||||
netAddr := info.AddressGroup()
|
||||
|
||||
// multiaddr is used as a key in client cache since
|
||||
// same host may have different connections(with tls or not),
|
||||
// therefore, host+port pair is not unique
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue