[#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:
Leonard Lyubich 2021-06-21 19:59:05 +03:00 committed by Leonard Lyubich
parent 5db7c5c2a8
commit e11f50ec8e
5 changed files with 16 additions and 11 deletions

View file

@ -22,7 +22,7 @@ type (
ClientCache struct {
log *zap.Logger
cache interface {
Get(address network.Address) (client.Client, error)
Get(address network.AddressGroup) (client.Client, error)
CloseAll()
}
key *ecdsa.PrivateKey
@ -52,7 +52,7 @@ func newClientCache(p *clientCacheParams) *ClientCache {
func (c *ClientCache) Get(address network.Address) (client.Client, error) {
// Because cache is used by `ClientCache` exclusively,
// client will always have valid key.
return c.cache.Get(address)
return c.cache.Get(network.GroupFromAddress(address))
}
// GetSG polls the container from audit task to get the object by id.