runrecencysvc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

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
	UnavailableReason *string
}

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) Evaluate

func (s *Service) Evaluate(ctx context.Context, now time.Time) error

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

type SuccessRepository interface {
	RecordSuccess(context.Context, postgres.DBTX, slug.Slug, slug.Slug, slug.Slug, slug.Slug) error
}

type Window

type Window struct {
	EnabledAt  time.Time
	DeployedAt time.Time
	MaximumAge time.Duration
}

Window is the immutable expectation and deployment snapshot for an evaluation.

func (Window) Breached

func (w Window) Breached(now time.Time, lastSuccess *time.Time) bool

func (Window) Deadline

func (w Window) Deadline(lastSuccess *time.Time) time.Time

Deadline gives a new expectation or deployment a full window. Callers supply only durable successes qualified against this exact deployment.

Jump to

Keyboard shortcuts

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