Versions in this module Expand all Collapse all v10 v10.1.0 Aug 15, 2026 v10.0.0 Aug 12, 2026 Changes in this version + const DefaultMaxClaimBatch + const DefaultMinWakeInterval + const DefaultReapBatchSize + const DefaultRetention + const DefaultTablePrefix + const DefaultWriteAttempts + const MaxKeyLength + var ErrClosed = platformerrors.New("work queue is closed") + var ErrEmptyKey = platformerrors.New("empty work queue key") + var ErrEmptyQueueName = platformerrors.New("empty work queue name") + var ErrInvalidLease = platformerrors.New("invalid work queue lease") + var ErrInvalidPollInterval = platformerrors.New("invalid work queue poll interval") + var ErrKeyCodecTypeMismatch = platformerrors.New("key codec type does not match queue key type") + var ErrKeyContainsControlCharacter = platformerrors.New("work queue key contains a control character") + var ErrKeyTooLong = platformerrors.New("encoded work queue key is too long") + var ErrNilConfig = platformerrors.Wrap(platformerrors.ErrNilInputParameter, "nil work queue config") + var ErrNilDatabaseClient = platformerrors.Wrap(platformerrors.ErrNilInputParameter, "nil database client") + type Config struct + MaxAttempts uint + MaxClaimBatch int + MinWakeInterval time.Duration + Name string + NotifyChannel string + ReapBatchSize int + Retention time.Duration + TablePrefix string + WriteAttempts uint + func (cfg *Config) EnsureDefaults() + func (cfg *Config) ValidateWithContext(ctx context.Context) error + type Entry struct + Delay time.Duration + Key K + Priority int + type Item struct + Attempts int + Key K + Priority int + Reclaimed bool + type KeyCodec interface + DecodeKey func(encoded string) (K, error) + EncodeKey func(key K) (string, error) + func DefaultKeyCodec[K comparable]() KeyCodec[K] + type Option func(*queueOptions) + func WithKeyCodec[K comparable](codec KeyCodec[K]) Option + func WithLogger(logger logging.Logger) Option + func WithMetricsProvider(metricsProvider metrics.Provider) Option + func WithTracerProvider(tracerProvider tracing.Provider) Option + func WithWakeup(wakeup <-chan struct{}) Option + type Queue struct + func New[K comparable](ctx context.Context, cfg *Config, client database.Client, opts ...Option) (*Queue[K], error) + func (q *Queue[K]) Claim(ctx context.Context, limit int, lease time.Duration) ([]Item[K], error) + func (q *Queue[K]) Close(ctx context.Context) error + func (q *Queue[K]) Complete(ctx context.Context, keys ...K) error + func (q *Queue[K]) Enqueue(ctx context.Context, entries ...Entry[K]) error + func (q *Queue[K]) EnqueueKeys(ctx context.Context, keys ...K) error + func (q *Queue[K]) Name() string + func (q *Queue[K]) Reap(ctx context.Context) (int64, error) + func (q *Queue[K]) Release(ctx context.Context, delay time.Duration, cause error, keys ...K) error + func (q *Queue[K]) Remove(ctx context.Context, keys ...K) error + func (q *Queue[K]) Stats(ctx context.Context) (Stats, error) + func (q *Queue[K]) Wait(ctx context.Context, poll time.Duration) error + type Stats struct + Completed int64 + Leased int64 + OldestReadyAge time.Duration + Pending int64 + Ready int64 + Stalled int64 Other modules containing this package github.com/primandproper/platform-go/v11 github.com/primandproper/platform-go/v12