Documentation ¶
Index ¶
- Constants
- type Base
- type Cron
- type CronImplementation
- type DBSchedule
- type Details
- type Execution
- type JobRunner
- type Manager
- func (m *Manager) Create(ctx context.Context, s *Schedule, user string) (*Schedule, error)
- func (m *Manager) Delete(ctx context.Context, id string) error
- func (m *Manager) Get(ctx context.Context, id string) (*Schedule, error)
- func (m *Manager) List(ctx context.Context, r *http.Request) (*api.SuccessPayload, error)
- func (m *Manager) Update(ctx context.Context, id string, s *Schedule) (*Schedule, error)
- type Provider
- type SQLiteProvider
- func (p *SQLiteProvider) Close() error
- func (p *SQLiteProvider) CountJobsInProgress(ctx context.Context, scheduleID string, timeoutSec int) (int, error)
- func (p *SQLiteProvider) Delete(ctx context.Context, id string) error
- func (p *SQLiteProvider) Get(ctx context.Context, id string) (*Schedule, error)
- func (p *SQLiteProvider) Insert(ctx context.Context, s *Schedule) error
- func (p *SQLiteProvider) List(ctx context.Context, options *query.ListOptions) ([]*Schedule, error)
- func (p *SQLiteProvider) Update(ctx context.Context, s *Schedule) error
- type Schedule
Constants ¶
View Source
const ( TypeCommand = "command" TypeScript = "script" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CronImplementation ¶
type CronImplementation struct {
// contains filtered or unexported fields
}
func (*CronImplementation) Remove ¶
func (c *CronImplementation) Remove(id string)
func (*CronImplementation) Validate ¶
func (c *CronImplementation) Validate(schedule string) error
type DBSchedule ¶
DBSchedule is used for saving to database and has details in one json db column
func (DBSchedule) ToSchedule ¶
func (dbs DBSchedule) ToSchedule() *Schedule
type Details ¶
type Details struct { ClientIDs []string `json:"client_ids" db:"-"` GroupIDs []string `json:"group_ids" db:"-"` ClientTags *models.JobClientTags `json:"tags" db:"-"` Command string `json:"command,omitempty" db:"-"` Script string `json:"script,omitempty" db:"-"` Interpreter string `json:"interpreter" db:"-"` Cwd string `json:"cwd" db:"-"` IsSudo bool `json:"is_sudo" db:"-"` TimeoutSec int `json:"timeout_sec" db:"-"` ExecuteConcurrently bool `json:"execute_concurrently" db:"-"` AbortOnError *bool `json:"abort_on_error" db:"-"` Overlaps bool `json:"overlaps" db:"-"` }
type Execution ¶
type Execution struct { StartedAt *time.Time `db:"last_started_at" json:"started_at"` ClientCount *int `db:"last_client_count" json:"client_count"` SuccessCount *int `db:"last_success_count" json:"success_count"` Status *string `db:"last_status" json:"status"` Details *jobs.JobDetails `db:"last_details" json:"-"` Summary *string `json:"summary"` }
All fields must be pointers, because when there's no execution yet the values will be nil
func (*Execution) ToLastExecution ¶
type Provider ¶
type Provider interface { Insert(context.Context, *Schedule) error Update(context.Context, *Schedule) error List(context.Context, *query.ListOptions) ([]*Schedule, error) Get(context.Context, string) (*Schedule, error) Delete(context.Context, string) error CountJobsInProgress(ctx context.Context, scheduleID string, timeoutSec int) (int, error) }
type SQLiteProvider ¶
type SQLiteProvider struct {
// contains filtered or unexported fields
}
func (*SQLiteProvider) Close ¶
func (p *SQLiteProvider) Close() error
func (*SQLiteProvider) CountJobsInProgress ¶
func (p *SQLiteProvider) CountJobsInProgress(ctx context.Context, scheduleID string, timeoutSec int) (int, error)
CountJobsInProgress counts jobs for scheduleID that have not finished and are not timed out
func (*SQLiteProvider) Delete ¶
func (p *SQLiteProvider) Delete(ctx context.Context, id string) error
func (*SQLiteProvider) Insert ¶
func (p *SQLiteProvider) Insert(ctx context.Context, s *Schedule) error
func (*SQLiteProvider) List ¶
func (p *SQLiteProvider) List(ctx context.Context, options *query.ListOptions) ([]*Schedule, error)
type Schedule ¶
func (*Schedule) GetClientIDs ¶
func (*Schedule) GetClientTags ¶
func (s *Schedule) GetClientTags() (clientTags *models.JobClientTags)
func (*Schedule) GetGroupIDs ¶
func (Schedule) ToDB ¶
func (s Schedule) ToDB() DBSchedule
Click to show internal directories.
Click to hide internal directories.