storage

package
v0.0.0-...-163a5a4 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventTypePreempted 抢占了一个任务
	EventTypePreempted = "preempted"
	// EventTypeDeleted 某一个任务被删除了
	EventTypeDeleted   = "deleted"
	EventTypeCreated   = "created"
	EventTypeRunnable  = "runnable"
	EventTypeEnd       = "end"
	EventTypeDiscarded = "discarded"

	Stop = "stop"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type EventType
	Task *task.Task
}

type EventType

type EventType string

type RefreshIntervalRetry

type RefreshIntervalRetry struct {
	Interval time.Duration
	Max      int64
	// contains filtered or unexported fields
}

func (*RefreshIntervalRetry) GetCntRetry

func (r *RefreshIntervalRetry) GetCntRetry() int64

func (*RefreshIntervalRetry) GetMaxRetry

func (r *RefreshIntervalRetry) GetMaxRetry() int64

func (*RefreshIntervalRetry) Next

func (r *RefreshIntervalRetry) Next() (time.Duration, bool)

type RetryStrategy

type RetryStrategy interface {
	Next() (time.Duration, bool)
	GetMaxRetry() int64
	GetCntRetry() int64
}

type Status

type Status struct {
	ExpectStatus string
	UseStatus    string
}

type Storager

type Storager interface {
	// Events
	// ctx 结束的时候,Storage 也要结束
	// 实现者需要处理 taskEvents
	Events(ctx context.Context, taskEvents <-chan task.Event) (<-chan Event, error)
	TaskDAO
}

type TaskDAO

type TaskDAO interface {
	Get(ctx context.Context, taskId int64) (*task.Task, error)
	Add(ctx context.Context, t *task.Task) (int64, error)
	AddExecution(ctx context.Context, taskId int64) (int64, error)
	Update(ctx context.Context, t *task.Task) error
	CompareAndUpdateTaskStatus(ctx context.Context, taskId int64, old, new string) error
	CompareAndUpdateTaskExecutionStatus(ctx context.Context, taskId int64, old, new string) error
	Delete(ctx context.Context, taskId int64) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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