event

package
v0.0.0-...-817c61a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// RunRef if this event is in the scope of a specific run
	// if nil then is a general event that could be routed to triggers
	RunRef RunRef

	// SourceNode is the Ref of the node in the context of a RunRef
	SourceNode config.NodeRef

	// Tag is the label that helps route the event.
	// it will match node.Type for trigger nodes, and node.Listen for task and merge nodes.
	Tag string

	// Good specifically when this is classed as a good event
	Good bool

	// Unique and ordered event ID within a Run. An ID greater than another
	// ID must have happened after it within the context of the RunRef.
	// A flow initiating trigger will have ID 1.
	ID int64

	// Opts - some optional data in the event
	Opts nt.Opts
}

Event defines a moment in time thing occurring

func (*Event) IsSystem

func (e *Event) IsSystem() bool

IsSystem returns true if the event is a internal system event

func (*Event) SetGood

func (e *Event) SetGood()

SetGood sets this event as a good event

type HostedIDRef

type HostedIDRef struct {
	HostID string
	ID     int64
}

HostedIDRef is any ID unique within the scope of the host that created it.

func (HostedIDRef) Equal

func (h HostedIDRef) Equal(g HostedIDRef) bool

Equal returns true if h and g are considered equal

func (HostedIDRef) Equals

func (h HostedIDRef) Equals(rh HostedIDRef) bool

Equals compares receiver with param rh

func (HostedIDRef) String

func (h HostedIDRef) String() string

type Observer

type Observer interface {
	Notify(e Event)
}

Observer defines the interface for observers.

type Queue

type Queue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Queue is not strictly a queue, it just distributes all events to the observers

func (*Queue) Publish

func (q *Queue) Publish(e Event)

Publish sends an event to all the observers

func (*Queue) Register

func (q *Queue) Register(o Observer)

Register registers an observer to this q

type RunRef

type RunRef struct {
	// FlowRef identifies the flow that this reference relates to
	FlowRef config.FlowRef

	// Run identifies the host and id that this run was initiated by.
	// This is a cluster unique reference, which may not refer to the node that is
	// executing the Run (that will be defined by ExecHost)
	Run HostedIDRef

	// ExecHost is the host that is actually executing, or executed this event,
	// use in conjunction with Run to find the active and archived run
	ExecHost string
}

RunRef uniquely identifies and routes a particular run across the whole cluster

func (RunRef) Adopted

func (r RunRef) Adopted() bool

Adopted means that this RunRef has been added to a pending list and been assigned a unique run ID

func (RunRef) Equal

func (r RunRef) Equal(s RunRef) bool

Equal returns true ir r and s are considered to refer to the same thing

func (RunRef) String

func (r RunRef) String() string

Jump to

Keyboard shortcuts

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