forked from TrueCloudLab/frostfs-node
[#280] ir: Add netmap processor unit tests
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
fb5dcc15d2
commit
d00b1c0d29
15 changed files with 690 additions and 41 deletions
|
@ -6,13 +6,16 @@ import (
|
|||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/netmap/nodevalidation/state"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/container"
|
||||
nmClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
|
||||
cntClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/container"
|
||||
netmapclient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
||||
netmapEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/netmap"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/mempoolevent"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
@ -51,6 +54,23 @@ type (
|
|||
VerifyAndUpdate(*netmap.NodeInfo) error
|
||||
}
|
||||
|
||||
Client interface {
|
||||
UpdatePeerState(p netmapclient.UpdatePeerPrm) error
|
||||
MorphNotaryInvoke(contract util.Uint160, fee fixedn.Fixed8, nonce uint32, vub *uint32, method string, args ...any) error
|
||||
ContractAddress() util.Uint160
|
||||
EpochDuration() (uint64, error)
|
||||
MorphTxHeight(h util.Uint256) (res uint32, err error)
|
||||
NetMap() (*netmap.NetMap, error)
|
||||
NewEpoch(epoch uint64, force bool) error
|
||||
MorphIsValidScript(script []byte, signers []transaction.Signer) (valid bool, err error)
|
||||
AddPeer(p netmapclient.AddPeerPrm) error
|
||||
MorphNotarySignAndInvokeTX(mainTx *transaction.Transaction) error
|
||||
}
|
||||
|
||||
ContainerClient interface {
|
||||
StartEstimation(p cntClient.StartEstimationPrm) error
|
||||
}
|
||||
|
||||
// Processor of events produced by network map contract
|
||||
// and new epoch ticker, because it is related to contract.
|
||||
Processor struct {
|
||||
|
@ -60,8 +80,8 @@ type (
|
|||
epochState EpochState
|
||||
alphabetState AlphabetState
|
||||
|
||||
netmapClient *nmClient.Client
|
||||
containerWrp *container.Client
|
||||
netmapClient Client
|
||||
containerWrp ContainerClient
|
||||
|
||||
netmapSnapshot cleanupTable
|
||||
|
||||
|
@ -79,13 +99,13 @@ type (
|
|||
Params struct {
|
||||
Log *logger.Logger
|
||||
PoolSize int
|
||||
NetmapClient *nmClient.Client
|
||||
NetmapClient Client
|
||||
EpochTimer EpochTimerReseter
|
||||
EpochState EpochState
|
||||
AlphabetState AlphabetState
|
||||
CleanupEnabled bool
|
||||
CleanupThreshold uint64 // in epochs
|
||||
ContainerWrapper *container.Client
|
||||
ContainerWrapper ContainerClient
|
||||
|
||||
AlphabetSyncHandler event.Handler
|
||||
NotaryDepositHandler event.Handler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue