types

package
v0.0.0-...-80b3c92 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainCategory = "main"

	RegSchedulerCategory = "regSchduler"

	RunJobCategory = "runJob"

	HttpJobCategory = "httpJob"
)

* 定义日志目录类型

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorize

type Authorize struct {
	Mode    string   `toml:"mode"`    //授权模式
	AuthKey string   `toml:"authKey"` //默认授权key
	Users   []string `toml:"users"`   //用户集合
}

type HttpServer

type HttpServer struct {
	ListenAddr string `toml:"listenAddr"`
	Storage    string `toml:"storage"`
}

type RedisConf

type RedisConf struct {
	Addr     string `toml:"addr"`
	Password string `toml:"password"`
	DB       int    `toml:"db"`
}

redis设置

type RunTaskResult

type RunTaskResult struct {
	Status    string        `json:"status"`    //状态 isRunning,isFinished
	StartTime time.Time     `json:"startTime"` //开始时间
	Duration  time.Duration `json:"duration"`  //间隔时间
}

type Sys

type Sys struct {
}

系统变量

type Task

type Task struct {
	TaskType   int            `toml:"taskType"`   //任务类型: 1-CommandLine ,2- Http
	Name       string         `toml:"name"`       //任务名称,不唯一
	Instances  int            `toml:"instances"`  // 执行时设定的并发实例,默认配置 1
	Exclusive  bool           `toml:"exclusive"`  // 任务执行期间是否允许排他,即本次计划未完成,下次时间满足也必须等待或抛弃
	RunEnv     string         `toml:"runEnv"`     //当且命令行模式,这里就是/usr/bin/php
	HttpMethod string         `toml:"httpMethod"` //支持http的方法, POST OR GET
	Path       string         `toml:"path"`       //执行路径
	Args       []string       `toml:"args"`       //参数列表
	Cron       string         `toml:"cron"`       //执行时间计划满足Unix时间要求
	Wg         sync.WaitGroup //当前任务计划执行的并发控制,当所有实例结束计划任务才能退出
}

Task任务节点

type TaskLocker

type TaskLocker struct {
	LockerType string `toml:"lockerType"`
	LockerWait bool   `toml:"lockerWait"`
}

locker设置

type TomlConfig

type TomlConfig struct {
	System     Sys             `toml:"system"`
	HttpServer HttpServer      `toml:"httpServer"`
	Locker     TaskLocker      `toml:"locker"`
	Redis      RedisConf       `toml:"redis"`
	Tasks      map[string]Task `toml:"tasks"`     //任务节点key为任务唯一标识,value为任务内容
	Authorize  Authorize       `toml:"authorize"` //授权节点
}

toml文件的主节点

Jump to

Keyboard shortcuts

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