trigger

package
v0.204.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 15 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 trigger contains the provider-neutral, authenticated trigger dispatch core. HTTP and provider adapters are intentionally outside this package; P0 exposes only an in-process invocation seam for tests and server orchestration.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownTrigger  = errors.New("unknown or disabled trigger")
	ErrUnauthenticated = errors.New("trigger authentication failed")
	ErrReplay          = errors.New("trigger timestamp outside replay window")
	ErrRateLimited     = errors.New("trigger rate limited")
)

Functions

func VerifyHMAC

func VerifyHMAC(tc config.TriggerConfig, body []byte, headers map[string]string, now time.Time) error

Types

type AuditFunc

type AuditFunc func(kind, triggerName, owner, requestID, eventID, jobID, code string) error

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(cfg *config.Config, store *jobstore.Store, submit SubmitFunc) *Engine

func (*Engine) Invoke

func (e *Engine) Invoke(ctx context.Context, req TriggerRequest) (Result, error)

func (*Engine) SetAudit

func (e *Engine) SetAudit(a AuditFunc)

func (*Engine) SetClock

func (e *Engine) SetClock(now func() time.Time)

func (*Engine) SetLimiter

func (e *Engine) SetLimiter(l *Limiter)

type Limiter

type Limiter struct {
	// contains filtered or unexported fields
}

func NewLimiter

func NewLimiter() *Limiter

func (*Limiter) Allow

func (l *Limiter) Allow(name string, rate config.TriggerRateConfig) bool

func (*Limiter) Done

func (l *Limiter) Done(name string)

type Result

type Result struct {
	RequestID, JobID string
	Duplicate        bool
}

type SubmitFunc

type SubmitFunc func(context.Context, job.JobRequest) (string, error)

type TriggerRequest

type TriggerRequest struct {
	TriggerName     string
	RequestID       string
	ExternalEventID string
	ReceivedAt      time.Time
	RawBody         []byte
	Headers         map[string]string
	Payload         map[string]any
	Source          string
}

Jump to

Keyboard shortcuts

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