brokers

package
v0.0.0-...-3ff8f60 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Name        string        `json:"name"`
	Task        chan Task     `json:"-"`
	Distinct    bool          `json:"distinct"`
	WorkerCount int           `json:"worker_count"`
	StopChan    chan struct{} `json:"-"`
	OutputChan  chan Output   `json:"-"`
}

Channel is the command queue

type Output

type Output struct {
	ProcessID string
	Type      string // 输出类型: stdout/stderr
	Task      Task
	Content   string
}

Output 任务执行输出

type PrepareTask

type PrepareTask struct {
	ID        string      `json:"id"`
	Name      string      `json:"task"`
	Command   TaskCommand `json:"command"`
	Channel   string      `json:"chan"`
	Timestamp int64       `json:"ts"`
	ExecuteAt int64       `json:"execute_at"`
}

PrepareTask is the task that prepared to join queue

type Task

type Task struct {
	ID           string      `json:"task_id"`
	TaskName     string      `json:"task_name"`
	Command      TaskCommand `json:"command"`
	Channel      string      `json:"channel"`
	Status       string      `json:"status"`
	ExecAt       time.Time   `json:"execute_at"`
	RetryCount   int         `json:"retry_count"`
	FailedAt     time.Time   `json:"failed_at"`
	WriteBackend bool        `json:"write_backend"`
}

Task represent a task object

type TaskCommand

type TaskCommand struct {
	Name string        `json:"name"`
	Args []interface{} `json:"args"`
}

TaskCommand represent a task command object

func (TaskCommand) Format

func (cmd TaskCommand) Format() string

Format format command struct to string

func (TaskCommand) GetArgsString

func (cmd TaskCommand) GetArgsString() []string

GetArgsString 以字符串数组的形式返回参数集合

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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