job

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CROKER_ID = "main"

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdJob

type CmdJob struct {
	// contains filtered or unexported fields
}

func NewCmdJob

func NewCmdJob(command string) *CmdJob

func (*CmdJob) Done

func (c *CmdJob) Done() <-chan struct{}

func (*CmdJob) SetWriter

func (s *CmdJob) SetWriter(w io.Writer)

func (*CmdJob) Start

func (c *CmdJob) Start() error

func (*CmdJob) Stop

func (c *CmdJob) Stop() error

type CronJob

type CronJob struct {
	// contains filtered or unexported fields
}

func NewCronJob

func NewCronJob(cronspec, command string) *CronJob

func (*CronJob) Done

func (c *CronJob) Done() <-chan struct{}

func (*CronJob) SetWriter

func (c *CronJob) SetWriter(w io.Writer)

func (*CronJob) Start

func (c *CronJob) Start() error

func (*CronJob) Stop

func (c *CronJob) Stop() error

type Job

type Job interface {
	Start() error
	Stop() error
	SetWriter(io.Writer)
	Done() <-chan struct{}
}

type JobInfo

type JobInfo struct {
	Command   string
	CronSpec  string
	IsRunning bool
	CreatedAt int64
	StartedAt int64
	StoppedAt int64
}

type JobManager

type JobManager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *JobManager

func (*JobManager) Add

func (j *JobManager) Add(cronspec, command string) (string, error)

func (*JobManager) Close

func (j *JobManager) Close()

func (*JobManager) FollowLog

func (j *JobManager) FollowLog(ctx context.Context, prefix string) (io.ReadCloser, error)

func (*JobManager) GetByPrefix

func (j *JobManager) GetByPrefix(prefix string) (Job, string, error)

func (*JobManager) Infos

func (j *JobManager) Infos() map[string]*JobInfo

func (*JobManager) Log

func (j *JobManager) Log(prefix string) (io.ReadCloser, error)

func (*JobManager) Remove

func (j *JobManager) Remove(prefix string) error

func (*JobManager) Start

func (j *JobManager) Start(prefix string) error

func (*JobManager) Stop

func (j *JobManager) Stop(prefix string) error

Jump to

Keyboard shortcuts

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