forked from TrueCloudLab/frostfs-node
[#374] Add inner-ring event metrics
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
8dcd06c587
commit
ebcc8afbee
27 changed files with 287 additions and 113 deletions
|
@ -12,10 +12,10 @@ import (
|
|||
|
||||
// Process add peer notification by sanity check of new node
|
||||
// local epoch timer.
|
||||
func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
||||
func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) bool {
|
||||
if !np.alphabetState.IsAlphabet() {
|
||||
np.log.Info(logs.NetmapNonAlphabetModeIgnoreNewPeerNotification)
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
// check if notary transaction is valid, see #976
|
||||
|
@ -26,7 +26,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
|||
zap.String("method", "netmap.AddPeer"),
|
||||
zap.String("hash", tx.Hash().StringLE()),
|
||||
zap.Error(err))
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
// unmarshal node info
|
||||
|
@ -34,7 +34,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
|||
if err := nodeInfo.Unmarshal(ev.Node()); err != nil {
|
||||
// it will be nice to have tx id at event structure to log it
|
||||
np.log.Warn(logs.NetmapCantParseNetworkMapCandidate)
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
// validate and update node info
|
||||
|
@ -44,7 +44,7 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
|||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
// sort attributes to make it consistent
|
||||
|
@ -81,15 +81,18 @@ func (np *Processor) processAddPeer(ev netmapEvent.AddPeer) {
|
|||
|
||||
if err != nil {
|
||||
np.log.Error(logs.NetmapCantInvokeNetmapAddPeer, zap.Error(err))
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Process update peer notification by sending approval tx to the smart contract.
|
||||
func (np *Processor) processUpdatePeer(ev netmapEvent.UpdatePeer) {
|
||||
func (np *Processor) processUpdatePeer(ev netmapEvent.UpdatePeer) bool {
|
||||
if !np.alphabetState.IsAlphabet() {
|
||||
np.log.Info(logs.NetmapNonAlphabetModeIgnoreUpdatePeerNotification)
|
||||
return
|
||||
return true
|
||||
}
|
||||
|
||||
// flag node to remove from local view, so it can be re-bootstrapped
|
||||
|
@ -105,11 +108,14 @@ func (np *Processor) processUpdatePeer(ev netmapEvent.UpdatePeer) {
|
|||
zap.Error(err),
|
||||
)
|
||||
|
||||
return
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if err = np.netmapClient.MorphNotarySignAndInvokeTX(ev.NotaryRequest().MainTransaction); err != nil {
|
||||
np.log.Error(logs.NetmapCantInvokeNetmapUpdatePeer, zap.Error(err))
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue