Versions in this module Expand all Collapse all v0 v0.1.0 Oct 19, 2026 Changes in this version + var ErrDuplicateJob = errors.New("mongoqueue: job id already exists") + var ErrEmptyResolution = errors.New("mongoqueue: resolution must be non-empty") + var ErrInvalidDelay = errors.New("mongoqueue: delay must be >= 0") + var ErrInvalidLease = errors.New("mongoqueue: lease must be > 0") + var ErrInvalidWeight = errors.New("mongoqueue: weight must be >= 1 (zero means 1)") + var ErrJobNotFound = errors.New("mongoqueue: job not found") + var ErrJobResolved = errors.New("mongoqueue: job already resolved") + var ErrKindMismatch = errors.New("mongoqueue: job kind does not match binding") + var ErrLeaseLost = errors.New("mongoqueue: lease lost") + var ErrMissingJobID = errors.New("mongoqueue: job id is required") + var ErrNoJob = errors.New("mongoqueue: no claimable job") + var ErrVTimeOverflow = errors.New("mongoqueue: virtual time overflow") + type ClaimedJob struct + func (c *ClaimedJob) ClaimID() string + func (c *ClaimedJob) Complete(ctx context.Context, r Resolution) error + func (c *ClaimedJob) Heartbeat(ctx context.Context, extend time.Duration) error + func (c *ClaimedJob) Release(ctx context.Context, delay time.Duration) error + type EnqueueOpts struct + Cost int64 + Delay time.Duration + JobID string + Partition string + TenantID string + Weight int64 + type Job struct + Attempts int + Body bson.Raw + ClaimID string + Cost int64 + ID string + Kind string + Liveness Liveness + Partition string + Resolution Resolution + ResolvedAt time.Time + StampedBy string + TenantID string + VStamp int64 + VisibleAt time.Time + type Kind struct + func NewKind[T any](kind string) Kind[T] + func (k Kind[T]) Decode(j *Job) (T, error) + func (k Kind[T]) Enqueue(ctx context.Context, q *Queue, body T, opts EnqueueOpts) error + func (k Kind[T]) Kind() string + type Liveness string + const LivenessPending + const LivenessResolved + type Option func(*Queue) + func WithNodeID(id string) Option + type Queue struct + func New(coll *mongo.Collection, opts ...Option) *Queue + func (q *Queue) Cancel(ctx context.Context, jobID string) error + func (q *Queue) Claim(ctx context.Context, partition string, lease time.Duration) (*ClaimedJob, error) + func (q *Queue) EnsureIndexes(ctx context.Context) error + func (q *Queue) EnsureTTLIndex(ctx context.Context, retention time.Duration) error + func (q *Queue) Get(ctx context.Context, jobID string) (*Job, error) + func (q *Queue) Reconcile(ctx context.Context) error + type Resolution string + const ResolutionCanceled + const ResolutionCompleted