forked from TrueCloudLab/frostfs-node
[#607] network: Make ClientCache to accept AddressGroup
Change type of the `ClientCache.Get` method's parameter to `AddressGroup`. Use `GroupFromAddress` to call the method from the wrappers in order to no change their interface. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
5db7c5c2a8
commit
e11f50ec8e
5 changed files with 16 additions and 11 deletions
|
@ -205,7 +205,7 @@ type remoteLoadAnnounceProvider struct {
|
|||
loadAddrSrc network.LocalAddressSource
|
||||
|
||||
clientCache interface {
|
||||
Get(network.Address) (apiClient.Client, error)
|
||||
Get(network.AddressGroup) (apiClient.Client, error)
|
||||
}
|
||||
|
||||
deadEndProvider loadcontroller.WriterProvider
|
||||
|
@ -230,7 +230,7 @@ func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadc
|
|||
return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil
|
||||
}
|
||||
|
||||
c, err := r.clientCache.Get(netAddr)
|
||||
c, err := r.clientCache.Get(network.GroupFromAddress(netAddr))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not initialize API client: %w", err)
|
||||
}
|
||||
|
|
|
@ -422,7 +422,7 @@ type reputationClientConstructor struct {
|
|||
trustStorage *truststorage.Storage
|
||||
|
||||
basicConstructor interface {
|
||||
Get(network.Address) (client.Client, error)
|
||||
Get(network.AddressGroup) (client.Client, error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ func (c *reputationClient) SearchObject(ctx context.Context, prm *client.SearchO
|
|||
}
|
||||
|
||||
func (c *reputationClientConstructor) Get(addr network.Address) (client.Client, error) {
|
||||
cl, err := c.basicConstructor.Get(addr)
|
||||
cl, err := c.basicConstructor.Get(network.GroupFromAddress(addr))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
type clientCache interface {
|
||||
Get(network.Address) (apiClient.Client, error)
|
||||
Get(network.AddressGroup) (apiClient.Client, error)
|
||||
}
|
||||
|
||||
// clientKeyRemoteProvider must provide remote writer and take into account
|
||||
|
@ -84,7 +84,7 @@ func (rtp *remoteTrustProvider) InitRemote(srv reputationcommon.ServerInfo) (rep
|
|||
return trustcontroller.SimpleWriterProvider(new(NopReputationWriter)), nil
|
||||
}
|
||||
|
||||
c, err := rtp.clientCache.Get(netAddr)
|
||||
c, err := rtp.clientCache.Get(network.GroupFromAddress(netAddr))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not initialize API client: %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue