events

package
v0.0.0-...-4048c46 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeDeliveryStatus

func NormalizeDeliveryStatus(status string) string

func NormalizeDispatchStatus

func NormalizeDispatchStatus(status string) string

func NormalizeHTTPHeaderName

func NormalizeHTTPHeaderName(name string) (string, error)

func NormalizeSource

func NormalizeSource(source string) string

func NormalizeTopicEventRecord

func NormalizeTopicEventRecord(item domain.TopicEventRecord, assignID bool) (domain.TopicEventRecord, error)

func PayloadSHA256

func PayloadSHA256(payloadJSON string) string

func PublisherProject

func PublisherProject(ctx context.Context) string

PublisherProject returns the Project that work under ctx acts for, or empty when ctx carries none.

func ScanTopicEvent

func ScanTopicEvent(scan func(dest ...any) error) (domain.TopicEventRecord, error)

func ScanTopicEvents

func ScanTopicEvents(rows *sql.Rows) ([]domain.TopicEventRecord, error)

func SelectTopicEventSQL

func SelectTopicEventSQL() string

func SourceFilterValues

func SourceFilterValues(source string) []string

SourceFilterValues returns every persisted source value that is equivalent to source. Loader was renamed to scheduler, but upgraded databases intentionally retain loader-era event rows, so scheduler filters must match both stored values.

func TriggerTopicMatches

func TriggerTopicMatches(pattern, topic string) bool

TriggerTopicMatches reports whether a scheduler trigger's topic pattern selects a published topic. A trailing "*" matches any suffix.

func ValidateTopicName

func ValidateTopicName(topic string) error

func WithPublisherProject

func WithPublisherProject(ctx context.Context, projectID string) context.Context

WithPublisherProject marks work done under ctx as acting for projectID, so system events it raises (sandbox lifecycle, agent completion) are attributed to that Project and delivered within its scope.

Types

type Bus

type Bus interface {
	Publish(domain.SchedulerTopicEvent) bool
}

type Dispatcher

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

func NewDispatcher

func NewDispatcher(rootCtx context.Context, configDB Store, bus Bus) *Dispatcher

func (*Dispatcher) DispatchOnce

func (d *Dispatcher) DispatchOnce(ctx context.Context, limit int)

func (*Dispatcher) SetInterval

func (d *Dispatcher) SetInterval(interval time.Duration)

func (*Dispatcher) Start

func (d *Dispatcher) Start()

type ReleaseEventClaimRequest

type ReleaseEventClaimRequest struct {
	EventID       string
	ClaimID       string
	Status        string
	LastError     string
	NextAttemptAt time.Time
}

ReleaseEventClaimRequest describes how to release a previously claimed topic event: the outcome status, an optional error message, and (for a retryable outcome) when the event becomes eligible for redelivery.

type Store

type Store interface {
	ListDispatchableEvents(context.Context, time.Time, int) ([]domain.TopicEventRecord, error)
	ClaimEvent(context.Context, string, string, time.Time, time.Time) (bool, error)
	ReleaseEventClaim(context.Context, ReleaseEventClaimRequest) error
	MarkEventPublished(context.Context, string, string, time.Time) error
	MarkEventNoSubscriber(context.Context, string, string, time.Time) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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