Documentation
¶
Overview ¶
Package inline holds an in-process queue that actually dispatches (§2.8).
Index ¶
- type Handler
- type Queue
- func (q *Queue) Bind(handler Handler)
- func (q *Queue) Cancel(_ context.Context, key string) error
- func (q *Queue) Clear()
- func (q *Queue) Enqueue(_ context.Context, job ports.RunJob, opts *ports.EnqueueOptions) error
- func (q *Queue) Find(_ context.Context, runID string) (*ports.QueuedJob, error)
- func (q *Queue) Stats(_ context.Context) (ports.QueueStats, error)
- func (q *Queue) Wait()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue dispatches in-process, on a later goroutine.
The memory Queue only collects jobs, which is right for tests that drive the worker by hand but useless for running the platform. This one hands each job to the worker on its own goroutine, so Enqueue still returns immediately and a run keeps outliving the request that started it: the property the whole design rests on.
It honours Delay, so the HITL expiry (§2.5) and the lock-conflict redrive (§2.8) work in development exactly as they do against a real queue.
What it is NOT: durable. A process restart loses whatever was in flight, which is precisely what the durable adapters exist to fix. Development only.
func New ¶
New makes a queue. Jobs run with a context derived from ctx; pass context.Background() for a queue that lives as long as the process.
func (*Queue) Bind ¶
Bind wires the worker. The queue and the worker each need the other, so the queue is attached once the runtime exists. A job that came due before this runs is delivered now rather than lost.
func (*Queue) Clear ¶
func (q *Queue) Clear()
Clear drops everything still scheduled: for tests and clean shutdown. What it drops is logged.