Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Ctl is a global garbage collection controller instance Ctl = NewController() )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // Start start a manual gc job Start(ctx context.Context, policy Policy, trigger string) (int64, error) // Stop stop a gc job Stop(ctx context.Context, id int64) error // ExecutionCount returns the total count of executions according to the query ExecutionCount(ctx context.Context, query *q.Query) (count int64, err error) // ListExecutions lists the executions according to the query ListExecutions(ctx context.Context, query *q.Query) (executions []*Execution, err error) // GetExecution gets the specific execution GetExecution(ctx context.Context, executionID int64) (execution *Execution, err error) // GetTask gets the specific task GetTask(ctx context.Context, id int64) (*Task, error) // ListTasks lists the tasks according to the query ListTasks(ctx context.Context, query *q.Query) (tasks []*Task, err error) // GetTaskLog gets log of the specific task GetTaskLog(ctx context.Context, id int64) ([]byte, error) // GetSchedule get the current gc schedule GetSchedule(ctx context.Context) (*scheduler.Schedule, error) // CreateSchedule create the gc schedule with cron type & string CreateSchedule(ctx context.Context, cronType, cron string, policy Policy) (int64, error) // DeleteSchedule remove the gc schedule DeleteSchedule(ctx context.Context) error }
Controller manages the tags
func NewController ¶
func NewController() Controller
NewController creates an instance of the default repository controller
type Execution ¶
type Execution struct { ID int64 Status string StatusMessage string Trigger string ExtraAttrs map[string]interface{} StartTime time.Time UpdateTime time.Time }
Execution model for gc
type Policy ¶
type Policy struct { Trigger *Trigger `json:"trigger"` DeleteUntagged bool `json:"deleteuntagged"` DryRun bool `json:"dryrun"` Workers int `json:"workers"` ExtraAttrs map[string]interface{} `json:"extra_attrs"` }
Policy ...
type Task ¶
type Task struct { ID int64 ExecutionID int64 Status string StatusMessage string RunCount int32 DeleteUntagged bool DryRun bool Workers int JobID string CreationTime time.Time StartTime time.Time UpdateTime time.Time EndTime time.Time }
Task model for gc
type Trigger ¶
type Trigger struct { Type TriggerType `json:"type"` Settings *TriggerSettings `json:"trigger_settings"` }
Trigger holds info for a trigger
type TriggerSettings ¶
type TriggerSettings struct {
Cron string `json:"cron"`
}
TriggerSettings is the setting about the trigger
Click to show internal directories.
Click to hide internal directories.