forked from TrueCloudLab/frostfs-node
[#428] client: Hide client cache behind interface in dependent packages
Replace usage of `cache.ClientCache` type with interface with similar signature. This will further allow overloading clients without affecting the logic of dependent packages. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f25253738a
commit
106884fc40
13 changed files with 65 additions and 49 deletions
|
@ -8,7 +8,6 @@ import (
|
|||
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network/cache"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement"
|
||||
)
|
||||
|
@ -21,8 +20,8 @@ type uniqueIDWriter struct {
|
|||
writer IDListWriter
|
||||
}
|
||||
|
||||
type clientCacheWrapper struct {
|
||||
cache *cache.ClientCache
|
||||
type clientConstructorWrapper struct {
|
||||
constructor ClientConstructor
|
||||
}
|
||||
|
||||
type clientWrapper struct {
|
||||
|
@ -68,8 +67,8 @@ func (w *uniqueIDWriter) WriteIDs(list []*objectSDK.ID) error {
|
|||
return w.writer.WriteIDs(list)
|
||||
}
|
||||
|
||||
func (c *clientCacheWrapper) get(addr string) (searchClient, error) {
|
||||
clt, err := c.cache.Get(addr)
|
||||
func (c *clientConstructorWrapper) get(addr string) (searchClient, error) {
|
||||
clt, err := c.constructor.Get(addr)
|
||||
|
||||
return &clientWrapper{
|
||||
client: clt,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue