forked from TrueCloudLab/frostfs-node
[#1255] node/session: Create separate dir for in-memory storage
Move in-memory session storage to the separate directory of `storage`. It is done for future support of different kind of session storages. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
2a69aaf976
commit
929c9851a6
7 changed files with 36 additions and 19 deletions
|
@ -4,7 +4,7 @@ import (
|
|||
"crypto/ecdsa"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/session/storage"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/session/storage/temporary"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
)
|
||||
|
@ -13,13 +13,13 @@ import (
|
|||
type KeyStorage struct {
|
||||
key *ecdsa.PrivateKey
|
||||
|
||||
tokenStore *storage.TokenStore
|
||||
tokenStore *temporary.TokenStore
|
||||
|
||||
networkState netmap.State
|
||||
}
|
||||
|
||||
// NewKeyStorage creates, initializes and returns new KeyStorage instance.
|
||||
func NewKeyStorage(localKey *ecdsa.PrivateKey, tokenStore *storage.TokenStore, net netmap.State) *KeyStorage {
|
||||
func NewKeyStorage(localKey *ecdsa.PrivateKey, tokenStore *temporary.TokenStore, net netmap.State) *KeyStorage {
|
||||
return &KeyStorage{
|
||||
key: localKey,
|
||||
tokenStore: tokenStore,
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
sessionV2 "github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
|
||||
tokenStorage "github.com/nspcc-dev/neofs-node/pkg/services/session/storage"
|
||||
tokenStorage "github.com/nspcc-dev/neofs-node/pkg/services/session/storage/temporary"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ func TestNewKeyStorage(t *testing.T) {
|
|||
nodeKey, err := keys.NewPrivateKey()
|
||||
require.NoError(t, err)
|
||||
|
||||
tokenStor := tokenStorage.New()
|
||||
tokenStor := tokenStorage.NewTokenStore()
|
||||
stor := util.NewKeyStorage(&nodeKey.PrivateKey, tokenStor, mockedNetworkState{42})
|
||||
|
||||
t.Run("node key", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue