Documentation
¶
Overview ¶
Package executor defines a "production-ready" executor for jobs.
For local/non-production use, consider looking at cmd/localjobs's executor
Index ¶
- func Create(ctx context.Context, pool *pgxpool.Pool, jobImpl interfaces.JobImpl, ...) (*string, error)
- func Execute(ctx context.Context, ctxCancel context.CancelFunc, id string, ...)
- func GetPersistedState(tc *Progress) (*jobstate.Progress, error)
- func PersistState(tc *Progress, prog *jobstate.Progress) error
- type JobrunnerState
- func (t JobrunnerState) Context() context.Context
- func (JobrunnerState) DebugInfo() *debug.BuildInfo
- func (JobrunnerState) Discord() (*discordgo.Session, *discordgo.User, bool)
- func (t JobrunnerState) GuildID() string
- func (JobrunnerState) OperationMode() string
- func (j JobrunnerState) Transport() *http.Transport
- type MutLogger
- type Progress
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(ctx context.Context, pool *pgxpool.Pool, jobImpl interfaces.JobImpl, guildId string) (*string, error)
Sets up a job
func Execute ¶
func Execute( ctx context.Context, ctxCancel context.CancelFunc, id string, jobImpl interfaces.JobImpl, prog *Progress, guildId string, )
Creates a new job on server and executes it
If prog is set, it will be used to cache the progress, otherwise a blank one will be used
func GetPersistedState ¶
GetPersistedState gets persisted state from redis
Types ¶
type JobrunnerState ¶
Implementor of jobs.State
func (JobrunnerState) Context ¶
func (t JobrunnerState) Context() context.Context
func (JobrunnerState) DebugInfo ¶
func (JobrunnerState) DebugInfo() *debug.BuildInfo
func (JobrunnerState) GuildID ¶
func (t JobrunnerState) GuildID() string
func (JobrunnerState) OperationMode ¶
func (JobrunnerState) OperationMode() string
func (JobrunnerState) Transport ¶
func (j JobrunnerState) Transport() *http.Transport
type MutLogger ¶
func NewTaskLogger ¶
type Progress ¶
type Progress struct {
ID string
State JobrunnerState
// Used to cache the current progress in resumes
//
// When resuming, set this to the current progress
CurrentProgress *jobstate.Progress
// OnSetProgress is a callback that is called when SetProgress is called
//
// If unset, calls PersistState
OnSetProgress func(tc *Progress, prog *jobstate.Progress) error
}
Click to show internal directories.
Click to hide internal directories.