forked from TrueCloudLab/frostfs-node
[#1382] ir: Replace deprecated methods
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d4be2f20d4
commit
a603d14d08
6 changed files with 10 additions and 10 deletions
|
@ -60,7 +60,7 @@ func (c *cleanupTable) update(snapshot netmap.NetMap, now uint64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
access.binNodeInfo = binNodeInfo
|
access.binNodeInfo = binNodeInfo
|
||||||
access.maintenance = nmNodes[i].IsMaintenance()
|
access.maintenance = nmNodes[i].Status().IsMaintenance()
|
||||||
|
|
||||||
newMap[keyString] = access
|
newMap[keyString] = access
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ func TestCleanupTable(t *testing.T) {
|
||||||
|
|
||||||
t.Run("skip maintenance nodes", func(t *testing.T) {
|
t.Run("skip maintenance nodes", func(t *testing.T) {
|
||||||
cnt := 0
|
cnt := 0
|
||||||
infos[1].SetMaintenance()
|
infos[1].SetStatus(netmap.Maintenance)
|
||||||
key := netmap.StringifyPublicKey(infos[1])
|
key := netmap.StringifyPublicKey(infos[1])
|
||||||
c.update(networkMap, 5)
|
c.update(networkMap, 5)
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ func TestAddPeer(t *testing.T) {
|
||||||
|
|
||||||
require.Nil(t, nc.notaryInvokes, "invalid notary invokes")
|
require.Nil(t, nc.notaryInvokes, "invalid notary invokes")
|
||||||
|
|
||||||
node.SetOnline()
|
node.SetStatus(netmap.Online)
|
||||||
ev = netmapEvent.AddPeer{
|
ev = netmapEvent.AddPeer{
|
||||||
NodeBytes: node.Marshal(),
|
NodeBytes: node.Marshal(),
|
||||||
Request: &payload.P2PNotaryRequest{
|
Request: &payload.P2PNotaryRequest{
|
||||||
|
|
|
@ -56,11 +56,11 @@ func (x *NetMapCandidateValidator) SetNetworkSettings(netSettings NetworkSetting
|
||||||
//
|
//
|
||||||
// See also netmap.NodeInfo.IsOnline/SetOnline and other similar methods.
|
// See also netmap.NodeInfo.IsOnline/SetOnline and other similar methods.
|
||||||
func (x *NetMapCandidateValidator) VerifyAndUpdate(node *netmap.NodeInfo) error {
|
func (x *NetMapCandidateValidator) VerifyAndUpdate(node *netmap.NodeInfo) error {
|
||||||
if node.IsOnline() {
|
if node.Status().IsOnline() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.IsMaintenance() {
|
if node.Status().IsMaintenance() {
|
||||||
return x.netSettings.MaintenanceModeAllowed()
|
return x.netSettings.MaintenanceModeAllowed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,22 +41,22 @@ func TestValidator_VerifyAndUpdate(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ONLINE",
|
name: "ONLINE",
|
||||||
preparer: (*netmap.NodeInfo).SetOnline,
|
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Online) },
|
||||||
valid: true,
|
valid: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "OFFLINE",
|
name: "OFFLINE",
|
||||||
preparer: (*netmap.NodeInfo).SetOffline,
|
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Offline) },
|
||||||
valid: false,
|
valid: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "MAINTENANCE/allowed",
|
name: "MAINTENANCE/allowed",
|
||||||
preparer: (*netmap.NodeInfo).SetMaintenance,
|
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Maintenance) },
|
||||||
valid: true,
|
valid: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "MAINTENANCE/disallowed",
|
name: "MAINTENANCE/disallowed",
|
||||||
preparer: (*netmap.NodeInfo).SetMaintenance,
|
preparer: func(ni *netmap.NodeInfo) { ni.SetStatus(netmap.Maintenance) },
|
||||||
valid: false,
|
valid: false,
|
||||||
validatorPreparer: func(v *state.NetMapCandidateValidator) {
|
validatorPreparer: func(v *state.NetMapCandidateValidator) {
|
||||||
var s testNetworkSettings
|
var s testNetworkSettings
|
||||||
|
|
|
@ -62,7 +62,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) bool {
|
||||||
// But there is no guarantee that code will be executed in the same order.
|
// But there is no guarantee that code will be executed in the same order.
|
||||||
// That is why we need to perform `addPeerIR` only in case when node is online,
|
// That is why we need to perform `addPeerIR` only in case when node is online,
|
||||||
// because in scope of this method, contract set state `ONLINE` for the node.
|
// because in scope of this method, contract set state `ONLINE` for the node.
|
||||||
if updated && nodeInfo.IsOnline() {
|
if updated && nodeInfo.Status().IsOnline() {
|
||||||
np.log.Info(logs.NetmapApprovingNetworkMapCandidate,
|
np.log.Info(logs.NetmapApprovingNetworkMapCandidate,
|
||||||
zap.String("key", keyString))
|
zap.String("key", keyString))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue