engine

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapEnvs

func MapEnvs(envs []string) map[string]string

MapEnvs map an array of string env

Types

type DefaultExecuter

type DefaultExecuter struct {
	Logger map[string]Logger
}

DefaultExecuter Execute task with a POSIX emulator

func (DefaultExecuter) Execute

func (e DefaultExecuter) Execute(ctx context.Context, elk *ox.Elk, name string) (int, error)

Execute task and returns a PID

type Engine

type Engine struct {
	Elk      *ox.Elk
	Executer Executer
}

Engine is the data structure responsible of processing the content

func (*Engine) Run

func (e *Engine) Run(ctx context.Context, task string) error

Run task declared in ox.yml file

type Executer

type Executer interface {
	Execute(context.Context, *ox.Elk, string) (int, error)
}

Executer runs a task and returns a PID and an error

type Logger

type Logger struct {
	StderrWriter io.Writer
	StdoutWriter io.Writer
	StdinReader  io.Reader
}

Logger is used by the engine to store the output

func DefaultLogger

func DefaultLogger() Logger

DefaultLogger is the standard output for a logger

func TimeStampLogger added in v0.5.0

func TimeStampLogger(logger Logger, format string) (Logger, error)

TimeStampLogger receives any logger and appends a timestamp in a specific format

type TimeStampWriter added in v0.5.0

type TimeStampWriter struct {
	TimeStamp func() string
	// contains filtered or unexported fields
}

TimeStampWriter attach a timestamp to each log

func (TimeStampWriter) GetDateFormat added in v0.6.0

func (t TimeStampWriter) GetDateFormat(format string) (string, error)

GetDateFormat returns a time format from a string

func (TimeStampWriter) Write added in v0.5.0

func (t TimeStampWriter) Write(p []byte) (int, error)

Writes timestamp to a writer

Jump to

Keyboard shortcuts

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