forked from TrueCloudLab/frostfs-node
[#1087] *: Adopt SDK changes
- Update `neofs-sdk-go`: v0.0.0-20211230072947-1fe37df88f80 => v0.0.0-20220113123743-7f3162110659 - Add client interface that duplicates SDK's client behaviour and new `MultiAddressClient` interface that has method that iterates over wrapped clients. - Also start using simple client mode that does not require parsing statuses outside the SDK library. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
58d90eec7d
commit
7c02a2e251
32 changed files with 151 additions and 180 deletions
|
@ -8,18 +8,17 @@ import (
|
|||
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
reputationrouter "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common/router"
|
||||
trustcontroller "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/controller"
|
||||
apiClient "github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
)
|
||||
|
||||
type clientCache interface {
|
||||
Get(client.NodeInfo) (apiClient.Client, error)
|
||||
Get(client.NodeInfo) (client.Client, error)
|
||||
}
|
||||
|
||||
// clientKeyRemoteProvider must provide remote writer and take into account
|
||||
// that requests must be sent via passed api client and must be signed with
|
||||
// passed private key.
|
||||
type clientKeyRemoteProvider interface {
|
||||
WithClient(apiClient.Client) reputationcommon.WriterProvider
|
||||
WithClient(client.Client) reputationcommon.WriterProvider
|
||||
}
|
||||
|
||||
// remoteTrustProvider is implementation of reputation RemoteWriterProvider interface.
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/common"
|
||||
internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/internal/client"
|
||||
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
eigentrustcalc "github.com/nspcc-dev/neofs-node/pkg/services/reputation/eigentrust/calculator"
|
||||
apiClient "github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
reputationapi "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
|
@ -43,7 +43,7 @@ type RemoteProvider struct {
|
|||
key *ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
func (rp RemoteProvider) WithClient(c apiClient.Client) reputationcommon.WriterProvider {
|
||||
func (rp RemoteProvider) WithClient(c coreclient.Client) reputationcommon.WriterProvider {
|
||||
return &TrustWriterProvider{
|
||||
client: c,
|
||||
key: rp.key,
|
||||
|
@ -51,7 +51,7 @@ func (rp RemoteProvider) WithClient(c apiClient.Client) reputationcommon.WriterP
|
|||
}
|
||||
|
||||
type TrustWriterProvider struct {
|
||||
client apiClient.Client
|
||||
client coreclient.Client
|
||||
key *ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ func (twp *TrustWriterProvider) InitWriter(ctx reputationcommon.Context) (reputa
|
|||
|
||||
type RemoteTrustWriter struct {
|
||||
eiCtx eigentrustcalc.Context
|
||||
client apiClient.Client
|
||||
client coreclient.Client
|
||||
key *ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,14 @@ import (
|
|||
"context"
|
||||
"crypto/ecdsa"
|
||||
|
||||
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
type commonPrm struct {
|
||||
cli client.Client
|
||||
cli coreclient.Client
|
||||
|
||||
ctx context.Context
|
||||
|
||||
|
@ -22,7 +23,7 @@ type commonPrm struct {
|
|||
// SetClient sets base client for NeoFS API communication.
|
||||
//
|
||||
// Required parameter.
|
||||
func (x *commonPrm) SetClient(cli client.Client) {
|
||||
func (x *commonPrm) SetClient(cli coreclient.Client) {
|
||||
x.cli = cli
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/common"
|
||||
internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/internal/client"
|
||||
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
|
||||
apiClient "github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
reputationapi "github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
|
@ -42,7 +42,7 @@ type RemoteProvider struct {
|
|||
key *ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
func (rp RemoteProvider) WithClient(c apiClient.Client) reputationcommon.WriterProvider {
|
||||
func (rp RemoteProvider) WithClient(c coreclient.Client) reputationcommon.WriterProvider {
|
||||
return &TrustWriterProvider{
|
||||
client: c,
|
||||
key: rp.key,
|
||||
|
@ -50,7 +50,7 @@ func (rp RemoteProvider) WithClient(c apiClient.Client) reputationcommon.WriterP
|
|||
}
|
||||
|
||||
type TrustWriterProvider struct {
|
||||
client apiClient.Client
|
||||
client coreclient.Client
|
||||
key *ecdsa.PrivateKey
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ func (twp *TrustWriterProvider) InitWriter(ctx reputationcommon.Context) (reputa
|
|||
|
||||
type RemoteTrustWriter struct {
|
||||
ctx reputationcommon.Context
|
||||
client apiClient.Client
|
||||
client coreclient.Client
|
||||
key *ecdsa.PrivateKey
|
||||
|
||||
buf []*reputationapi.Trust
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue