frostfs-node/pkg/morph/event/handlers.go
Pavel Karpy c042f6a429 [#770] pkg/morph/event: Add notary notifications support
Add handlers and parsers functionality for listener.
Separate notification and notary events by files.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00

49 lines
1 KiB
Go

package event
import (
"github.com/nspcc-dev/neo-go/pkg/core/block"
)
// Handler is an Event processing function.
type Handler func(Event)
// BlockHandler is a chain block processing function.
type BlockHandler func(*block.Block)
// NotificationHandlerInfo is a structure that groups
// the parameters of the handler of particular
// contract event.
type NotificationHandlerInfo struct {
scriptHashWithType
h Handler
}
// SetHandler is an event handler setter.
func (s *NotificationHandlerInfo) SetHandler(v Handler) {
s.h = v
}
// Handler returns an event handler.
func (s NotificationHandlerInfo) Handler() Handler {
return s.h
}
// NotaryHandlerInfo is a structure that groups
// the parameters of the handler of particular
// notary event.
type NotaryHandlerInfo struct {
notaryRequestTypes
h Handler
}
// SetHandler is an event handler setter.
func (nhi *NotaryHandlerInfo) SetHandler(v Handler) {
nhi.h = v
}
// Handler returns an event handler.
func (nhi NotaryHandlerInfo) Handler() Handler {
return nhi.h
}