Documentation
¶
Index ¶
- type Config
- type Job
- type JobHandler
- type JobPriority
- type JobResult
- type JobStatus
- type Queue
- func (q *Queue) CancelJob(ctx context.Context, jobID string) error
- func (q *Queue) Enqueue(ctx context.Context, job *Job) error
- func (q *Queue) GetJob(ctx context.Context, jobID string) (*Job, error)
- func (q *Queue) GetQueueStats(ctx context.Context) (map[string]interface{}, error)
- func (q *Queue) SetHandler(handler JobHandler)
- func (q *Queue) Start(ctx context.Context) error
- func (q *Queue) Stop() error
- func (q *Queue) UpdateJob(ctx context.Context, job *Job) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Workers int `yaml:"workers"` MaxRetries int `yaml:"max_retries"` RetryBackoff time.Duration `yaml:"retry_backoff"` JobTimeout time.Duration `yaml:"job_timeout"` PollingInterval time.Duration `yaml:"polling_interval"` RetentionPeriod time.Duration `yaml:"retention_period"` }
Config represents queue configuration
type Job ¶
type Job struct { ID string `json:"id"` FunctionID string `json:"function_id"` FunctionName string `json:"function_name"` Payload map[string]interface{} `json:"payload"` Priority JobPriority `json:"priority"` Status JobStatus `json:"status"` Attempts int `json:"attempts"` MaxRetries int `json:"max_retries"` Timeout time.Duration `json:"timeout"` CreatedAt time.Time `json:"created_at"` StartedAt *time.Time `json:"started_at,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` Result *JobResult `json:"result,omitempty"` Error string `json:"error,omitempty"` NextRetryAt *time.Time `json:"next_retry_at,omitempty"` }
Job represents a queued execution job
type JobHandler ¶
JobHandler processes jobs from the queue
type JobPriority ¶
type JobPriority int
JobPriority represents the priority of a job
const ( PriorityLow JobPriority = 0 PriorityNormal JobPriority = 1 PriorityHigh JobPriority = 2 PriorityUrgent JobPriority = 3 )
type JobResult ¶
type JobResult struct { Output string `json:"output"` Duration time.Duration `json:"duration"` ContainerID string `json:"container_id"` ExitCode int `json:"exit_code"` }
JobResult represents the result of a job execution
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents an async job queue
func (*Queue) GetQueueStats ¶
GetQueueStats returns queue statistics
func (*Queue) SetHandler ¶
func (q *Queue) SetHandler(handler JobHandler)
SetHandler updates the job handler
Click to show internal directories.
Click to hide internal directories.