Version: v0.0.0-...-dfe7cbe Latest Latest

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

Go to latest
Published: May 7, 2016 License: MIT Imports: 17 Imported by: 1




This section is empty.


View Source
var ConfigWorkspaces = make(map[string]*ConfigWorkspace)

ConfigWorkspaces is the user workspace configs

Log is the in-memory application log for websysd

View Source
var Workspaces = make(map[string]*Workspace)

Workspaces is the user workspaces


func AddDefaultVars

func AddDefaultVars(vars map[string]string) map[string]string

AddDefaultVars adds the USER, UID, GID and HOME environment variables

func LoadConfig

func LoadConfig(global string, workspaces []string)

LoadConfig loads a set of config files

func ReplaceVars

func ReplaceVars(text string, vars map[string]string) string

ReplaceVars replaces environment variables


type AppendSliceValue

type AppendSliceValue []string

AppendSliceValue implements the flag.Value interface and allows multiple calls to the same variable to append a list.

func (*AppendSliceValue) Set

func (s *AppendSliceValue) Set(value string) error

Set implements flag.Value.Set

func (*AppendSliceValue) String

func (s *AppendSliceValue) String() string

type Appender

type Appender struct {
	// contains filtered or unexported fields

Appender is a log appender

func NewAppender

func NewAppender() *Appender

NewAppender returns a new appender

func (*Appender) Layout

func (a *Appender) Layout() layout.Layout

Layout returns the layout

func (*Appender) SetLayout

func (a *Appender) SetLayout(layout layout.Layout)

SetLayout sets the layout

func (*Appender) Write

func (a *Appender) Write(level levels.LogLevel, message string, args ...interface{})

type ConfigFunction

type ConfigFunction struct {
	Args     []string
	Command  string
	Executor []string

ConfigFunction is the config for a function

type ConfigTask

type ConfigTask struct {
	ID          int
	Name        string
	Command     string
	Environment map[string]string
	Service     bool
	Executor    []string
	Stdout      string
	Stderr      string
	Metadata    map[string]string
	Pwd         string

ConfigTask is the config for a task

type ConfigWorkspace

type ConfigWorkspace struct {
	Functions          map[string]*ConfigFunction
	Environment        map[string]string
	Name               string
	Tasks              []*ConfigTask
	IsLocked           bool
	Columns            map[string]map[string][]string
	InheritEnvironment bool

ConfigWorkspace is the config for a workspace

var GlobalConfigWorkspace *ConfigWorkspace

GlobalConfigWorkspace is the global workspace config

func LoadConfigFile

func LoadConfigFile(file string) (*ConfigWorkspace, error)

LoadConfigFile loads a config file and returns a ConfigWorkspace

type Event

type Event struct {
	Time    time.Time
	Message string

Event represents an event

type FileLogWriter

type FileLogWriter struct {
	// contains filtered or unexported fields

FileLogWriter is a log writer for files

func NewFileLogWriter

func NewFileLogWriter(file string) (*FileLogWriter, error)

NewFileLogWriter returns a new FileLogWriter

func (FileLogWriter) Close

func (flw FileLogWriter) Close()

Close closes the log writer

func (FileLogWriter) Len

func (flw FileLogWriter) Len() int64

Len returns the length of the file

func (FileLogWriter) String

func (flw FileLogWriter) String() string

func (FileLogWriter) Write

func (flw FileLogWriter) Write(p []byte) (n int, err error)

type Function

type Function struct {
	Name     string
	Args     []string
	Command  string
	Executor []string

Function represents a function

type InMemoryLogWriter

type InMemoryLogWriter struct {
	// contains filtered or unexported fields

InMemoryLogWriter is an in memory log writer

func NewInMemoryLogWriter

func NewInMemoryLogWriter() InMemoryLogWriter

NewInMemoryLogWriter returns a new InMemoryLogWriter

func (InMemoryLogWriter) Close

func (imlw InMemoryLogWriter) Close()

Close closes the writer

func (InMemoryLogWriter) Len

func (imlw InMemoryLogWriter) Len() int64

Len returns the length of the content

func (InMemoryLogWriter) String

func (imlw InMemoryLogWriter) String() string

func (InMemoryLogWriter) Write

func (imlw InMemoryLogWriter) Write(p []byte) (n int, err error)

type LogWriter

type LogWriter interface {
	Write(p []byte) (n int, err error)
	String() string
	Len() int64

LogWriter is a log writer

type Task

type Task struct {
	ID          int
	Name        string
	Command     string
	Executor    []string
	Environment map[string]string
	Stdout      string
	Stderr      string
	Metadata    map[string]string
	Pwd         string

	ActiveTask *TaskRun
	TaskRuns   []*TaskRun

	Service bool

Task represents an individual task

func NewTask

func NewTask(workspace *Workspace, name string, executor []string, command string, environment map[string]string, service bool, stdout string, stderr string, metadata map[string]string, pwd string) *Task

NewTask returns a new Task

func (*Task) GetExecutor

func (t *Task) GetExecutor() string

GetExecutor gets the task executor

func (*Task) NewTaskRun

func (t *Task) NewTaskRun() *TaskRun

NewTaskRun returns a new TaskRun for the Task

func (*Task) Start

func (t *Task) Start() chan int

Start starts a task

func (*Task) Status

func (t *Task) Status() string

Status returns a string representation of the current task status

func (*Task) Stop

func (t *Task) Stop()

Stop stops a task

type TaskRun

type TaskRun struct {
	Id          int
	Cmd         *exec.Cmd
	Error       error
	Started     time.Time
	Stopped     time.Time
	Events      []*Event
	Command     string
	Stdout      string
	Stderr      string
	StdoutBuf   LogWriter
	StderrBuf   LogWriter
	Environment map[string]string
	Executor    []string
	WaitStatus  syscall.WaitStatus
	Pwd         string

func (*TaskRun) Start

func (tr *TaskRun) Start(exitCh chan int)

func (*TaskRun) Stop

func (tr *TaskRun) Stop()

func (*TaskRun) String

func (tr *TaskRun) String() string

type Workspace

type Workspace struct {
	Name               string
	Environment        map[string]string
	Tasks              map[string]*Task
	IsLocked           bool
	Functions          map[string]*Function
	Columns            map[string]map[string][]string
	InheritEnvironment bool

Workspace is a user workspace

var GlobalWorkspace *Workspace

GlobalWorkspace is the global workspace

func NewWorkspace

func NewWorkspace(name string, environment map[string]string, columns map[string]map[string][]string, inheritEnv bool) *Workspace

NewWorkspace returns a new workspace

func (*Workspace) ActiveTasks

func (ws *Workspace) ActiveTasks() int

ActiveTasks returns the number of active tasks in a workspace

func (*Workspace) ExecFunction

func (ws *Workspace) ExecFunction(task *Task, name string, args ...string) string

ExecFunction executes a function task

func (*Workspace) GetColumn

func (ws *Workspace) GetColumn(task *Task, name string) string

GetColumn returns a workspace column

func (*Workspace) InactiveTasks

func (ws *Workspace) InactiveTasks() int

InactiveTasks returns the number of inactive tasks in a workspace

func (*Workspace) PercentActive

func (ws *Workspace) PercentActive() int

PercentActive returns the percentage of tasks active in a workspace

func (*Workspace) PercentInactive

func (ws *Workspace) PercentInactive() int

PercentInactive returns the percentage of tasks inactive in a workspace

func (*Workspace) TotalTasks

func (ws *Workspace) TotalTasks() int

TotalTasks returns the total number of tasks in a workspace

Jump to

Keyboard shortcuts

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