[#625] client/container: remove intermediate wrapper

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-01-31 16:34:01 +03:00 committed by Alex Vanin
parent 819d80a7a9
commit c34cfa1f35
28 changed files with 556 additions and 1168 deletions

View file

@ -5,7 +5,7 @@ import (
"encoding/hex"
clientcore "github.com/nspcc-dev/neofs-node/pkg/core/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
"github.com/nspcc-dev/neofs-node/pkg/util/rand"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
@ -47,7 +47,7 @@ func (ap *Processor) processStartAudit(epoch uint64) {
auditCtx, ap.prevAuditCanceler = context.WithCancel(context.Background())
for i := range containers {
cnr, err := wrapper.Get(ap.containerClient, containers[i]) // get container structure
cnr, err := cntClient.Get(ap.containerClient, containers[i]) // get container structure
if err != nil {
log.Error("can't get container info, ignore",
zap.Stringer("cid", containers[i]),

View file

@ -8,7 +8,7 @@ import (
"time"
"github.com/nspcc-dev/neofs-node/pkg/core/client"
wrapContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
nmClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
@ -41,7 +41,7 @@ type (
sgSrc SGSource
searchTimeout time.Duration
containerClient *wrapContainer.Wrapper
containerClient *cntClient.Client
netmapClient *nmClient.Client
taskManager TaskManager
@ -53,7 +53,7 @@ type (
Params struct {
Log *zap.Logger
NetmapClient *nmClient.Client
ContainerClient *wrapContainer.Wrapper
ContainerClient *cntClient.Client
IRList Indexer
SGSource SGSource
RPCSearchTimeout time.Duration

View file

@ -10,7 +10,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/network/payload"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-node/pkg/core/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid"
morphsubnet "github.com/nspcc-dev/neofs-node/pkg/morph/client/subnet"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
@ -130,7 +130,7 @@ func (cp *Processor) approvePutContainer(ctx *putContainerContext) {
var err error
prm := wrapper.PutPrm{}
prm := cntClient.PutPrm{}
prm.SetContainer(e.Container())
prm.SetKey(e.PublicKey())
@ -243,7 +243,7 @@ func (cp *Processor) checkDeleteContainer(e *containerEvent.Delete) error {
func (cp *Processor) approveDeleteContainer(e *containerEvent.Delete) {
var err error
prm := wrapper.DeletePrm{}
prm := cntClient.DeletePrm{}
prm.SetCID(e.ContainerID())
prm.SetSignature(e.Signature())

View file

@ -7,7 +7,7 @@ import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/event/container"
"github.com/nspcc-dev/neofs-sdk-go/eacl"
"github.com/nspcc-dev/neofs-sdk-go/session"
@ -57,7 +57,7 @@ func (cp *Processor) checkSetEACL(e container.SetEACL) error {
}
// receive owner of the related container
cnr, err := wrapper.Get(cp.cnrClient, table.CID())
cnr, err := cntClient.Get(cp.cnrClient, table.CID())
if err != nil {
return fmt.Errorf("could not receive the container: %w", err)
}
@ -91,7 +91,7 @@ func (cp *Processor) checkSetEACL(e container.SetEACL) error {
func (cp *Processor) approveSetEACL(e container.SetEACL) {
var err error
prm := wrapper.PutEACLPrm{}
prm := cntClient.PutEACLPrm{}
prm.SetTable(e.Table())
prm.SetKey(e.PublicKey())

View file

@ -5,7 +5,7 @@ import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/core/mempoolevent"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/neofsid"
morphsubnet "github.com/nspcc-dev/neofs-node/pkg/morph/client/subnet"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
@ -25,7 +25,7 @@ type (
log *zap.Logger
pool *ants.Pool
alphabetState AlphabetState
cnrClient *wrapper.Wrapper // notary must be enabled
cnrClient *container.Client // notary must be enabled
idClient *neofsid.Client
subnetClient *morphsubnet.Client
netState NetworkState
@ -37,7 +37,7 @@ type (
Log *zap.Logger
PoolSize int
AlphabetState AlphabetState
ContainerClient *wrapper.Wrapper
ContainerClient *container.Client
NeoFSIDClient *neofsid.Client
SubnetClient *morphsubnet.Client
NetworkState NetworkState

View file

@ -4,7 +4,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/audit"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/governance"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
"go.uber.org/zap"
)
@ -37,7 +37,7 @@ func (np *Processor) processNewEpoch(ev netmapEvent.NewEpoch) {
return
}
prm := wrapper.StartEstimationPrm{}
prm := cntClient.StartEstimationPrm{}
prm.SetEpoch(epoch - 1)
prm.SetHash(ev.TxHash())

View file

@ -6,7 +6,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/mempoolevent"
"github.com/nspcc-dev/neo-go/pkg/util"
container "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
nmClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
@ -60,7 +60,7 @@ type (
alphabetState AlphabetState
netmapClient *nmClient.Client
containerWrp *container.Wrapper
containerWrp *container.Client
subnetContract util.Uint160
@ -86,7 +86,7 @@ type (
AlphabetState AlphabetState
CleanupEnabled bool
CleanupThreshold uint64 // in epochs
ContainerWrapper *container.Wrapper
ContainerWrapper *container.Client
SubnetContract *util.Uint160
HandleAudit event.Handler

View file

@ -4,7 +4,7 @@ import (
"math/big"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"go.uber.org/zap"
)
@ -76,7 +76,7 @@ func (inc *IncomeSettlementContext) Collect() {
// avgEstimation returns estimation value for single container. Right now it
// simply calculates average of all announcements, however it can be smarter and
// base result on reputation of announcers and clever math.
func (inc *IncomeSettlementContext) avgEstimation(e *wrapper.Estimations) (avg uint64) {
func (inc *IncomeSettlementContext) avgEstimation(e *cntClient.Estimations) (avg uint64) {
if len(e.Values) == 0 {
return 0
}

View file

@ -7,14 +7,14 @@ import (
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
"github.com/nspcc-dev/neofs-sdk-go/owner"
"go.uber.org/zap"
)
type (
EstimationFetcher interface {
Estimations(uint64) ([]*wrapper.Estimations, error)
Estimations(uint64) ([]*container.Estimations, error)
}
RateFetcher interface {