Documentation ¶
Index ¶
- Constants
- Variables
- type CreateNewNodeCmd
- type CreateNode
- type DatabaseConfig
- type GenericMsg
- type GoTaskFuncInfo
- type HeartbeatMsg
- type HeartbeatReplyMsg
- type HttpRequestTask
- type Ip
- type Node
- type NodeQueryCmd
- type RMQ
- type RegisterMsg
- type RegisterReplyMsg
- type ScheduledJob
- type SendMsg
- type ShellTaskInfo
- type Task
- type TaskCreate
- type TaskCreateCommand
- type TaskDto
- type TaskQueryCmd
- type TaskReplyMsg
- type TaskType
- type TaskUpdate
- type TaskUpdateCommand
- type UpdateNode
- type UpdateNodeCmd
Constants ¶
View Source
const ( HEARTBEAT_SUCCESS = "success" HEARTBEAT_FAILED = "failed" )
View Source
const ( MSG_TYPE_REGISTER_MSG = "registerMsg" MSG_TYPE_REGISTER_REPLY_MSG = "registerReplyMsg" MSG_TYPE_HEARTBEAT_MSG = "heartbeatMsg" MSG_TYPE_HEARTBEAT_REPLY_MSG = "heartbeatReplyMsg" MSG_TYPE_TASK_MSG = "taskMsg" MSG_TYPE_TASK_REPLY_MSG = "taskReplyMsg" )
View Source
const ( NODE_STATUS_CONNECTING = "connecting" NODE_STATUS_ONLINE = "online" NODE_STATUS_OFFLINE = "offline" )
View Source
const ( REGISTER_SUCCESS = "success" REGISTER_FAILED = "failed" )
View Source
const ( TASK_TYPE_SHELL = TaskType("shell") TASK_TYPE_GO_FUNC = TaskType("go-func") TASK_TYPE_HTTP = TaskType("http") TASK_OPERATION_START = "start" TASK_OPERATION_STOP = "stop" TASK_STATUS_NOT_STARTED = "not_started" TASK_STATUS_ASSIGNING = "assigning" TASK_STATUS_RUNNING = "running" TASK_STATUS_REASSIGNING = "reassigning" TASK_STATUS_DONE = "done" )
Variables ¶
View Source
var ( ErrNodeIdIsEmpty = errors.New("node id is empty") ErrNodeIPEmpty = errors.New("node ip is empty") ErrNodeNameEmpty = errors.New("node name is empty") ErrNodeExist = errors.New("node exists") )
View Source
var ( ErrTaskIdEmpty = errors.New("task id is empty") ErrTaskNameEmpty = errors.New("task name is empty") ErrTaskExprEmpty = errors.New("task expr is empty") ErrTaskTypeNotSupport = errors.New("task type not support") ErrTaskGoFuncNameIsEmpty = errors.New("task go func name is empty") ErrTaskShellCommandIsEmpty = errors.New("task shell command is empty") ErrTaskHttpURLIsEmpty = errors.New("task http url is empty") ErrTaskHttpMethodIsEmpty = errors.New("task http method is empty") ErrTaskNotFound = errors.New("task not found") ErrTaskOperationNotSupport = errors.New("task operation not support") )
Functions ¶
This section is empty.
Types ¶
type CreateNewNodeCmd ¶
type CreateNewNodeCmd struct { NewNode *CreateNode Result *Node }
type CreateNode ¶
type DatabaseConfig ¶
type DatabaseConfig struct { Type string ConnectionString string User string Password string Host string Name string SchemaName string GroupName string MaxOpenConn int MaxIdleConn int ConnMaxLifetime int LogQueries bool UrlQueryParams map[string][]string SslMode string CaCertPath string ClientKeyPath string ClientCertPath string //sqlite3 Path string CacheMode string }
type GenericMsg ¶
type GoTaskFuncInfo ¶
type GoTaskFuncInfo struct { FuncName string `json:"funcName"` Parameters []interface{} `json:"parameters"` }
func (*GoTaskFuncInfo) Scan ¶
func (gtfi *GoTaskFuncInfo) Scan(value interface{}) error
type HeartbeatMsg ¶
type HeartbeatMsg struct { Name string `json:"workerName"` Ip Ip `json:"ip"` ActiveTime time.Time `json:"activeTime"` }
func (*HeartbeatMsg) String ¶
func (h *HeartbeatMsg) String() string
type HeartbeatReplyMsg ¶
type HttpRequestTask ¶
type HttpRequestTask struct { URL string `json:"url"` Method string `json:"method"` Body interface{} `json:"body"` Header map[string]string `json:"header"` Timeout int `json:"timeout"` }
func (*HttpRequestTask) Scan ¶
func (hrt *HttpRequestTask) Scan(value interface{}) error
type Node ¶
type Node struct { Id string `json:"id" gorm:"column:id;primary_key;not null;type:varchar(255)"` Name string `json:"name"` Ip string `json:"ip"` Status string `json:"status"` CreatedAt time.Time `json:"createdAt"` OnlineTime time.Time `json:"onlineTime"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt gorm.DeletedAt `json:"deletedAt"` }
type NodeQueryCmd ¶
type RegisterMsg ¶
type RegisterMsg struct { Name string `json:"workerName"` Ip Ip `json:"ip"` OnlineTime time.Time `json:"onlineTime"` }
func (*RegisterMsg) String ¶
func (rm *RegisterMsg) String() string
type RegisterReplyMsg ¶
type ScheduledJob ¶
type ScheduledJob struct { Id string `json:"id"` TaskId string `json:"taskId"` Expr string `json:"expr"` Next time.Time `json:"next"` Last time.Time `json:"last"` Duration int64 `json:"duration"` WorkerId string `json:"workerId"` JobType string `json:"jobType"` JobInfo interface{} `json:"jobInfo"` }
func (ScheduledJob) Marshal ¶
func (s ScheduledJob) Marshal() ([]byte, error)
type ShellTaskInfo ¶
type ShellTaskInfo struct { Command string `json:"command"` Parameters []string `json:"parameters"` }
func (*ShellTaskInfo) Scan ¶
func (sti *ShellTaskInfo) Scan(value interface{}) error
type Task ¶
type Task struct { Id string `json:"id" gorm:"column:id;primary_key;not null;type:varchar(255)"` Name string `json:"name"` Expr string `json:"expr"` TaskType TaskType `json:"taskType"` ShellJobInfo *ShellTaskInfo `json:"shellInfo"` GoFuncInfo *GoTaskFuncInfo `json:"goFuncInfo"` HttpRequestTask *HttpRequestTask `json:"httpRequestTask"` SpecificWorkerId string `json:"specificWorkerId"` RetryTimes int `json:"retryTimes"` RetriedTimes int `json:"retriedTimes"` Status string `json:"status"` Result string `json:"result"` ErrMsg string `json:"errMsg"` }
type TaskCreate ¶
type TaskCreate struct { Name string `json:"name"` Expr string `json:"expr"` TaskType TaskType `json:"taskType"` ShellJobInfo *ShellTaskInfo `json:"shellInfo"` GoFuncInfo *GoTaskFuncInfo `json:"goFuncInfo"` HttpRequestTask *HttpRequestTask `json:"httpRequestTask"` SpecificWorkerId string `json:"specificWorkerId"` RetryTimes int `json:"retryTimes"` }
type TaskCreateCommand ¶
type TaskCreateCommand struct { *TaskCreate CreatorId string `json:"creatorId"` CreatorName string `json:"creatorName"` Result *TaskDto }
type TaskQueryCmd ¶
type TaskReplyMsg ¶
type TaskReplyMsg struct { TaskId string `json:"taskId"` WorkerId string `json:"workerId"` Status string `json:"status"` StartedAt time.Time `json:"startedAt"` FinishedAt time.Time `json:"finishedAt"` ErrMsg string `json:"errMsg"` Result string `json:"result"` }
func (*TaskReplyMsg) String ¶
func (trm *TaskReplyMsg) String() string
type TaskUpdate ¶
type TaskUpdate struct { Id string `json:"id"` Expr string `json:"expr"` TaskType TaskType `json:"taskType"` ShellJobInfo *ShellTaskInfo `json:"shellInfo"` GoFuncInfo *GoTaskFuncInfo `json:"goFuncInfo"` HttpRequestTask *HttpRequestTask `json:"httpRequestTask"` SpecificWorkerId string `json:"specificWorkerId"` RetryTimes int `json:"retryTimes"` }
type TaskUpdateCommand ¶
type TaskUpdateCommand struct { UpdateTask *TaskUpdate CreatorId string `json:"creatorId"` CreatorName string `json:"creatorName"` Result *TaskDto }
type UpdateNode ¶
type UpdateNodeCmd ¶
type UpdateNodeCmd struct { Node *UpdateNode Result *Node }
Click to show internal directories.
Click to hide internal directories.