Documentation
¶
Index ¶
- Variables
- func NewSuccessProducer(repo SuccessRepository, next notificationsvc.CandidateProducer) notificationsvc.CandidateProducer
- type Expectation
- type Inspection
- type Notifications
- type Repository
- type Scope
- type Service
- func (s *Service) Evaluate(ctx context.Context, now time.Time) error
- func (s *Service) Inspect(ctx context.Context, scope runrecency.Scope, now time.Time) (*Inspection, error)
- func (s *Service) Update(ctx context.Context, scope runrecency.Scope, expectedRevision int64, ...) (*runrecency.Expectation, error)
- type SuccessRepository
- type Window
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRevisionConflict = xerror.New(xerror.KindAlreadyExists, "RUN_RECENCY_EXPECTATION_CONFLICT", "recency expectation revision changed; reload before updating")
Functions ¶
func NewSuccessProducer ¶
func NewSuccessProducer(repo SuccessRepository, next notificationsvc.CandidateProducer) notificationsvc.CandidateProducer
NewSuccessProducer retains compact success evidence in the runtime's existing run/checkpoint/candidate transaction, before ordinary run retention can erase it.
Types ¶
type Expectation ¶
type Expectation = runrecency.Expectation
type Inspection ¶
type Inspection struct {
Expectation runrecency.Expectation
Episodes []runrecency.EpisodeEvidence
HasMoreEpisodes bool
EvaluatedAt time.Time
Deadline *time.Time
Outcome model.RunRecencyOutcome
}
type Notifications ¶
type Notifications interface {
CreateCandidate(context.Context, notificationsvc.CreateCandidateParams) (*notificationsvc.CreateCandidateResult, error)
ResolveNotification(context.Context, notificationsvc.AlertManagementPrincipal, slug.Slug, slug.Slug) (*model.NotificationListItem, error)
}
type Repository ¶
type Repository interface {
Inspect(context.Context, postgres.DBTX, runrecency.Scope) (runrecency.Expectation, error)
InspectEpisodes(context.Context, postgres.DBTX, runrecency.Scope) ([]runrecency.EpisodeEvidence, error)
FindCurrent(context.Context, postgres.DBTX, runrecency.Scope) (runrecency.Expectation, error)
LockScope(context.Context, postgres.DBTX, runrecency.Scope) error
FindLatest(context.Context, postgres.DBTX, runrecency.Scope) (*runrecency.Expectation, error)
CreateExpectation(context.Context, postgres.DBTX, runrecency.Expectation) (*runrecency.Expectation, error)
ListForSystem(context.Context, postgres.DBTX) ([]runrecency.Expectation, error)
ActiveEpisodes(context.Context, postgres.DBTX, runrecency.Expectation) ([]runrecency.Episode, error)
CreateEpisode(context.Context, postgres.DBTX, runrecency.Expectation, slug.Slug, time.Time, time.Time) error
ResolveEpisode(context.Context, postgres.DBTX, runrecency.Expectation, runrecency.Episode, string, time.Time) error
}
type Scope ¶
type Scope = runrecency.Scope
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(txm postgres.TransactionManager, repo Repository, notifications Notifications) *Service
func (*Service) Inspect ¶
func (s *Service) Inspect(ctx context.Context, scope runrecency.Scope, now time.Time) (*Inspection, error)
Inspect calculates current state without producing notifications.
func (*Service) Update ¶
func (s *Service) Update(ctx context.Context, scope runrecency.Scope, expectedRevision int64, maximumAge time.Duration, enabled bool, now time.Time) (*runrecency.Expectation, error)
Update appends an immutable revision; callers must enforce their normal authorization before this method.
type SuccessRepository ¶
Click to show internal directories.
Click to hide internal directories.