Documentation
¶
Index ¶
- Constants
- func GenerateSerialNo() string
- func GetLocalIpAddress() (ip string)
- func PackGroupConf(groupConf *GroupConf) (value []byte, err error)
- func PackJobConf(jobConf *JobConf) (value []byte, err error)
- func PackJobExecuteSnapshot(snapshot *JobExecuteSnapshot) (value []byte, err error)
- func PackJobSnapshot(snapshot *JobSnapshot) (value []byte, err error)
- func ParseInLocation(value string) (dateTime time.Time, err error)
- func TimeSubDays(t1, t2 time.Time) int
- func ToDateString(date time.Time) string
- type ApiAuth
- type Client
- type Etcd
- func (etcd *Etcd) Delete(key string) (err error)
- func (etcd *Etcd) DeleteWithPrefixKey(prefixKey string) (err error)
- func (etcd *Etcd) Get(key string) (value []byte, err error)
- func (etcd *Etcd) GetWithPrefixKey(prefixKey string) (keys [][]byte, values [][]byte, err error)
- func (etcd *Etcd) GetWithPrefixKeyLimit(prefixKey string, limit int64) (keys [][]byte, values [][]byte, err error)
- func (etcd *Etcd) Put(key, value string) (err error)
- func (etcd *Etcd) PutNotExist(key, value string) (success bool, oldValue []byte, err error)
- func (etcd *Etcd) TxKeepaliveWithTTL(key, value string, ttl int64) (txResponse *TxResponse, err error)
- func (etcd *Etcd) TxWithTTL(key, value string, ttl int64) (txResponse *TxResponse, err error)
- func (etcd *Etcd) Update(key, value, oldValue string) (success bool, err error)
- func (etcd *Etcd) Watch(key string) (keyChangeEventResponse *WatchKeyChangeResponse)
- func (etcd *Etcd) WatchWithPrefixKey(prefixKey string) (keyChangeEventResponse *WatchKeyChangeResponse)
- type Group
- type GroupConf
- type InputLogin
- type JobAPi
- type JobChangeEvent
- type JobClient
- type JobClientDeleteEvent
- type JobCollection
- type JobConf
- type JobExecuteSnapshot
- type JobExecutor
- type JobGroupManager
- type JobManager
- type JobNode
- type JobScheduler
- type JobSnapshot
- type JobSnapshotFailOver
- type KeyChangeEvent
- type ManualExecuteJobParam
- type Node
- type NodeStateChangeListener
- type PageResult
- type QueryClientParam
- type QueryExecuteSnapshotParam
- type QuerySnapshotParam
- type Result
- type SchedulePlan
- type TxResponse
- type WatchKeyChangeResponse
Constants ¶
View Source
const ( JobSnapshotPath = "/forest/client/snapshot/" JobSnapshotGroupPath = "/forest/client/snapshot/%s/" JobClientSnapshotPath = "/forest/client/snapshot/%s/%s/" )
View Source
const ( GroupConfPath = "/forest/server/group/" ClientPath = "/forest/client/%s/clients/" )
View Source
const ( JobNodePath = "/forest/server/node/" JobNodeElectPath = "/forest/server/elect/leader" TTL = 5 )
View Source
const ( KeyCreateChangeEvent = iota KeyUpdateChangeEvent KeyDeleteChangeEvent )
View Source
const ( JobCreateChangeEvent = iota JobUpdateChangeEvent JobDeleteChangeEvent )
View Source
const ( JobRunningStatus = iota + 1 JobStopStatus )
View Source
const ( NodeFollowerState = iota NodeLeaderState )
View Source
const ( JobExecuteSnapshotDoingStatus = 1 JobExecuteSnapshotSuccessStatus = 2 JobExecuteSnapshotUnkonwStatus = 3 JobExecuteSnapshotErrorStatus = -1 )
View Source
const (
JobConfPath = "/forest/server/conf/"
)
View Source
const (
JobExecuteStatusCollectionPath = "/forest/client/execute/snapshot/"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateSerialNo ¶
func GenerateSerialNo() string
func GetLocalIpAddress ¶
func GetLocalIpAddress() (ip string)
func PackGroupConf ¶
func PackJobConf ¶
func PackJobExecuteSnapshot ¶
func PackJobExecuteSnapshot(snapshot *JobExecuteSnapshot) (value []byte, err error)
func PackJobSnapshot ¶
func PackJobSnapshot(snapshot *JobSnapshot) (value []byte, err error)
func TimeSubDays ¶
func ToDateString ¶
Types ¶
type ApiAuth ¶
type ApiAuth struct {
Auth func(*InputLogin) error
JWTKey string
}
type Etcd ¶
type Etcd struct {
// contains filtered or unexported fields
}
func NewEtcd ¶
func NewEtcd(endpoints []string, timeout time.Duration, opts ...func(*clientv3.Config)) (etcd *Etcd, err error)
NewEtcd create a etcd
func (*Etcd) DeleteWithPrefixKey ¶
DeleteWithPrefixKey delete the keys with prefix key
func (*Etcd) GetWithPrefixKey ¶
GetWithPrefixKey get values from prefixKey
func (*Etcd) GetWithPrefixKeyLimit ¶
func (etcd *Etcd) GetWithPrefixKeyLimit(prefixKey string, limit int64) (keys [][]byte, values [][]byte, err error)
GetWithPrefixKeyLimit get values from prefixKey limit
func (*Etcd) PutNotExist ¶
PutNotExist put a key not exist
func (*Etcd) TxKeepaliveWithTTL ¶
func (etcd *Etcd) TxKeepaliveWithTTL(key, value string, ttl int64) (txResponse *TxResponse, err error)
func (*Etcd) TxWithTTL ¶
func (etcd *Etcd) TxWithTTL(key, value string, ttl int64) (txResponse *TxResponse, err error)
func (*Etcd) Watch ¶
func (etcd *Etcd) Watch(key string) (keyChangeEventResponse *WatchKeyChangeResponse)
Watch watch a key
func (*Etcd) WatchWithPrefixKey ¶
func (etcd *Etcd) WatchWithPrefixKey(prefixKey string) (keyChangeEventResponse *WatchKeyChangeResponse)
WatchWithPrefixKey watch with prefix key
type GroupConf ¶
func UnpackGroupConf ¶
type InputLogin ¶
type JobChangeEvent ¶
type JobClientDeleteEvent ¶
type JobCollection ¶
type JobCollection struct {
// contains filtered or unexported fields
}
func NewJobCollection ¶
func NewJobCollection(node *JobNode) (c *JobCollection)
type JobConf ¶
type JobConf struct {
Id string `json:"id"`
Name string `json:"name"`
Group string `json:"group"`
Cron string `json:"cron"`
Status int `json:"status"`
Target string `json:"target"`
Params string `json:"params"`
Mobile string `json:"mobile"`
Remark string `json:"remark"`
Version int `json:"version"`
}
JobConf job
func UnpackJobConf ¶
type JobExecuteSnapshot ¶
type JobExecuteSnapshot struct {
Id string `json:"id" xorm:"pk"`
JobId string `json:"jobId" xorm:"job_id"`
Name string `json:"name" xorm:"name"`
Ip string `json:"ip" xorm:"ip"`
Group string `json:"group" xorm:"group"`
Cron string `json:"cron" xorm:"cron"`
Target string `json:"target" xorm:"target"`
Params string `json:"params" xorm:"params"`
Mobile string `json:"mobile" xorm:"mobile"`
Remark string `json:"remark" xorm:"remark"`
CreateTime string `json:"createTime" xorm:"create_time"`
StartTime string `json:"startTime" xorm:"start_time"`
FinishTime string `json:"finishTime" xorm:"finish_time"`
Times int `json:"times" xorm:"times"`
Status int `json:"status" xorm:"status"`
Result string `json:"result" xorm:"result"`
}
func UnpackJobExecuteSnapshot ¶
func UnpackJobExecuteSnapshot(value []byte) (snapshot *JobExecuteSnapshot, err error)
type JobExecutor ¶
type JobExecutor struct {
// contains filtered or unexported fields
}
func NewJobExecutor ¶
func NewJobExecutor(node *JobNode) (exec *JobExecutor)
type JobGroupManager ¶
type JobGroupManager struct {
// contains filtered or unexported fields
}
func NewJobGroupManager ¶
func NewJobGroupManager(node *JobNode) (mgr *JobGroupManager)
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
func NewJobManager ¶
func NewJobManager(node *JobNode) (manager *JobManager)
func (*JobManager) AddJob ¶
func (manager *JobManager) AddJob(jobConf *JobConf) (err error)
add job conf
type JobNode ¶
type JobNode struct {
// contains filtered or unexported fields
}
JobNode job node
func NewJobNode ¶
type JobScheduler ¶
type JobScheduler struct {
// contains filtered or unexported fields
}
JobScheduler job scheduler
func NewJobScheduler ¶
func NewJobScheduler(node *JobNode) (sch *JobScheduler)
type JobSnapshot ¶
type JobSnapshot struct {
Id string `json:"id"`
JobId string `json:"jobId"`
Name string `json:"name"`
Ip string `json:"ip"`
Group string `json:"group"`
Cron string `json:"cron"`
Target string `json:"target"`
Params string `json:"params"`
Mobile string `json:"mobile"`
Remark string `json:"remark"`
CreateTime string `json:"createTime"`
}
func UnpackJobSnapshot ¶
func UnpackJobSnapshot(value []byte) (snapshot *JobSnapshot, err error)
type JobSnapshotFailOver ¶
type JobSnapshotFailOver struct {
// contains filtered or unexported fields
}
func NewJobSnapshotFailOver ¶
func NewJobSnapshotFailOver(node *JobNode) (f *JobSnapshotFailOver)
new job snapshot fail over
type KeyChangeEvent ¶
KeyChangeEvent key 变化事件
type ManualExecuteJobParam ¶
type ManualExecuteJobParam struct {
Id string `json:"id"`
Name string `json:"name"`
Group string `json:"group"`
}
ManualExecuteJobParam manual execute job
type NodeStateChangeListener ¶
type NodeStateChangeListener interface {
// contains filtered or unexported methods
}
NodeStateChangeListener node state change listener
type PageResult ¶
type QueryClientParam ¶
type QueryClientParam struct {
Group string `json:"group"`
}
type QuerySnapshotParam ¶
type SchedulePlan ¶
type SchedulePlan struct {
Id string `json:"id"`
Name string `json:"name"`
Group string `json:"group"`
Cron string `json:"cron"`
Status int `json:"status"`
Target string `json:"target"`
Params string `json:"params"`
Mobile string `json:"mobile"`
Remark string `json:"remark"`
NextTime time.Time `json:"nextTime"`
BeforeTime time.Time `json:"beforeTime"`
Version int `json:"version"`
// contains filtered or unexported fields
}
type TxResponse ¶
type WatchKeyChangeResponse ¶
type WatchKeyChangeResponse struct {
Event chan *KeyChangeEvent
CancelFunc context.CancelFunc
Watcher clientv3.Watcher
}
WatchKeyChangeResponse 监听key 变化响应
Source Files
¶
Click to show internal directories.
Click to hide internal directories.









