Documentation
¶
Index ¶
- Constants
- Variables
- func HandleCommandTask(ctx context.Context, task *asynq.Task) error
- func HandleDeleteArchivedTask(ctx context.Context, task *asynq.Task) error
- func HandleDeleteCompletedTask(ctx context.Context, task *asynq.Task) error
- func HandleHousekeeperTask(ctx context.Context, task *asynq.Task) error
- type CommandPayload
- type DeleteQueuePayload
- type HousekeeperPayload
- type HousekeeperRetentionConfig
Constants ¶
View Source
const ( // DeleteArchivedTaskType is the name of the task responsible for deleting // archived tasks from a task queue DeleteArchivedTaskType = "aux:task:delete-archived-tasks" // DeleteCompletedTaskType is the name of the task responsible for deleting // completed tasks from a task queue DeleteCompletedTaskType = "aux:task:delete-completed-tasks" )
View Source
const ( // CommandTaskType is the name of the task for executing external // commands. CommandTaskType = "aux:task:command" )
View Source
const ( // HousekeeperTaskType is the name of the task responsible for cleaning // up stale records from the database. HousekeeperTaskType = "aux:task:housekeeper" )
Variables ¶
View Source
var ErrNoCommand = errors.New("no command specified")
ErrNoCommand is an error which is returned when the task for executing external commands was called without specifying a command as part of the payload.
Functions ¶
func HandleCommandTask ¶
HandleCommandTask executes the command specified as part of the payload.
func HandleDeleteArchivedTask ¶
HandleDeleteArchivedTask deletes archived tasks.
func HandleDeleteCompletedTask ¶
HandleDeleteCompletedTask deletes completed tasks.
Types ¶
type CommandPayload ¶
type CommandPayload struct {
// Command specifies the path to the command to be executed
Command string `yaml:"command" json:"command"`
// Args specifies any optional arguments to be passed to the command.
Args []string `yaml:"args" json:"args"`
// Dir specifies the working directory of the command. If not specified
// then the external command will be executed in the calling process'
// current directory.
Dir string `yaml:"dir" json:"dir"`
}
CommandPayload represents the payload of the task for executing external commands.
type DeleteQueuePayload ¶
type DeleteQueuePayload struct {
// Name of the queue that holds the tasks.
Queue string `yaml:"queue" json:"queue"`
}
DeleteQueuePayload represents the payload of a task management task.
type HousekeeperPayload ¶
type HousekeeperPayload struct {
// Retention provides the retention configuration of objects.
Retention []HousekeeperRetentionConfig `yaml:"retention" json:"retention"`
}
HousekeeperPayload represents the payload of the housekeeper task.
type HousekeeperRetentionConfig ¶
type HousekeeperRetentionConfig struct {
// Name specifies the model name.
Name string `yaml:"name" json:"name"`
// Duration specifies the max duration for which an object will be kept,
// if it hasn't been updated recently.
//
// For example:
//
// UpdatedAt field for an object is set to: Thu May 30 16:00:00 EEST 2024
// Duration of the object is configured to: 4 hours
//
// If the object is not update anymore by the time the housekeeper runs,
// after 20:00:00 this object will be considered as stale and removed
// from the database.
Duration time.Duration `yaml:"duration" json:"duration"`
}
HousekeeperRetentionConfig represents the retention configuration for a given model.
Click to show internal directories.
Click to hide internal directories.