Documentation ¶
Index ¶
- Constants
- func BuildKeyPath(basePath string, paths ...string) string
- type ETCDAuth
- type EnqueueEntity
- func (g *EnqueueEntity) AddArgs(key string, value interface{}) *EnqueueEntity
- func (g *EnqueueEntity) Do() (*work.Job, error)
- func (g *EnqueueEntity) GetArgs() map[string]interface{}
- func (g *EnqueueEntity) GetEntryID() cronV3.EntryID
- func (g *EnqueueEntity) GetID() string
- func (g *EnqueueEntity) GetInstance() *EnqueueEntity
- func (g *EnqueueEntity) GetJobName() string
- func (g *EnqueueEntity) GetSpec() string
- func (g *EnqueueEntity) RemoveArgs(key string) *EnqueueEntity
- func (g *EnqueueEntity) Run()
- func (g *EnqueueEntity) SetEntryID(id cronV3.EntryID) *EnqueueEntity
- func (g *EnqueueEntity) SetJobName(JobName string) *EnqueueEntity
- func (g *EnqueueEntity) SetSpec(Spec string) *EnqueueEntity
- type Job
- type Master
- type MasterClusterEntity
- func (g *MasterClusterEntity) AddTask(info *TaskInfo) (*TaskInfo, error)
- func (g *MasterClusterEntity) ExecTask(id string) error
- func (g *MasterClusterEntity) Init() Master
- func (g *MasterClusterEntity) RemoveTask(id string) error
- func (g *MasterClusterEntity) RemoveTaskRecord(id string) error
- func (g *MasterClusterEntity) WaitTask(id string, onChange func(data *mongo.RawData) (bool, error), onDelete func()) error
- func (g *MasterClusterEntity) WatchMaster()
- func (g *MasterClusterEntity) WatchTask()
- type MasterEntity
- func (g *MasterEntity) AddTask(info *TaskInfo) (*TaskInfo, error)
- func (g *MasterEntity) ExecTask(id string) error
- func (g *MasterEntity) GetBusyWorkers() ([]*work.WorkerObservation, error)
- func (g *MasterEntity) GetEnqueue(id string) (*EnqueueEntity, error)
- func (g *MasterEntity) GetEnqueues() map[string]*EnqueueEntity
- func (g *MasterEntity) GetID() string
- func (g *MasterEntity) GetQueues() ([]*work.Queue, error)
- func (g *MasterEntity) GetWorkerHeartbeats() ([]*work.WorkerPoolHeartbeat, error)
- func (g *MasterEntity) Init() Master
- func (g *MasterEntity) RemoveTask(id string) error
- func (g *MasterEntity) RemoveTaskRecord(id string) error
- func (g *MasterEntity) WaitTask(id string, onChange func(data *mongo.RawData) (bool, error), onDelete func()) error
- type MasterOption
- type TaskInfo
- type Worker
- type WorkerEntity
Constants ¶
View Source
const ( IDENTITY = "identity" NAMESPACE = "namespace" JOB_NAME = "jobName" STATUS = "status" UPDATE = "$set" STATUS_SCHEDULING = "scheduling" STATUS_REMOVE = "remove" STATUS_PENDING = "pending" STATUS_RUNNING = "running" STATUS_COMPLETE = "complete" STATUS_FAILED = "failed" HISTORY = "history" )
View Source
const ( MASTER = "master" TASK = "task" LOCK = "lock" )
View Source
const (
Now = "now"
)
Variables ¶
This section is empty.
Functions ¶
func BuildKeyPath ¶
BuildKeyPath 組合 etcd key 的路徑
Types ¶
type EnqueueEntity ¶
type EnqueueEntity struct { ID string `json:"id"` Location *time.Location `json:"-"` Cron *cronV3.Cron `json:"-"` Engine *work.Enqueuer `json:"-"` Spec string `json:"Spec"` EntryID cronV3.EntryID `json:"EntryID"` JobName string `json:"JobName"` Args map[string]interface{} `json:"Args"` }
EnqueueEntity 實例
func NewEnqueue ¶
func NewEnqueue(Engine *work.Enqueuer, location *time.Location, Spec, JobName string, Args map[string]interface{}) *EnqueueEntity
NewEnqueue 建立一個新的 Enqueue instance
func (*EnqueueEntity) AddArgs ¶
func (g *EnqueueEntity) AddArgs(key string, value interface{}) *EnqueueEntity
func (*EnqueueEntity) GetArgs ¶
func (g *EnqueueEntity) GetArgs() map[string]interface{}
func (*EnqueueEntity) GetEntryID ¶
func (g *EnqueueEntity) GetEntryID() cronV3.EntryID
func (*EnqueueEntity) GetID ¶
func (g *EnqueueEntity) GetID() string
func (*EnqueueEntity) GetInstance ¶
func (g *EnqueueEntity) GetInstance() *EnqueueEntity
func (*EnqueueEntity) GetJobName ¶
func (g *EnqueueEntity) GetJobName() string
func (*EnqueueEntity) GetSpec ¶
func (g *EnqueueEntity) GetSpec() string
func (*EnqueueEntity) RemoveArgs ¶
func (g *EnqueueEntity) RemoveArgs(key string) *EnqueueEntity
func (*EnqueueEntity) SetEntryID ¶
func (g *EnqueueEntity) SetEntryID(id cronV3.EntryID) *EnqueueEntity
func (*EnqueueEntity) SetJobName ¶
func (g *EnqueueEntity) SetJobName(JobName string) *EnqueueEntity
func (*EnqueueEntity) SetSpec ¶
func (g *EnqueueEntity) SetSpec(Spec string) *EnqueueEntity
type Master ¶
type Master interface { Init() Master GetID() string AddTask(info *TaskInfo) (*TaskInfo, error) GetEnqueues() map[string]*EnqueueEntity GetEnqueue(id string) (*EnqueueEntity, error) GetWorkerHeartbeats() ([]*work.WorkerPoolHeartbeat, error) GetBusyWorkers() ([]*work.WorkerObservation, error) GetQueues() ([]*work.Queue, error) ExecTask(id string) error WaitTask(id string, onChange func(data *mongo.RawData) (bool, error), onDelete func()) error RemoveTask(id string) error RemoveTaskRecord(id string) error }
func NewMaster ¶
func NewMaster(pool *redis.Pool, namespace string, option *MasterOption) Master
NewMaster 建立 Master 實例
func NewMasterCluster ¶
func NewMasterCluster(base *MasterEntity, option *MasterOption) Master
NewMasterCluster 建立集群版本 Master Instance
type MasterClusterEntity ¶
type MasterClusterEntity struct { *MasterEntity // contains filtered or unexported fields }
func (*MasterClusterEntity) AddTask ¶
func (g *MasterClusterEntity) AddTask(info *TaskInfo) (*TaskInfo, error)
AddTask 新增任務
func (*MasterClusterEntity) ExecTask ¶ added in v0.0.5
func (g *MasterClusterEntity) ExecTask(id string) error
func (*MasterClusterEntity) RemoveTask ¶
func (g *MasterClusterEntity) RemoveTask(id string) error
RemoveTask 移除任務
func (*MasterClusterEntity) RemoveTaskRecord ¶ added in v1.0.24
func (g *MasterClusterEntity) RemoveTaskRecord(id string) error
func (*MasterClusterEntity) WatchMaster ¶
func (g *MasterClusterEntity) WatchMaster()
WatchMaster 集群監聽 Master
type MasterEntity ¶
type MasterEntity struct {
// contains filtered or unexported fields
}
Master 實例
func (*MasterEntity) AddTask ¶
func (g *MasterEntity) AddTask(info *TaskInfo) (*TaskInfo, error)
AddTask 加入任務
func (*MasterEntity) GetBusyWorkers ¶
func (g *MasterEntity) GetBusyWorkers() ([]*work.WorkerObservation, error)
func (*MasterEntity) GetEnqueue ¶
func (g *MasterEntity) GetEnqueue(id string) (*EnqueueEntity, error)
func (*MasterEntity) GetEnqueues ¶
func (g *MasterEntity) GetEnqueues() map[string]*EnqueueEntity
func (*MasterEntity) GetID ¶
func (g *MasterEntity) GetID() string
func (*MasterEntity) GetWorkerHeartbeats ¶
func (g *MasterEntity) GetWorkerHeartbeats() ([]*work.WorkerPoolHeartbeat, error)
GetWorkerHeartbeats 取得 worker heartbeats 陣列
func (*MasterEntity) Init ¶
func (g *MasterEntity) Init() Master
func (*MasterEntity) RemoveTaskRecord ¶ added in v1.0.24
func (g *MasterEntity) RemoveTaskRecord(id string) error
type MasterOption ¶
type TaskInfo ¶
type TaskInfo struct { MasterID string `json:"masterId"` ID string `json:"id"` TimeZone string `json:"timezone"` Spec string `json:"spec"` JobName string `json:"jobName"` Active bool `json:"active"` DisableTimeRange *struct { Start time.Time `json:"start"` End time.Time `json:"end"` } `json:"disableTimeRange"` Args map[string]interface{} `json:"args"` }
type Worker ¶
type WorkerEntity ¶
type WorkerEntity struct {
// contains filtered or unexported fields
}
func (*WorkerEntity) AddJob ¶
func (g *WorkerEntity) AddJob(name string, job Job, option *work.JobOptions) Worker
func (*WorkerEntity) Start ¶
func (g *WorkerEntity) Start() Worker
func (*WorkerEntity) Stop ¶
func (g *WorkerEntity) Stop() Worker
Click to show internal directories.
Click to hide internal directories.