forked from TrueCloudLab/frostfs-node
[#770] pkg/morph: Rename all parsers and handlers structs/interfaces
Prepare all listening structures for notary events: rename(add prefix/suffix 'notification') all notification specific handlers/parsers. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
c87bc70536
commit
d252aa4a3e
16 changed files with 174 additions and 175 deletions
|
@ -82,17 +82,17 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerParsers() []event.ParserInfo {
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (np *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (np *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -116,18 +116,18 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (ap *Processor) ListenerParsers() []event.ParserInfo {
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (ap *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (ap *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (ap *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (ap *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (ap *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -76,12 +76,12 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (bp *Processor) ListenerParsers() []event.ParserInfo {
|
||||
var parsers []event.ParserInfo
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (bp *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
var parsers []event.NotificationParserInfo
|
||||
|
||||
// new lock event
|
||||
lock := event.ParserInfo{}
|
||||
lock := event.NotificationParserInfo{}
|
||||
lock.SetType(lockNotification)
|
||||
lock.SetScriptHash(bp.balanceContract)
|
||||
lock.SetParser(balanceEvent.ParseLock)
|
||||
|
@ -90,12 +90,12 @@ func (bp *Processor) ListenerParsers() []event.ParserInfo {
|
|||
return parsers
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (bp *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
var handlers []event.HandlerInfo
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (bp *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
var handlers []event.NotificationHandlerInfo
|
||||
|
||||
// lock handler
|
||||
lock := event.HandlerInfo{}
|
||||
lock := event.NotificationHandlerInfo{}
|
||||
lock.SetType(lockNotification)
|
||||
lock.SetScriptHash(bp.balanceContract)
|
||||
lock.SetHandler(bp.handleLock)
|
||||
|
@ -105,6 +105,6 @@ func (bp *Processor) ListenerHandlers() []event.HandlerInfo {
|
|||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (bp *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (bp *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -92,12 +92,12 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (cp *Processor) ListenerParsers() []event.ParserInfo {
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (cp *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
var (
|
||||
parsers = make([]event.ParserInfo, 0, 3)
|
||||
parsers = make([]event.NotificationParserInfo, 0, 3)
|
||||
|
||||
p event.ParserInfo
|
||||
p event.NotificationParserInfo
|
||||
)
|
||||
|
||||
p.SetScriptHash(cp.containerContract)
|
||||
|
@ -120,12 +120,12 @@ func (cp *Processor) ListenerParsers() []event.ParserInfo {
|
|||
return parsers
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (cp *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (cp *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
var (
|
||||
handlers = make([]event.HandlerInfo, 0, 3)
|
||||
handlers = make([]event.NotificationHandlerInfo, 0, 3)
|
||||
|
||||
h event.HandlerInfo
|
||||
h event.NotificationHandlerInfo
|
||||
)
|
||||
|
||||
h.SetScriptHash(cp.containerContract)
|
||||
|
@ -149,6 +149,6 @@ func (cp *Processor) ListenerHandlers() []event.HandlerInfo {
|
|||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (cp *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (cp *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -128,25 +128,25 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (gp *Processor) ListenerParsers() []event.ParserInfo {
|
||||
var pi event.ParserInfo
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (gp *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
var pi event.NotificationParserInfo
|
||||
pi.SetScriptHash(gp.designate)
|
||||
pi.SetType(event.TypeFromString(native.DesignationEventName))
|
||||
pi.SetParser(rolemanagement.ParseDesignate)
|
||||
return []event.ParserInfo{pi}
|
||||
return []event.NotificationParserInfo{pi}
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (gp *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
var hi event.HandlerInfo
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (gp *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
var hi event.NotificationHandlerInfo
|
||||
hi.SetScriptHash(gp.designate)
|
||||
hi.SetType(event.TypeFromString(native.DesignationEventName))
|
||||
hi.SetHandler(gp.HandleAlphabetSync)
|
||||
return []event.HandlerInfo{hi}
|
||||
return []event.NotificationHandlerInfo{hi}
|
||||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (gp *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (gp *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -129,12 +129,12 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerParsers() []event.ParserInfo {
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
var (
|
||||
parsers = make([]event.ParserInfo, 0, 6)
|
||||
parsers = make([]event.NotificationParserInfo, 0, 6)
|
||||
|
||||
p event.ParserInfo
|
||||
p event.NotificationParserInfo
|
||||
)
|
||||
|
||||
p.SetScriptHash(np.neofsContract)
|
||||
|
@ -172,12 +172,12 @@ func (np *Processor) ListenerParsers() []event.ParserInfo {
|
|||
return parsers
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
var (
|
||||
handlers = make([]event.HandlerInfo, 0, 6)
|
||||
handlers = make([]event.NotificationHandlerInfo, 0, 6)
|
||||
|
||||
h event.HandlerInfo
|
||||
h event.NotificationHandlerInfo
|
||||
)
|
||||
|
||||
h.SetScriptHash(np.neofsContract)
|
||||
|
@ -216,6 +216,6 @@ func (np *Processor) ListenerHandlers() []event.HandlerInfo {
|
|||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (np *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (np *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -146,26 +146,26 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerParsers() []event.ParserInfo {
|
||||
var parsers []event.ParserInfo
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
var parsers []event.NotificationParserInfo
|
||||
|
||||
// new epoch event
|
||||
newEpoch := event.ParserInfo{}
|
||||
newEpoch := event.NotificationParserInfo{}
|
||||
newEpoch.SetType(newEpochNotification)
|
||||
newEpoch.SetScriptHash(np.netmapContract)
|
||||
newEpoch.SetParser(netmapEvent.ParseNewEpoch)
|
||||
parsers = append(parsers, newEpoch)
|
||||
|
||||
// new peer event
|
||||
addPeer := event.ParserInfo{}
|
||||
addPeer := event.NotificationParserInfo{}
|
||||
addPeer.SetType(addPeerNotification)
|
||||
addPeer.SetScriptHash(np.netmapContract)
|
||||
addPeer.SetParser(netmapEvent.ParseAddPeer)
|
||||
parsers = append(parsers, addPeer)
|
||||
|
||||
// update peer event
|
||||
updatePeer := event.ParserInfo{}
|
||||
updatePeer := event.NotificationParserInfo{}
|
||||
updatePeer.SetType(updatePeerStateNotification)
|
||||
updatePeer.SetScriptHash(np.netmapContract)
|
||||
updatePeer.SetParser(netmapEvent.ParseUpdatePeer)
|
||||
|
@ -174,26 +174,26 @@ func (np *Processor) ListenerParsers() []event.ParserInfo {
|
|||
return parsers
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
var handlers []event.HandlerInfo
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (np *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
var handlers []event.NotificationHandlerInfo
|
||||
|
||||
// new epoch handler
|
||||
newEpoch := event.HandlerInfo{}
|
||||
newEpoch := event.NotificationHandlerInfo{}
|
||||
newEpoch.SetType(newEpochNotification)
|
||||
newEpoch.SetScriptHash(np.netmapContract)
|
||||
newEpoch.SetHandler(np.handleNewEpoch)
|
||||
handlers = append(handlers, newEpoch)
|
||||
|
||||
// new peer handler
|
||||
addPeer := event.HandlerInfo{}
|
||||
addPeer := event.NotificationHandlerInfo{}
|
||||
addPeer.SetType(addPeerNotification)
|
||||
addPeer.SetScriptHash(np.netmapContract)
|
||||
addPeer.SetHandler(np.handleAddPeer)
|
||||
handlers = append(handlers, addPeer)
|
||||
|
||||
// update peer handler
|
||||
updatePeer := event.HandlerInfo{}
|
||||
updatePeer := event.NotificationHandlerInfo{}
|
||||
updatePeer.SetType(updatePeerStateNotification)
|
||||
updatePeer.SetScriptHash(np.netmapContract)
|
||||
updatePeer.SetHandler(np.handleUpdateState)
|
||||
|
@ -203,6 +203,6 @@ func (np *Processor) ListenerHandlers() []event.HandlerInfo {
|
|||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (np *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (np *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -88,12 +88,12 @@ func New(p *Params) (*Processor, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// ListenerParsers for the 'event.Listener' event producer.
|
||||
func (rp *Processor) ListenerParsers() []event.ParserInfo {
|
||||
var parsers []event.ParserInfo
|
||||
// ListenerNotificationParsers for the 'event.Listener' event producer.
|
||||
func (rp *Processor) ListenerNotificationParsers() []event.NotificationParserInfo {
|
||||
var parsers []event.NotificationParserInfo
|
||||
|
||||
// put reputation event
|
||||
put := event.ParserInfo{}
|
||||
put := event.NotificationParserInfo{}
|
||||
put.SetType(putReputationNotification)
|
||||
put.SetScriptHash(rp.reputationContract)
|
||||
put.SetParser(reputationEvent.ParsePut)
|
||||
|
@ -102,12 +102,12 @@ func (rp *Processor) ListenerParsers() []event.ParserInfo {
|
|||
return parsers
|
||||
}
|
||||
|
||||
// ListenerHandlers for the 'event.Listener' event producer.
|
||||
func (rp *Processor) ListenerHandlers() []event.HandlerInfo {
|
||||
var handlers []event.HandlerInfo
|
||||
// ListenerNotificationHandlers for the 'event.Listener' event producer.
|
||||
func (rp *Processor) ListenerNotificationHandlers() []event.NotificationHandlerInfo {
|
||||
var handlers []event.NotificationHandlerInfo
|
||||
|
||||
// put reputation handler
|
||||
put := event.HandlerInfo{}
|
||||
put := event.NotificationHandlerInfo{}
|
||||
put.SetType(putReputationNotification)
|
||||
put.SetScriptHash(rp.reputationContract)
|
||||
put.SetHandler(rp.handlePutReputation)
|
||||
|
@ -117,6 +117,6 @@ func (rp *Processor) ListenerHandlers() []event.HandlerInfo {
|
|||
}
|
||||
|
||||
// TimersHandlers for the 'Timers' event producer.
|
||||
func (rp *Processor) TimersHandlers() []event.HandlerInfo {
|
||||
func (rp *Processor) TimersHandlers() []event.NotificationHandlerInfo {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue