Documentation
¶
Index ¶
- func NormalizeDeliveryStatus(status string) string
- func NormalizeDispatchStatus(status string) string
- func NormalizeHTTPHeaderName(name string) (string, error)
- func NormalizeSource(source string) string
- func NormalizeTopicEventRecord(item domain.TopicEventRecord, assignID bool) (domain.TopicEventRecord, error)
- func PayloadSHA256(payloadJSON string) string
- func PublisherProject(ctx context.Context) string
- func ScanTopicEvent(scan func(dest ...any) error) (domain.TopicEventRecord, error)
- func ScanTopicEvents(rows *sql.Rows) ([]domain.TopicEventRecord, error)
- func SelectTopicEventSQL() string
- func SourceFilterValues(source string) []string
- func TriggerTopicMatches(pattern, topic string) bool
- func ValidateTopicName(topic string) error
- func WithPublisherProject(ctx context.Context, projectID string) context.Context
- type Bus
- type Dispatcher
- type ReleaseEventClaimRequest
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeDeliveryStatus ¶
func NormalizeDispatchStatus ¶
func NormalizeHTTPHeaderName ¶
func NormalizeSource ¶
func NormalizeTopicEventRecord ¶
func NormalizeTopicEventRecord(item domain.TopicEventRecord, assignID bool) (domain.TopicEventRecord, error)
func PayloadSHA256 ¶
func PublisherProject ¶
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 ¶
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 ¶
TriggerTopicMatches reports whether a scheduler trigger's topic pattern selects a published topic. A trailing "*" matches any suffix.
func ValidateTopicName ¶
func WithPublisherProject ¶
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
}