observer

package
v0.0.0-...-8aa4d74 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// An event relative to transactions
	Tx ResourceType = "tx"
	// An event relative to transactions in the transaction pool
	TxPool = "txpool"
	// An event relative to accounts (creation, update)
	Acc = "acc"
)
View Source
const (
	// All events related to the `ResourceType`
	All KeyType = "*"
	// "Identifier" of the item
	// Hash for a Transaction, address for an Account.
	Identifier = "identifier"
	// Tx/TxPool only: Transactions with a specified source
	Source = "source"
	// Tx/TxPool only: Transactions with a specified target
	Target = "target"
)

Variables

View Source
var ResourceObserver = observable.New()
View Source
var SyncBlockWaitObserver = observable.New()

Functions

This section is empty.

Types

type Condition

type Condition struct {
	// Affected ressource
	Resource ResourceType `json:"resource"`
	// Filter to use (can be `All)
	Key KeyType `json:"key"`
	// If `Key != All`, value of the filter
	Value string `json:"value"`
}

A Condition can be sent as the body when calling subscribe

func NewCondition

func NewCondition(resource ResourceType, key KeyType, v ...string) Condition

Instantiate a new `Condition` object

Params:

ressource = The requested `RessourceType` to stream
key       = The key to stream
v         = An optional value for key. Only the first value will be used.

Returns: A `Condition` object, that can be triggered or passed to `/subscribe`

func (Condition) String

func (c Condition) String() string

Implement `fmt.Stringer`

type Conditions

type Conditions []Condition

An array of Condition

func (Conditions) String

func (cs Conditions) String() string

Implement `fmt.Stringer`

type KeyType

type KeyType = string

The type of key that the event applies to (depends on the ressource)

type ResourceType

type ResourceType = string

The type of ressource that the event concerns

Jump to

Keyboard shortcuts

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