forked from TrueCloudLab/frostfs-node
[#265] innerring: Add client cache
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
3d3d058b05
commit
22cffbf529
3 changed files with 36 additions and 0 deletions
24
pkg/innerring/rpc.go
Normal file
24
pkg/innerring/rpc.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package innerring
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network/cache"
|
||||
)
|
||||
|
||||
type ClientCache struct {
|
||||
cache *cache.ClientCache
|
||||
key *ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
func newClientCache(key *ecdsa.PrivateKey) *ClientCache {
|
||||
return &ClientCache{
|
||||
cache: cache.NewSDKClientCache(),
|
||||
key: key,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ClientCache) Get(address string, opts ...client.Option) (*client.Client, error) {
|
||||
return c.cache.Get(c.key, address, opts...)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue