signal

package
v0.0.0-...-a5cec35 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventNodeStarted is triggered when underlying node is started
	EventNodeStarted = "node.started"

	// EventNodeReady is triggered when underlying node is fully ready
	// (consider backend to be fully registered)
	EventNodeReady = "node.ready"

	// EventNodeStopped is triggered when underlying node is fully stopped
	EventNodeStopped = "node.stopped"

	// EventNodeCrashed is triggered when node crashes
	EventNodeCrashed = "node.crashed"

	// EventChainDataRemoved is triggered when node's chain data is removed
	EventChainDataRemoved = "chaindata.removed"
)

Variables

This section is empty.

Functions

func NotifyNode

func NotifyNode(jsonEvent *C.char)

nolint: golint

func ResetDefaultNodeNotificationHandler

func ResetDefaultNodeNotificationHandler()

ResetDefaultNodeNotificationHandler sets notification handler to default one

func Send

func Send(signal Envelope)

Send sends application signal (JSON, normally) upwards to application (via default notification handler)

func SetDefaultNodeNotificationHandler

func SetDefaultNodeNotificationHandler(fn NodeNotificationHandler)

SetDefaultNodeNotificationHandler sets notification handler to invoke on Send

func TriggerDefaultNodeNotificationHandler

func TriggerDefaultNodeNotificationHandler(jsonEvent string)

TriggerDefaultNodeNotificationHandler triggers default notification handler (helpful in tests)

func TriggerTestSignal

func TriggerTestSignal()

nolint: golint

Types

type Envelope

type Envelope struct {
	Type  string      `json:"type"`
	Event interface{} `json:"event"`
}

Envelope is a general signal sent upward from node to RN app

type NodeCrashEvent

type NodeCrashEvent struct {
	Error error `json:"error"`
}

NodeCrashEvent is special kind of error, used to report node crashes

func (NodeCrashEvent) MarshalJSON

func (e NodeCrashEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

type NodeNotificationHandler

type NodeNotificationHandler func(jsonEvent string)

NodeNotificationHandler defines a handler able to process incoming node events. Events are encoded as JSON strings.

Jump to

Keyboard shortcuts

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