forked from TrueCloudLab/frostfs-node
[#943] service/object: Remove KeyStore from CommonPrm
There is no point to pass key storage in parameters because it can be defined on the service level of application. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
c30aa20b04
commit
fbed86da2c
9 changed files with 40 additions and 40 deletions
|
@ -1,8 +1,11 @@
|
|||
package searchsvc
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
|
||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/session"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||
|
@ -47,6 +50,10 @@ type cfg struct {
|
|||
currentEpochReceiver interface {
|
||||
currentEpoch() (uint64, error)
|
||||
}
|
||||
|
||||
keyStore interface {
|
||||
GetKey(token *session.Token) (*ecdsa.PrivateKey, error)
|
||||
}
|
||||
}
|
||||
|
||||
func defaultCfg() *cfg {
|
||||
|
@ -109,3 +116,11 @@ func WithNetMapSource(nmSrc netmap.Source) Option {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WithKeyStorage returns option to set private
|
||||
// key storage for session tokens and node key.
|
||||
func WithKeyStorage(store *util.KeyStorage) Option {
|
||||
return func(c *cfg) {
|
||||
c.keyStore = store
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ func (c *clientWrapper) searchObjects(exec *execCtx, info client.NodeInfo) ([]*o
|
|||
return exec.prm.forwarder(info, c.client)
|
||||
}
|
||||
|
||||
key, err := exec.prm.common.KeyStorage().GetKey(exec.prm.common.SessionToken())
|
||||
key, err := exec.svc.keyStore.GetKey(exec.prm.common.SessionToken())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -30,9 +30,7 @@ func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStre
|
|||
}
|
||||
|
||||
p := new(searchsvc.Prm)
|
||||
p.SetCommonParameters(commonPrm.
|
||||
WithKeyStorage(s.keyStorage),
|
||||
)
|
||||
p.SetCommonParameters(commonPrm)
|
||||
|
||||
p.SetWriter(&streamWriter{
|
||||
stream: stream,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue