core

package
v0.9.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TaskStateLookup = map[TaskState]string{
		TaskDisabled: "Disabled",
		TaskStopped:  "Stopped",
		TaskSpinning: "Running",
		TaskFiring:   "Running",
		TaskEnded:    "Ended",
		TaskStopping: "Stopping",
	}
)

Functions

func JoinNamespace

func JoinNamespace(ns []string) string

Types

type AvailablePlugin

type AvailablePlugin interface {
	Plugin
	HitCount() int
	LastHit() time.Time
	ID() uint32
}

type CatalogedMetric

type CatalogedMetric interface {
	RequestedMetric
	LastAdvertisedTime() time.Time
	Policy() *cpolicy.ConfigPolicyNode
}

type CatalogedPlugin

type CatalogedPlugin interface {
	Plugin
	IsSigned() bool
	Status() string
	PluginPath() string
	LoadedTimestamp() *time.Time
}

the public interface for a plugin this should be the contract for how mgmt modules know a plugin

type Label

type Label struct {
	Index int    `json:"index"`
	Name  string `json:"name"`
}

type Metric

type Metric interface {
	RequestedMetric
	Config() *cdata.ConfigDataNode
	LastAdvertisedTime() time.Time
	Data() interface{}
	Source() string
	Labels() []Label
	Tags() map[string]string
	Timestamp() time.Time
}

Metric represents a snap metric collected or to be collected

type Plugin

type Plugin interface {
	TypeName() string
	Name() string
	Version() int
}

type PluginCatalog

type PluginCatalog []CatalogedPlugin

the collection of cataloged plugins used by mgmt modules

type PluginType

type PluginType int
const (
	// List of plugin type
	CollectorPluginType PluginType = iota
	ProcessorPluginType
	PublisherPluginType
)

func ToPluginType

func ToPluginType(name string) (PluginType, error)

func (PluginType) String

func (pt PluginType) String() string

type RequestedMetric

type RequestedMetric interface {
	Namespace() []string
	Version() int
}

RequestedMetric is a metric requested for collection

type RequestedPlugin

type RequestedPlugin struct {
	// contains filtered or unexported fields
}

func NewRequestedPlugin

func NewRequestedPlugin(path string) (*RequestedPlugin, error)

func (*RequestedPlugin) CheckSum

func (p *RequestedPlugin) CheckSum() [sha256.Size]byte

func (*RequestedPlugin) Path

func (p *RequestedPlugin) Path() string

func (*RequestedPlugin) ReadSignatureFile

func (p *RequestedPlugin) ReadSignatureFile(file string) error

func (*RequestedPlugin) SetPath

func (p *RequestedPlugin) SetPath(path string)

func (*RequestedPlugin) SetSignature

func (p *RequestedPlugin) SetSignature(data []byte)

func (*RequestedPlugin) Signature

func (p *RequestedPlugin) Signature() []byte

type SubscribedPlugin

type SubscribedPlugin interface {
	Plugin
	Config() *cdata.ConfigDataNode
}

type Task

type Task interface {
	ID() string
	// Status() WorkflowState TODO, switch to string
	State() TaskState
	HitCount() uint
	GetName() string
	SetName(string)
	SetID(string)
	MissedCount() uint
	FailedCount() uint
	LastFailureMessage() string
	LastRunTime() *time.Time
	CreationTime() *time.Time
	DeadlineDuration() time.Duration
	SetDeadlineDuration(time.Duration)
	SetTaskID(id string)
	SetStopOnFailure(uint)
	GetStopOnFailure() uint
	Option(...TaskOption) TaskOption
	WMap() *wmap.WorkflowMap
	Schedule() schedule.Schedule
}

type TaskErrors

type TaskErrors interface {
	Errors() []serror.SnapError
}

type TaskOption

type TaskOption func(Task) TaskOption

func OptionStopOnFailure

func OptionStopOnFailure(v uint) TaskOption

TaskStopOnFailure sets the tasks stopOnFailure The stopOnFailure is the number of consecutive task failures that will trigger disabling the task

func SetTaskID

func SetTaskID(id string) TaskOption

func SetTaskName

func SetTaskName(name string) TaskOption

SetTaskName sets the name of the task. This is optional. If task name is not set, the task name is then defaulted to "Task-<task-id>"

func TaskDeadlineDuration

func TaskDeadlineDuration(v time.Duration) TaskOption

TaskDeadlineDuration sets the tasks deadline. The deadline is the amount of time that can pass before a worker begins processing the tasks collect job.

type TaskState

type TaskState int
const (
	TaskDisabled TaskState = iota - 1
	TaskStopped
	TaskSpinning
	TaskFiring
	TaskEnded
	TaskStopping
)

func (TaskState) String

func (t TaskState) String() string

type TaskWatcherCloser

type TaskWatcherCloser interface {
	Close() error
}

type TaskWatcherHandler

type TaskWatcherHandler interface {
	CatchCollection([]Metric)
	CatchTaskStarted()
	CatchTaskStopped()
	CatchTaskDisabled(string)
}

type Workflow

type Workflow interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
	State() WorkflowState
}

type WorkflowState

type WorkflowState int
const (
	WorkflowStopped WorkflowState = iota
	WorkflowStarted
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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