crontainer

package
v0.0.0-...-7ff3c91 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorizeString

func ColorizeString(str string, clr int) string

ColorizeString colorizes a string with the given color and returns it

func Log

func Log(taskName string, message string)

Log loggs a message indicating the task's name

Types

type ColorMachine

type ColorMachine interface {
	Get(key interface{}) int
}

ColorMachine provides the interface for a color picker.

type ConfigurationManager

type ConfigurationManager interface {
	GetString(key string) string
	Get(key string) interface{}
	UnmarshalKey(key string, rawVal interface{}) error
}

type Cron

type Cron interface {
	Start()
	Stop()
	AddJob(string, cron.Job) error
}

Cron is an interface to a background processor.

type CronEngine

type CronEngine struct {
	Cron Cron
}

CronEngine is an adapter for the robfig/cron library

func NewCronEngine

func NewCronEngine() *CronEngine

NewCronEngine returns an initialized cron engine

func (*CronEngine) AddTask

func (e *CronEngine) AddTask(task Task) error

AddTask adds a task to the job list

func (*CronEngine) Initialize

func (e *CronEngine) Initialize(config ConfigurationManager)

Initialize reads tasks from config into internal structure

func (*CronEngine) Start

func (e *CronEngine) Start()

Start starts the cron engine

func (*CronEngine) Stop

func (e *CronEngine) Stop()

Stop stops the cron engine

type RoundRobinColorMachine

type RoundRobinColorMachine struct {
	AvailableColors []color.Attribute
	// contains filtered or unexported fields
}

RoundRobinColorMachine keeps a set of colors and cycles through them when requested with Pluck()

func NewRoundRobinColorMachine

func NewRoundRobinColorMachine() *RoundRobinColorMachine

NewRoundRobinColorMachine initialises a new round robin color machine

func (*RoundRobinColorMachine) Get

func (m *RoundRobinColorMachine) Get(key interface{}) int

Get loads the color for a given key. It gets a new color from the list if the key is unknown. The color is then remembered for the key.

func (*RoundRobinColorMachine) Pluck

func (m *RoundRobinColorMachine) Pluck() int

Pluck returns the first available color

type Task

type Task struct {
	Schedule string
	Name     string
	Type     string
	Command  *tasks.Command
	Color    int
}

Task defines the structure of one line of tasks from the config file

func (*Task) GetName

func (t *Task) GetName() string

GetName returns the task's name. If none is set it creates a random name.

func (*Task) Run

func (t *Task) Run()

Run is called by the scheduler to run this specific task. This method then defines how it executes the actual task.

type TaskType

type TaskType interface {
	// Run is called by the scheduler. It can return log messages via the channel.
	Run(feedbackChannel chan string)
}

TaskType defines an interface for all kinds of tasks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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