hub

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: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

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

Hub links events to the config rules

func New

func New(host, tags, adminTok string, c *config.Config, storage store.Store, q *event.Queue) *Hub

New creates a new hub with the given config

func (*Hub) AllClientFindRun

func (h *Hub) AllClientFindRun(flowID, runID string) *client.Run

AllClientFindRun queries all hosts for the specified run

func (*Hub) AllClientRuns

func (h *Hub) AllClientRuns(flowID string) client.RunSummaries

AllClientRuns queries all hosts for their summaries for the given run ID

func (*Hub) AllHosts

func (h *Hub) AllHosts() map[string]client.HostConfig

AllHosts returns all the hosts

func (*Hub) AllRuns

func (h *Hub) AllRuns(id string) (pending Runs, active Runs, archive Runs)

AllRuns returns all the runs for this hub.

func (*Hub) Config

func (h *Hub) Config() config.Config

Config returns the config for this hub

func (*Hub) ExecutePending

func (h *Hub) ExecutePending(pend Pend) (bool, error)

ExecutePending executes a pending on this host if this host has no conflicts. This could have been called directly if this is the only host, or could have been called via the server API as a request for this host to accept the run. The boolean returned represents whether the flow was considered dealt with, meaning an attempt to start executing it occurred.

func (*Hub) FindRun

func (h *Hub) FindRun(flowID, runID string) *Run

FindRun returns an individual run as given by the flow and run.

func (*Hub) HostID

func (h *Hub) HostID() string

HostID returns the id for this host

func (*Hub) Notify

func (h *Hub) Notify(e event.Event)

Notify is called whenever an event is sent to the hub, satisfying event.Observer. This is the central dispatch of the two main event types adopted and un-adopted.

func (*Hub) Queue

func (h *Hub) Queue() *event.Queue

Queue returns the hubs queue

func (*Hub) Tags

func (h *Hub) Tags() []string

Tags returns the server tags

type Pend

type Pend struct {
	Ref           event.RunRef   // unique reference for this run
	Flow          *config.Flow   // Flow config as the pend was created
	TriggeredNode config.NodeRef // which node in the flow that triggered the creation
	Opts          nt.Opts        // the options that were relevant when the pend was created
}

Pend is a triggered flow that is waiting for a slave

func (Pend) String

func (t Pend) String() string

type Run

type Run struct {
	sync.RWMutex
	Ref        event.RunRef
	Flow       *config.Flow     // the config this flow should use
	ExecHost   string           // the id of the host who's actually executing this run
	StartTime  time.Time        // time the first event triggered
	EndTime    time.Time        // time the run ended
	Ended      bool             // Ended true if the run has finished
	Good       bool             // Good if explicit end node hit with a good event
	MergeNodes map[string]merge // the states of the merge nodes by node id
	DataNodes  map[string]data  // the sates of any data nodes
	ExecNodes  map[string]exec  // the sates of any exec nodes
}

Run is a specific invocation of a flow

type RunStore

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

RunStore stores runs

type Runs

type Runs []*Run

Runs is a list of Run

func (*Runs) Load

func (r *Runs) Load(key string, s store.Store) error

Load loads the runs

func (Runs) Save

func (r Runs) Save(key string, s store.Store) error

Save saves the runs

Jump to

Keyboard shortcuts

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