Version: v0.13.1 Latest Latest

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

Go to latest
Published: May 13, 2016 License: MIT Imports: 21 Imported by: 0




This section is empty.


View Source
var (
	ErrTaskExists       = errors.New("task already exists")
	ErrNoTaskExists     = errors.New("no task exists")
	ErrNoSnapshotExists = errors.New("no snapshot exists")


This section is empty.


type Config

type Config struct {
	// Deprecated, only needed to find old db and migrate
	Dir              string        `toml:"dir"`
	SnapshotInterval toml.Duration `toml:"snapshot-interval"`

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

type DBRP added in v0.13.0

type DBRP struct {
	Database        string
	RetentionPolicy string

type Service

type Service struct {
	StorageService interface {
		Store(namespace string) storage.Interface
	HTTPDService interface {
		AddRoutes([]httpd.Route) error
	TaskMaster interface {
			script string,
			tt kapacitor.TaskType,
			dbrps []kapacitor.DBRP,
			snapshotInterval time.Duration,
		) (*kapacitor.Task, error)
		StartTask(t *kapacitor.Task) (*kapacitor.ExecutingTask, error)
		StopTask(name string) error
		IsExecuting(name string) bool
		ExecutionStats(name string) (kapacitor.ExecutionStats, error)
		ExecutingDot(name string, labels bool) string
	// contains filtered or unexported fields

func NewService

func NewService(conf Config, l *log.Logger) *Service

func (*Service) Close

func (ts *Service) Close() error

func (*Service) HasSnapshot added in v0.10.0

func (ts *Service) HasSnapshot(id string) bool

func (*Service) Load

func (ts *Service) Load(id string) (*kapacitor.Task, error)

func (*Service) LoadSnapshot added in v0.10.0

func (ts *Service) LoadSnapshot(id string) (*kapacitor.TaskSnapshot, error)

func (*Service) Open

func (ts *Service) Open() error

func (*Service) SaveSnapshot added in v0.10.0

func (ts *Service) SaveSnapshot(id string, snapshot *kapacitor.TaskSnapshot) error

type Snapshot added in v0.13.0

type Snapshot struct {
	NodeSnapshots map[string][]byte

type SnapshotDAO added in v0.13.0

type SnapshotDAO interface {
	// Load a saved snapshot.
	// ErrNoSnapshotExists will be returned if HasSnapshot returns false.
	Get(id string) (*Snapshot, error)
	// Save a snapshot.
	Put(id string, snapshot *Snapshot) error
	// Whether a snapshot exists in the store.
	Exists(id string) (bool, error)

Data access object for Snapshot data.

type Status added in v0.13.0

type Status int
const (
	Disabled Status = iota

type Task added in v0.13.0

type Task struct {
	// Unique identifier for the task
	ID string
	// The task type (stream|batch).
	Type TaskType
	// The DBs and RPs the task is allowed to access.
	// The TICKscript for the task.
	TICKscript string
	// Last error the task had either while defining or executing.
	Error string
	// Status of the task
	Status Status
	// Created Date
	Created time.Time
	// The time the task was last modified
	Modified time.Time
	// The time the task was last changed to status Enabled.
	LastEnabled time.Time

type TaskDAO added in v0.13.0

type TaskDAO interface {
	// Retrieve a task
	Get(id string) (Task, error)

	// Create a task.
	// ErrTaskExists is returned if a task already exists with the same ID.
	Create(t Task) error

	// Replace an existing task.
	// ErrNoTaskExists is returned if the task does not exist.
	Replace(t Task) error

	// Delete a task.
	// It is not an error to delete an non-existent task.
	Delete(id string) error

	// List tasks matching a pattern.
	// The pattern is shell/glob matching see https://golang.org/pkg/path/#Match
	// Offset and limit are pagination bounds. Offset is inclusive starting at index 0.
	// More results may exist while the number of returned items is equal to limit.
	List(pattern string, offset, limit int) ([]Task, error)

Data access object for Task Snapshot data.

type TaskInfo

type TaskInfo struct {
	Name           string
	Type           kapacitor.TaskType
	DBRPs          []DBRP
	TICKscript     string
	Dot            string
	Enabled        bool
	Executing      bool
	Error          string
	ExecutionStats kapacitor.ExecutionStats

type TaskType added in v0.13.0

type TaskType int
const (
	StreamTask TaskType = iota

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL