event

package
v0.24.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrongNumberOfParameters

func WrongNumberOfParameters(exp, act int) error

WrongNumberOfParameters returns an error about wrong number of smart contract parameters.

Types

type BlockHandler added in v0.15.0

type BlockHandler func(*block.Block)

BlockHandler is a chain block processing function.

type Event

type Event interface {
	MorphEvent()
}

Event is an interface that is provided by Neo:Morph event structures.

type Handler

type Handler func(Event)

Handler is an Event processing function.

func WorkerPoolHandler added in v0.19.0

func WorkerPoolHandler(w util2.WorkerPool, h Handler, log *zap.Logger) Handler

WorkerPoolHandler sets closure over worker pool w with passed handler h.

type HandlerInfo

type HandlerInfo struct {
	// contains filtered or unexported fields
}

HandlerInfo is a structure that groups the parameters of the handler of particular contract event.

func (HandlerInfo) Handler

func (s HandlerInfo) Handler() Handler

Handler returns an event handler.

func (*HandlerInfo) SetHandler

func (s *HandlerInfo) SetHandler(v Handler)

SetHandler is an event handler setter.

type Listener

type Listener interface {
	// Must start the event listener.
	//
	// Must listen to events with the parser installed.
	Listen(context.Context)

	// Must start the event listener.
	//
	// Must listen to events with the parser installed.
	//
	// Must send error to channel if subscriber channel has been closed or
	// it could not be started.
	ListenWithError(context.Context, chan<- error)

	// Must set the parser of particular contract event.
	//
	// Parser of each event must be set once. All parsers must be set before Listen call.
	//
	// Must ignore nil parsers and all calls after listener has been started.
	SetParser(ParserInfo)

	// Must register the event handler for particular notification event of contract.
	//
	// The specified handler must be called after each capture and parsing of the event
	//
	// Must ignore nil handlers.
	RegisterHandler(HandlerInfo)

	// Must stop the event listener.
	Stop()

	// Must register chain block handler.
	//
	// The specified handler must be called after each capture and parsing of the new block from chain.
	//
	// Must ignore nil handlers.
	RegisterBlockHandler(BlockHandler)
}

Listener is an interface of smart contract notification event listener.

func NewListener

func NewListener(p ListenerParams) (Listener, error)

NewListener create the notification event listener instance and returns Listener interface.

type ListenerParams

type ListenerParams struct {
	Logger *zap.Logger

	Subscriber subscriber.Subscriber
}

ListenerParams is a group of parameters for Listener constructor.

type Parser

type Parser func([]stackitem.Item) (Event, error)

Parser is a function that constructs Event from the StackItem list.

type ParserInfo

type ParserInfo struct {
	// contains filtered or unexported fields
}

ParserInfo is a structure that groups the parameters of particular contract notification event parser.

func (*ParserInfo) SetParser

func (s *ParserInfo) SetParser(v Parser)

SetParser is an event parser setter.

func (*ParserInfo) SetType

func (s *ParserInfo) SetType(v Type)

SetType is an event type setter.

type Type

type Type string

Type is a notification event enumeration type.

func TypeFromBytes

func TypeFromBytes(data []byte) Type

TypeFromBytes converts bytes slice to Type.

func TypeFromString

func TypeFromString(str string) Type

TypeFromString converts string to Type.

func (Type) Equal

func (t Type) Equal(t2 Type) bool

Equal compares two Type values and returns true if they are equal.

func (Type) String

func (t Type) String() string

String returns casted to string Type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL