Documentation
¶
Index ¶
- Constants
- Variables
- func AddGlobalMiddleware(mw tasker.JobMiddleware)
- func Cancel(ctx context.Context, id tasker.JobID) (*tasker.JobRow, error)
- func Chain(ctx context.Context, jobs []tasker.Job, opts ...tasker.DispatchOpt) ([]*tasker.JobRow, error)
- func Dispatch(ctx context.Context, job tasker.Job, opts ...tasker.DispatchOpt) (*tasker.JobRow, error)
- func DispatchBatch(ctx context.Context, jobs []tasker.Job, opts ...tasker.DispatchOpt) ([]*tasker.JobRow, error)
- func GetJob(ctx context.Context, id tasker.JobID) (*tasker.JobRow, error)
- func RegisterJob(name string, factory tasker.JobFactory)
- func Retry(ctx context.Context, id tasker.JobID) (*tasker.JobRow, error)
- type Config
- type Provider
Constants ¶
View Source
const ConfigStub = `` /* 1664-byte string literal not displayed */
View Source
const TagConfig = "queue-config"
TagConfig is what `lemmego publish --tags` selects this module's configuration on.
Variables ¶
View Source
var ErrNotInitialized = errors.New("queue: provider is not initialized")
Functions ¶
func AddGlobalMiddleware ¶
func AddGlobalMiddleware(mw tasker.JobMiddleware)
func DispatchBatch ¶
func RegisterJob ¶
func RegisterJob(name string, factory tasker.JobFactory)
Types ¶
type Config ¶
type Config struct {
Driver string
DSN string
DriverName string
TablePrefix string
RoutePrefix string
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime time.Duration
RedisAddr string
RedisPass string
RedisDB int
RedisPoolSize int
RedisPrefix string
DefaultQueue string
DefaultMaxAttempts int
Workers map[string]int
EnableAutoscale bool
HeartbeatInterval int
RequeueInterval int
RequeueTimeout int
PruneInterval int
PruneAfterHours int
// contains filtered or unexported fields
}
func DefaultConfig ¶
func DefaultConfig() *Config
func (*Config) ApplyOverrides ¶
ApplyOverrides applies every present key, including false and zero values.
type Provider ¶ added in v0.1.1
type Provider struct {
Config *Config
// DashboardAuth decides whether a request may use the management
// dashboard. Return true to let it through, false to answer 401.
//
// The dashboard can retry, cancel and delete jobs, so it stays closed
// until this is set: leaving it nil is not "no authentication", it is
// "no access". That is deliberate — the failure mode of the opposite
// default is a public button that clears somebody's queue.
//
// It takes an app.Context rather than a user, because "may this person
// use it" is a question about the request, and the answer usually needs
// the application's own user type:
//
// DashboardAuth: func(c app.Context) bool {
// user, ok := auth.UserAs[*models.User](c)
// return ok && slices.Contains(admins, user.Email)
// },
//
// Authentication has already run by the time this is called, so a
// session cookie or a bearer token both resolve the same user. Nothing
// stops a check that ignores users entirely — a shared secret header,
// or an IP allowlist — which is why this is a predicate over the
// request and not over a user interface.
DashboardAuth func(c app.Context) bool
// contains filtered or unexported fields
}
func (*Provider) AddCommands ¶ added in v0.1.1
func (*Provider) AddPublishables ¶ added in v0.1.1
func (p *Provider) AddPublishables() []*app.Publishable
func (*Provider) AddRoutes ¶ added in v0.1.1
func (p *Provider) AddRoutes() app.RouteCallback
Click to show internal directories.
Click to hide internal directories.