inline

package
v0.14.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inline holds an in-process queue that actually dispatches (§2.8).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(ctx context.Context, job ports.RunJob) error

Handler is what the queue hands a job to: the runtime's worker.

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

func New(ctx context.Context) *Queue

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

func (q *Queue) Bind(handler Handler)

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) Cancel added in v0.3.0

func (q *Queue) Cancel(_ context.Context, key string) error

Cancel stops every timer waiting under key.

func (*Queue) Clear

func (q *Queue) Clear()

Clear drops everything still scheduled: for tests and clean shutdown. What it drops is logged.

func (*Queue) Enqueue

func (q *Queue) Enqueue(_ context.Context, job ports.RunJob, opts *ports.EnqueueOptions) error

func (*Queue) Find added in v0.3.0

func (q *Queue) Find(_ context.Context, runID string) (*ports.QueuedJob, error)

Find returns the earliest waiting job for a run, or nil.

func (*Queue) Stats added in v0.3.0

func (q *Queue) Stats(_ context.Context) (ports.QueueStats, error)

Stats counts the timers still pending.

func (*Queue) Wait

func (q *Queue) Wait()

Wait blocks until every scheduled job has run. For tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL