Documentation
¶
Index ¶
- Constants
- Variables
- func CanRetry(options TaskOptions, currentRetries int) bool
- func CanTransition(from State, to State) bool
- func ComputeRetryDelay(options TaskOptions, currentRetries int, ...) time.Duration
- func QueueAdminActions(options QueueAdminOptions) []admin.Action
- func RegisterAdmin(registry *admin.Registry, options QueueAdminOptions) error
- func RegisterBrokerFactory(scheme string, factory BrokerFactory)
- func RegisterResultBackendFactory(scheme string, factory ResultBackendFactory)
- func RegisterScheduleStoreFactory(scheme string, factory ScheduleStoreFactory)
- func Retry(err error, options ...RetryOption) error
- func ValidateBrokerTLS(config BrokerTLSConfig) error
- type AckPolicy
- type ActiveTask
- type App
- func (a *App) DiscoverTasks(providers ...TaskProvider) error
- func (a *App) RegisterTask(name string, fn TaskFunc, options TaskOptions) (Task, error)
- func (a *App) SendTask(ctx context.Context, broker Broker, signature Signature, options SendOptions) (BrokerMessage, error)
- func (a *App) SetTaskRateLimit(name string, limit RateLimit) error
- func (a *App) SetTaskTimeLimit(name string, soft time.Duration, hard time.Duration) error
- func (a *App) Task(name string) (Task, bool)
- func (a *App) Tasks() []Task
- type AppOptions
- type AutoscaleConfig
- type AutoscaleState
- type Beat
- type BeatOptions
- type Broker
- type BrokerConsumeOptions
- type BrokerFactory
- type BrokerMessage
- type BrokerPublishOptions
- type BrokerQueueInfo
- type BrokerQueueOptions
- type BrokerTLSConfig
- type ClockedSchedule
- type Compression
- type ContentTypeAllowlist
- type CrontabSchedule
- type Envelope
- type EnvelopeOptions
- type Event
- type EventRecorder
- type EventSink
- type EventType
- type GoroutinePool
- type GroupResult
- type InspectOptions
- type InspectReport
- type Inspector
- func (i *Inspector) ActiveTasks() []ActiveTask
- func (i *Inspector) DisableEvents()
- func (i *Inspector) EnableEvents()
- func (i *Inspector) Ping(context.Context) PingResponse
- func (i *Inspector) PoolGrow(worker *Worker, delta int)
- func (i *Inspector) PoolRestart(ctx context.Context, worker *Worker) error
- func (i *Inspector) PoolShrink(worker *Worker, delta int)
- func (i *Inspector) QueueLengths(ctx context.Context) ([]BrokerQueueInfo, error)
- func (i *Inspector) RateLimit(taskName string, limit RateLimit) error
- func (i *Inspector) RegisteredTasks() []Task
- func (i *Inspector) Report(ctx context.Context) (InspectReport, error)
- func (i *Inspector) ReservedTasks(context.Context) ([]BrokerMessage, error)
- func (i *Inspector) RevokeByStampedHeaders(name string, value string)
- func (i *Inspector) RevokeTask(taskID string)
- func (i *Inspector) ScheduledTasks(ctx context.Context) ([]ScheduleEntry, error)
- func (i *Inspector) Shutdown(ctx context.Context, worker *Worker, mode ShutdownMode) error
- func (i *Inspector) TimeLimit(taskName string, soft time.Duration, hard time.Duration) error
- func (i *Inspector) WorkerStats() []WorkerStats
- type IntervalSchedule
- type MemoryScheduleStore
- type MemoryScheduleStoreOptions
- type MessageSigner
- type MessageSignerOptions
- type NextSchedule
- type Payload
- type PingResponse
- type Pool
- type PoolExecutable
- type PoolStrategy
- type ProcessPool
- type ProcessPoolOptions
- type QueueAdminModel
- type QueueAdminOptions
- type QueueAdminView
- type RateLimit
- type RateLimiter
- type RateLimiterOptions
- type Redactor
- type RedactorOptions
- type Result
- type ResultBackend
- type ResultBackendFactory
- type RetryError
- type RetryOption
- type RevocationRegistry
- func (r *RevocationRegistry) ClearStampedHeader(name string, value string)
- func (r *RevocationRegistry) ClearTask(taskID string)
- func (r *RevocationRegistry) IsRevoked(envelope Envelope) bool
- func (r *RevocationRegistry) RevokeStampedHeader(name string, value string)
- func (r *RevocationRegistry) RevokeTask(taskID string)
- type Route
- type RouteFunc
- type Router
- type RouterOptions
- type RuntimeConfig
- type Schedule
- type ScheduleEntry
- type ScheduleLock
- type ScheduleStore
- type ScheduleStoreFactory
- type SendOptions
- type SensitiveValue
- type SerializationOptions
- type SerializationRegistry
- type Serializer
- type ShutdownMode
- type Signature
- func (s Signature) Clone() Signature
- func (s Signature) WithCountdown(countdown time.Duration, now ...time.Time) Signature
- func (s Signature) WithETA(eta time.Time) Signature
- func (s Signature) WithExpires(expires time.Time) Signature
- func (s Signature) WithHeader(name string, value string) Signature
- func (s Signature) WithKwarg(name string, value any) Signature
- func (s Signature) WithPriority(priority int) Signature
- func (s Signature) WithQueue(queue string) Signature
- type SignatureOptions
- type SolarEvent
- type SolarProvider
- type SolarSchedule
- type SoloPool
- type State
- type Task
- type TaskDefinition
- type TaskFunc
- type TaskOptions
- type TaskProvider
- type Worker
- func (w *Worker) ActiveTasks() []ActiveTask
- func (w *Worker) Grow(delta int)
- func (w *Worker) Heartbeat(ctx context.Context)
- func (w *Worker) MemoryLimitExceeded() bool
- func (w *Worker) PrefetchLimit() int
- func (w *Worker) RestartPool(ctx context.Context) error
- func (w *Worker) Run(ctx context.Context) error
- func (w *Worker) RunOnce(ctx context.Context) error
- func (w *Worker) Shrink(delta int)
- func (w *Worker) Shutdown(ctx context.Context, mode ShutdownMode) error
- func (w *Worker) Start(ctx context.Context) error
- func (w *Worker) Stats() WorkerStats
- func (w *Worker) TargetConcurrency(readyTasks int) int
- type WorkerLogEntry
- type WorkerLogger
- type WorkerOptions
- type WorkerStats
Constants ¶
const ( SignatureHeader = "x-gogo-signature" TimestampHeader = "x-gogo-timestamp" KeyIDHeader = "x-gogo-key-id" RedactedValue = "[REDACTED]" )
Variables ¶
var ( ErrQueueEmpty = errors.New("queue empty") ErrBrokerClosed = errors.New("broker closed") )
var ( ErrRetryRequested = errors.New("retry requested") ErrSoftTimeout = errors.New("soft timeout exceeded") ErrHardTimeout = errors.New("hard timeout exceeded") )
var ( ErrMessageSigningKey = errors.New("message signing key error") ErrInvalidMessageSignature = errors.New("invalid message signature") ErrMessageExpired = errors.New("message timestamp outside replay window") ErrRejectedContentType = errors.New("rejected content type") ErrInvalidBrokerTLS = errors.New("invalid broker tls configuration") )
var ( ErrUnknownSerializer = errors.New("unknown serializer") ErrUntrustedSerializer = errors.New("untrusted serializer") ErrUnsupportedCompression = errors.New("unsupported compression") )
var ( ErrDuplicateTask = errors.New("duplicate task") ErrInvalidTask = errors.New("invalid task") )
var ( ErrWorkerNotConfigured = errors.New("worker not configured") ErrWorkerRunning = errors.New("worker already running") ErrWorkerStopped = errors.New("worker stopped") ErrWorkerMemoryLimit = errors.New("worker memory limit exceeded") ErrTaskNotRegistered = errors.New("task not registered") )
var ErrScheduleLocked = errors.New("schedule locked")
var ErrUnsupportedRuntimeURL = errors.New("unsupported queue runtime URL")
Functions ¶
func CanRetry ¶
func CanRetry(options TaskOptions, currentRetries int) bool
func CanTransition ¶
func ComputeRetryDelay ¶
func QueueAdminActions ¶
func QueueAdminActions(options QueueAdminOptions) []admin.Action
func RegisterAdmin ¶
func RegisterAdmin(registry *admin.Registry, options QueueAdminOptions) error
func RegisterBrokerFactory ¶
func RegisterBrokerFactory(scheme string, factory BrokerFactory)
func RegisterResultBackendFactory ¶
func RegisterResultBackendFactory(scheme string, factory ResultBackendFactory)
func RegisterScheduleStoreFactory ¶
func RegisterScheduleStoreFactory(scheme string, factory ScheduleStoreFactory)
func Retry ¶
func Retry(err error, options ...RetryOption) error
func ValidateBrokerTLS ¶
func ValidateBrokerTLS(config BrokerTLSConfig) error
Types ¶
type AckPolicy ¶
type AckPolicy string
AckPolicy controls when workers acknowledge broker deliveries.
type ActiveTask ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App owns task registration and lookup.
func NewApp ¶
func NewApp(options AppOptions) *App
func (*App) DiscoverTasks ¶
func (a *App) DiscoverTasks(providers ...TaskProvider) error
func (*App) RegisterTask ¶
func (*App) SendTask ¶
func (a *App) SendTask(ctx context.Context, broker Broker, signature Signature, options SendOptions) (BrokerMessage, error)
func (*App) SetTaskTimeLimit ¶
type AppOptions ¶
type AppOptions struct {
DefaultQueue string
DefaultSerializer string
DefaultMaxRetries int
DefaultAckPolicy AckPolicy
}
AppOptions configures the queue app defaults.
type AutoscaleConfig ¶
type AutoscaleState ¶
type AutoscaleState struct {
MinConcurrency int
MaxConcurrency int
ScaleUpReadyTasks int
ScaleDownIdleFor time.Duration
}
func ResolveAutoscale ¶
func ResolveAutoscale(baseConcurrency int, config AutoscaleConfig) AutoscaleState
func (AutoscaleState) Target ¶
func (s AutoscaleState) Target(readyTasks int) int
type Beat ¶
type Beat struct {
// contains filtered or unexported fields
}
func NewBeat ¶
func NewBeat(app *App, broker Broker, store ScheduleStore, options BeatOptions) *Beat
type BeatOptions ¶
type Broker ¶
type Broker interface {
Publish(context.Context, string, Envelope, BrokerPublishOptions) (BrokerMessage, error)
Consume(context.Context, string, BrokerConsumeOptions) (BrokerMessage, error)
Ack(context.Context, BrokerMessage) error
Nack(context.Context, BrokerMessage, bool) error
Requeue(context.Context, BrokerMessage, time.Duration) error
DeclareQueue(context.Context, string, BrokerQueueOptions) error
PurgeQueue(context.Context, string) (int, error)
InspectQueues(context.Context) ([]BrokerQueueInfo, error)
Close() error
}
Broker is the stable worker-facing queue broker contract.
func NewBrokerFromURL ¶
func NewBrokerFromURL(config RuntimeConfig) (Broker, error)
type BrokerConsumeOptions ¶
type BrokerFactory ¶
type BrokerFactory func(RuntimeConfig) (Broker, error)
type BrokerMessage ¶
type BrokerPublishOptions ¶
type BrokerQueueInfo ¶
type BrokerQueueOptions ¶
type BrokerTLSConfig ¶
type ClockedSchedule ¶
type Compression ¶
type Compression string
const ( CompressionNone Compression = "none" CompressionGzip Compression = "gzip" CompressionZstd Compression = "zstd" )
type ContentTypeAllowlist ¶
type ContentTypeAllowlist struct {
// contains filtered or unexported fields
}
func NewContentTypeAllowlist ¶
func NewContentTypeAllowlist(contentTypes ...string) ContentTypeAllowlist
func (ContentTypeAllowlist) Validate ¶
func (a ContentTypeAllowlist) Validate(contentType string) error
type CrontabSchedule ¶
type Envelope ¶
type Envelope struct {
ID string `json:"id"`
RootID string `json:"root_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
GroupID string `json:"group_id,omitempty"`
ChordID string `json:"chord_id,omitempty"`
Name string `json:"name"`
Args []any `json:"args,omitempty"`
Kwargs map[string]any `json:"kwargs,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Retries int `json:"retries"`
ETA *time.Time `json:"eta,omitempty"`
Expires *time.Time `json:"expires,omitempty"`
Queue string `json:"queue,omitempty"`
Priority int `json:"priority,omitempty"`
ReplyTo string `json:"reply_to,omitempty"`
CorrelationID string `json:"correlation_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Envelope is the durable broker message for one task.
func NewEnvelope ¶
func NewEnvelope(signature Signature, options EnvelopeOptions) Envelope
type EnvelopeOptions ¶
type EventRecorder ¶
type EventRecorder struct {
// contains filtered or unexported fields
}
func NewEventRecorder ¶
func NewEventRecorder() *EventRecorder
func (*EventRecorder) Clear ¶
func (r *EventRecorder) Clear()
func (*EventRecorder) Disable ¶
func (r *EventRecorder) Disable()
func (*EventRecorder) EmitQueueEvent ¶
func (r *EventRecorder) EmitQueueEvent(_ context.Context, event Event)
func (*EventRecorder) Enable ¶
func (r *EventRecorder) Enable()
func (*EventRecorder) Enabled ¶
func (r *EventRecorder) Enabled() bool
func (*EventRecorder) Events ¶
func (r *EventRecorder) Events() []Event
type EventType ¶
type EventType string
const ( EventWorkerOnline EventType = "worker.online" EventWorkerHeartbeat EventType = "worker.heartbeat" EventWorkerOffline EventType = "worker.offline" EventTaskSent EventType = "task.sent" EventTaskReceived EventType = "task.received" EventTaskStarted EventType = "task.started" EventTaskSucceeded EventType = "task.succeeded" EventTaskFailed EventType = "task.failed" EventTaskRetried EventType = "task.retried" EventTaskRevoked EventType = "task.revoked" )
type GoroutinePool ¶
type GoroutinePool struct{}
func NewGoroutinePool ¶
func NewGoroutinePool() *GoroutinePool
func (*GoroutinePool) Run ¶
func (p *GoroutinePool) Run(ctx context.Context, executable PoolExecutable) (any, error)
func (*GoroutinePool) Strategy ¶
func (p *GoroutinePool) Strategy() PoolStrategy
type GroupResult ¶
GroupResult stores a group result handle.
func (GroupResult) Clone ¶
func (g GroupResult) Clone() GroupResult
type InspectOptions ¶
type InspectOptions struct {
App *App
Broker Broker
Store ScheduleStore
Workers []*Worker
Revocations *RevocationRegistry
Events *EventRecorder
}
type InspectReport ¶
type InspectReport struct {
Registered []Task
Active []ActiveTask
Scheduled []ScheduleEntry
Reserved []BrokerMessage
Queues []BrokerQueueInfo
Workers []WorkerStats
}
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
func NewInspector ¶
func NewInspector(options InspectOptions) *Inspector
func (*Inspector) ActiveTasks ¶
func (i *Inspector) ActiveTasks() []ActiveTask
func (*Inspector) DisableEvents ¶
func (i *Inspector) DisableEvents()
func (*Inspector) EnableEvents ¶
func (i *Inspector) EnableEvents()
func (*Inspector) PoolRestart ¶
func (*Inspector) PoolShrink ¶
func (*Inspector) QueueLengths ¶
func (i *Inspector) QueueLengths(ctx context.Context) ([]BrokerQueueInfo, error)
func (*Inspector) RegisteredTasks ¶
func (*Inspector) ReservedTasks ¶
func (i *Inspector) ReservedTasks(context.Context) ([]BrokerMessage, error)
func (*Inspector) RevokeByStampedHeaders ¶
func (*Inspector) RevokeTask ¶
func (*Inspector) ScheduledTasks ¶
func (i *Inspector) ScheduledTasks(ctx context.Context) ([]ScheduleEntry, error)
func (*Inspector) WorkerStats ¶
func (i *Inspector) WorkerStats() []WorkerStats
type IntervalSchedule ¶
type MemoryScheduleStore ¶
type MemoryScheduleStore struct {
// contains filtered or unexported fields
}
func NewMemoryScheduleStore ¶
func NewMemoryScheduleStore(options MemoryScheduleStoreOptions) *MemoryScheduleStore
func (*MemoryScheduleStore) List ¶
func (s *MemoryScheduleStore) List(context.Context) ([]ScheduleEntry, error)
func (*MemoryScheduleStore) Lock ¶
func (s *MemoryScheduleStore) Lock(_ context.Context, name string, ttl time.Duration) (ScheduleLock, error)
func (*MemoryScheduleStore) Save ¶
func (s *MemoryScheduleStore) Save(_ context.Context, entry ScheduleEntry) error
type MessageSigner ¶
type MessageSigner struct {
// contains filtered or unexported fields
}
func NewMessageSigner ¶
func NewMessageSigner(options MessageSignerOptions) *MessageSigner
type MessageSignerOptions ¶
type Payload ¶
type Payload struct {
Serializer string
ContentType string
Compression Compression
Body []byte
}
Payload is a serialized queue message body.
type Pool ¶
type Pool interface {
Strategy() PoolStrategy
Run(context.Context, PoolExecutable) (any, error)
Close(context.Context) error
}
Pool executes task callables behind a stable worker runtime boundary.
type PoolStrategy ¶
type PoolStrategy string
const ( PoolGoroutine PoolStrategy = "goroutine" PoolSolo PoolStrategy = "solo" PoolProcessBacked PoolStrategy = "process" )
type ProcessPool ¶
type ProcessPool struct {
// contains filtered or unexported fields
}
ProcessPool is a process-backed execution boundary where supported by the host. The initial implementation preserves the boundary contract while executing through goroutines so callers can opt into the strategy without a platform fork.
func NewProcessPool ¶
func NewProcessPool(ProcessPoolOptions) *ProcessPool
func (*ProcessPool) Run ¶
func (p *ProcessPool) Run(ctx context.Context, executable PoolExecutable) (any, error)
func (*ProcessPool) Strategy ¶
func (p *ProcessPool) Strategy() PoolStrategy
type ProcessPoolOptions ¶
type ProcessPoolOptions struct{}
type QueueAdminModel ¶
type QueueAdminModel struct {
Metadata models.Metadata
Admin admin.ModelAdmin
}
func QueueAdminModels ¶
func QueueAdminModels(options QueueAdminOptions) []QueueAdminModel
type QueueAdminOptions ¶
type QueueAdminOptions struct {
Broker Broker
Store ScheduleStore
Revocations *RevocationRegistry
Inspector *Inspector
}
type QueueAdminView ¶
func QueueAdminViews ¶
func QueueAdminViews(options QueueAdminOptions) []QueueAdminView
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(options RateLimiterOptions) *RateLimiter
func (*RateLimiter) Reset ¶
func (l *RateLimiter) Reset(taskName string)
type RateLimiterOptions ¶
type Redactor ¶
type Redactor struct {
// contains filtered or unexported fields
}
func NewRedactor ¶
func NewRedactor(options RedactorOptions) Redactor
func (Redactor) RedactEnvelope ¶
func (Redactor) RedactEvent ¶
func (Redactor) RedactResult ¶
type RedactorOptions ¶
type RedactorOptions struct {
SensitiveKeys []string
}
type Result ¶
type Result struct {
TaskID string
State State
Result any
Error string
Traceback string
Children []string
ExpiresAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
Result stores task execution state and payloads.
type ResultBackend ¶
type ResultBackend interface {
StoreResult(context.Context, Result) error
GetResult(context.Context, string) (Result, error)
Forget(context.Context, string) error
Wait(context.Context, string, time.Duration) (Result, error)
Children(context.Context, string) ([]string, error)
GroupResult(context.Context, string, []string) (GroupResult, error)
ChordCounter(context.Context, string, int) (int, error)
}
ResultBackend is the worker-facing result storage contract.
func NewResultBackendFromURL ¶
func NewResultBackendFromURL(config RuntimeConfig) (ResultBackend, error)
type ResultBackendFactory ¶
type ResultBackendFactory func(RuntimeConfig) (ResultBackend, error)
type RetryError ¶
func AsRetry ¶
func AsRetry(err error) (*RetryError, bool)
func (*RetryError) Error ¶
func (e *RetryError) Error() string
func (*RetryError) Unwrap ¶
func (e *RetryError) Unwrap() error
type RetryOption ¶
type RetryOption func(*RetryError)
func RetryCountdown ¶
func RetryCountdown(countdown time.Duration) RetryOption
func RetryETA ¶
func RetryETA(eta time.Time) RetryOption
func RetryMaxRetries ¶
func RetryMaxRetries(maxRetries int) RetryOption
type RevocationRegistry ¶
type RevocationRegistry struct {
// contains filtered or unexported fields
}
func NewRevocationRegistry ¶
func NewRevocationRegistry() *RevocationRegistry
func (*RevocationRegistry) ClearStampedHeader ¶
func (r *RevocationRegistry) ClearStampedHeader(name string, value string)
func (*RevocationRegistry) ClearTask ¶
func (r *RevocationRegistry) ClearTask(taskID string)
func (*RevocationRegistry) IsRevoked ¶
func (r *RevocationRegistry) IsRevoked(envelope Envelope) bool
func (*RevocationRegistry) RevokeStampedHeader ¶
func (r *RevocationRegistry) RevokeStampedHeader(name string, value string)
func (*RevocationRegistry) RevokeTask ¶
func (r *RevocationRegistry) RevokeTask(taskID string)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(options RouterOptions) *Router
type RouterOptions ¶
type RuntimeConfig ¶
type ScheduleEntry ¶
type ScheduleEntry struct {
Name string
Signature Signature
Schedule Schedule
Enabled bool
OneOff bool
LastRunAt *time.Time
TotalRunCount int
Send SendOptions
}
func (ScheduleEntry) Clone ¶
func (e ScheduleEntry) Clone() ScheduleEntry
type ScheduleLock ¶
type ScheduleStore ¶
type ScheduleStore interface {
List(context.Context) ([]ScheduleEntry, error)
Save(context.Context, ScheduleEntry) error
Lock(context.Context, string, time.Duration) (ScheduleLock, error)
}
func NewScheduleStoreFromURL ¶
func NewScheduleStoreFromURL(config RuntimeConfig) (ScheduleStore, error)
type ScheduleStoreFactory ¶
type ScheduleStoreFactory func(RuntimeConfig) (ScheduleStore, error)
type SendOptions ¶
type SensitiveValue ¶
type SensitiveValue struct {
Value any
}
func Sensitive ¶
func Sensitive(value any) SensitiveValue
type SerializationOptions ¶
type SerializationOptions struct {
AllowUntrustedSerializers []string
}
type SerializationRegistry ¶
type SerializationRegistry struct {
// contains filtered or unexported fields
}
SerializationRegistry stores serializers and trust settings.
func NewSerializationRegistry ¶
func NewSerializationRegistry(options SerializationOptions) *SerializationRegistry
func (*SerializationRegistry) Decode ¶
func (r *SerializationRegistry) Decode(payload Payload, value any) error
func (*SerializationRegistry) Encode ¶
func (r *SerializationRegistry) Encode(serializerName string, value any, compression Compression) (Payload, error)
func (*SerializationRegistry) Register ¶
func (r *SerializationRegistry) Register(serializer Serializer)
type Serializer ¶
type Serializer interface {
Name() string
ContentType() string
Trusted() bool
Marshal(any) ([]byte, error)
Unmarshal([]byte, any) error
}
Serializer encodes and decodes queue payloads.
type ShutdownMode ¶
type ShutdownMode string
const ( GracefulShutdown ShutdownMode = "graceful" WarmShutdown ShutdownMode = "warm" ColdShutdown ShutdownMode = "cold" )
type Signature ¶
type Signature struct {
Name string
Args []any
Kwargs map[string]any
Headers map[string]string
Options SignatureOptions
}
Signature describes a task call before it becomes an envelope.
func NewSignature ¶
func (Signature) WithCountdown ¶
func (Signature) WithPriority ¶
type SignatureOptions ¶
SignatureOptions stores immutable task dispatch options.
type SolarEvent ¶
type SolarEvent string
const ( SolarSunrise SolarEvent = "sunrise" SolarSunset SolarEvent = "sunset" )
type SolarProvider ¶
type SolarSchedule ¶
type SolarSchedule struct {
Event SolarEvent
Latitude float64
Longitude float64
Location *time.Location
Provider SolarProvider
}
type SoloPool ¶
type SoloPool struct{}
func NewSoloPool ¶
func NewSoloPool() *SoloPool
func (*SoloPool) Strategy ¶
func (p *SoloPool) Strategy() PoolStrategy
type Task ¶
type Task struct {
Name string
Func TaskFunc
Options TaskOptions
}
Task is one registered queue task.
type TaskDefinition ¶
type TaskDefinition struct {
Name string
Func TaskFunc
Options TaskOptions
}
TaskDefinition is discovered from installed apps.
type TaskOptions ¶
type TaskOptions struct {
Serializer string
Queue string
RoutingKey string
Priority int
MaxRetries int
DefaultRetryDelay time.Duration
RetryBackoff bool
RetryJitter bool
SoftTimeout time.Duration
HardTimeout time.Duration
RateLimit RateLimit
AckPolicy AckPolicy
IgnoreResult bool
TrackStarted bool
}
TaskOptions contains Celery-style task execution options.
type TaskProvider ¶
type TaskProvider interface {
QueueTasks() []TaskDefinition
}
TaskProvider is implemented by installed apps that expose queue tasks.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker(app *App, broker Broker, backend ResultBackend, options WorkerOptions) *Worker
func (*Worker) ActiveTasks ¶
func (w *Worker) ActiveTasks() []ActiveTask
func (*Worker) MemoryLimitExceeded ¶
func (*Worker) PrefetchLimit ¶
func (*Worker) Stats ¶
func (w *Worker) Stats() WorkerStats
func (*Worker) TargetConcurrency ¶
type WorkerLogEntry ¶
type WorkerLogger ¶
type WorkerLogger interface {
LogWorkerEvent(context.Context, WorkerLogEntry)
}
type WorkerOptions ¶
type WorkerOptions struct {
Hostname string
Queues []string
Concurrency int
PrefetchMultiplier int
VisibilityTimeout time.Duration
PollInterval time.Duration
ShutdownTimeout time.Duration
AckPolicy AckPolicy
RejectOnWorkerLost bool
TrackStarted bool
MaxTasksPerWorkerChild int
MaxMemoryPerWorkerChild uint64
Autoscale AutoscaleConfig
Pool Pool
Logger WorkerLogger
Events EventSink
MemoryUsage func() uint64
Revocations *RevocationRegistry
RateLimiter *RateLimiter
}
type WorkerStats ¶
type WorkerStats struct {
Hostname string
Queues []string
Concurrency int
PrefetchLimit int
PoolStrategy PoolStrategy
RejectOnWorkerLost bool
MaxTasksPerWorkerChild int
MaxMemoryPerWorkerChild uint64
Processed int
Succeeded int
Failed int
Revoked int
RateLimited int
Acked int
Nacked int
Recycled int
Running int
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
redis
Package redis provides a real Redis-backed queue result backend.
|
Package redis provides a real Redis-backed queue result backend. |
|
redis
Package redis provides a real Redis-backed queue broker for Gogo workers.
|
Package redis provides a real Redis-backed queue broker for Gogo workers. |
|
schedulers
|
|
|
redis
Package redis provides a real Redis-backed beat schedule store.
|
Package redis provides a real Redis-backed beat schedule store. |