Documentation ¶
Index ¶
- Constants
- Variables
- func NewSettingFactory(db *ledis.DB) *settingFactory
- type DefinitionStore
- type FailedJobStore
- type JobHistoryItem
- type JobHistoryStore
- type JobStatus
- type JobStatusStore
- type MessageFactory
- type MessageStore
- type QueueStore
- type QueueStoreFactory
- type ServiceProvider
- type SettingFactory
- type SettingStore
Constants ¶
View Source
const ( QueueDingding = "dingding" QueueFileSync = "file-sync" )
View Source
const ( GlobalNamespace = "global" SyncActionSetting = "sync-action" )
View Source
const (
MessageErrorType = "errors"
)
View Source
const StatusKeepDuration int64 = 24 * 3600
StatusKeepDuration 状态保存有效期
Variables ¶
View Source
var ErrNoSuchDefinition = errors.New("no such definition")
ErrNoSuchDefinition 没有找到指定的定义
View Source
var ErrNoSuchJob = errors.New("no such job")
View Source
var ErrNoSuchSetting = errors.New("no such setting")
View Source
var ErrQueueTimeout = errors.New("timeout")
ErrQueueTimeout 队列超时
Functions ¶
func NewSettingFactory ¶
Types ¶
type DefinitionStore ¶
type DefinitionStore interface { Update(def meta.FileSyncGroup) error Delete(name string) error Get(name string) (*meta.FileSyncGroup, error) All() ([]meta.FileSyncGroup, error) }
DefinitionStore 同步定义存储接口
func NewDefinitionStore ¶
func NewDefinitionStore(db *ledis.DB) DefinitionStore
type FailedJobStore ¶
type FailedJobStore interface { Add(id string, data []byte) error All() ([][]byte, error) Get(id string) ([]byte, error) Delete(id string) error }
func NewFailedJobStore ¶
func NewFailedJobStore(db *ledis.DB) FailedJobStore
type JobHistoryItem ¶
type JobHistoryStore ¶
type JobHistoryStore interface { // Record 记录 JOB 执行历史 Record(item JobHistoryItem) error // Recently 返回最近的 limit 条记录 Recently(limit int) ([]JobHistoryItem, error) // Truncate 清空历史纪录 Truncate() error // Keep 只保留指定数量的最新记录 Keep(keepCount int64) error }
func NewJobHistoryStore ¶
func NewJobHistoryStore(db *ledis.DB) JobHistoryStore
type JobStatusStore ¶
type JobStatusStore interface { // Status 任务执行状态查询 Status(id string) JobStatus // LastStatus return last changed status for a sync definition LastStatus(name string) (JobStatus, time.Time) // 更新任务执行状态 Update(id string, name string, status JobStatus) error }
JobStatusStore 任务执行状态查询
func NewJobStatusStore ¶
func NewJobStatusStore(db *ledis.DB) JobStatusStore
type MessageFactory ¶
type MessageFactory interface {
MessageStore(name string) MessageStore
}
func NewMessageFactory ¶
func NewMessageFactory(db *ledis.DB) MessageFactory
type MessageStore ¶
type QueueStore ¶
type QueueStore interface { // Enqueue 加入队列 Enqueue(payload []byte) error // Dequeue 从队列中读取 // timeout > 0 则使用堵塞队列 Dequeue(timeout time.Duration) ([]byte, error) // All 返回队列中所有任务 All() ([][]byte, error) }
QueueStore 队列接口
func NewLedisQueueStore ¶
func NewLedisQueueStore(db *ledis.DB, name string) QueueStore
NewLedisQueueStore 创建一个 Ledis 队列
type QueueStoreFactory ¶
type QueueStoreFactory interface { // QueueStore 获取队列实例 Queue(name string) QueueStore }
QueueStoreFactory 队列工厂接口
func NewQueueStoreFactory ¶
func NewQueueStoreFactory(db *ledis.DB) QueueStoreFactory
NewQueueStoreFactory 创建一个队列工厂实例
type ServiceProvider ¶
type ServiceProvider struct{}
func (*ServiceProvider) Boot ¶
func (s *ServiceProvider) Boot(app *glacier.Glacier)
func (*ServiceProvider) Register ¶
func (s *ServiceProvider) Register(app *container.Container)
type SettingFactory ¶
type SettingFactory interface {
Namespace(namespace string) SettingStore
}
SettingFactory is a factory for creating settingStore
Click to show internal directories.
Click to hide internal directories.