job

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJobAborted = errors.New("Aborted")

Functions

This section is empty.

Types

type Job added in v1.0.11

type Job interface {
	IsRunning() bool
	IsAborted() bool
	Abort()
	Start()
}

type JobLogMsg

type JobLogMsg struct {
	Lvl string
	Msg string
}

type JobLogWriter

type JobLogWriter struct {
	log.LogFilter
	log.LogFormatter
	// contains filtered or unexported fields
}

JobLogWriter implements log Writer Interface and writes messages to terminal.

func (*JobLogWriter) Clear

func (jlw *JobLogWriter) Clear()

Clear clear the output

func (*JobLogWriter) Close

func (jlw *JobLogWriter) Close()

Close implementing method. empty.

func (*JobLogWriter) Flush

func (jlw *JobLogWriter) Flush()

Flush implementing method. empty.

func (*JobLogWriter) GetMessages

func (jlw *JobLogWriter) GetMessages(start, limit int) []JobLogMsg

GetMessage get job log messages from start to start+limit. GetMessage(0, -1): get all message

func (*JobLogWriter) Write

func (jlw *JobLogWriter) Write(le *log.Event) (err error)

Write write message in console.

type JobRunner

type JobRunner struct {
	Run func()
	Log *log.Log
	Out JobLogWriter
	// contains filtered or unexported fields
}

func NewJobRunner

func NewJobRunner(run func(), logger ...log.Logger) *JobRunner

func (*JobRunner) Abort

func (jr *JobRunner) Abort()

func (*JobRunner) IsAborted

func (jr *JobRunner) IsAborted() bool

func (*JobRunner) IsRunning

func (jr *JobRunner) IsRunning() bool

func (*JobRunner) Start

func (jr *JobRunner) Start()

Jump to

Keyboard shortcuts

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