Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Notify ¶ added in v0.1.1
func Notify(typ EventType, data interface{})
Notify sends a notification with the passed type and data if the caller requested notifications by providing a callback function in the call to New.
func Subscribe ¶ added in v0.1.1
func Subscribe(callback EventCallback)
Subscribe to block chain notifications. Registers a callback to be executed when various events take place. See the documentation on Event and EventType for details on the types and contents of notifications.
Types ¶
type Event ¶
type Event struct { Type EventType Data interface{} }
Event defines notification that is sent to the caller via the callback function provided during the call to New and consists of a notification type as well as associated data that depends on the type as follows:
- ETBlockAccepted: *types.Block
- ETBlockConnected: *types.Block
- ETBlockDisconnected: *types.Block
- ETTransactionAccepted: *types.Transaction
type EventCallback ¶ added in v0.1.1
type EventCallback func(*Event)
EventCallback is used for a caller to provide a callback for notifications about various chain events.
type EventType ¶
type EventType int
EventType represents the type of a event message.
const ( // ETBlockAccepted indicates the associated block was accepted into // the block chain. Note that this does not necessarily mean it was // added to the main chain. For that, use ETBlockConnected. ETBlockAccepted EventType = iota // ETBlockConnected indicates the associated block was connected to the // main chain. ETBlockConnected // ETBlockDisconnected indicates the associated block was disconnected // from the main chain. ETBlockDisconnected // ETTransactionAccepted indicates the associated transaction was accepted // into transaction mem pool. ETTransactionAccepted )
Constants for the type of a notification message.