contract

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package contract maps the cron domain model to validated Liquid Proto messages at HTTP and messaging boundaries. PostgreSQL persistence lives in the sibling postgres package and never stores these wire representations.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("cron contract: invalid message")

ErrInvalid identifies a cron boundary message that fails either a generated Liquid scalar refinement or the semantic checks spanning nested fields.

Functions

func JobDefinitionFromProto

func JobDefinitionFromProto(message *cronv1.JobDefinition) (cron.JobDefinition, error)

JobDefinitionFromProto validates and maps a boundary job definition into the domain without introducing a wire-shaped persistence model.

func JobDefinitionToProto

func JobDefinitionToProto(definition cron.JobDefinition) (*cronv1.JobDefinition, error)

JobDefinitionToProto maps a persistence-neutral domain definition to its portable boundary representation.

func NewJobDefinitionCodec

func NewJobDefinitionCodec() (*liquidproto.Codec[*cronv1.JobDefinition], error)

NewJobDefinitionCodec returns a validating Liquid Proto codec for portable desired job definitions.

func NewScheduleCodec

func NewScheduleCodec() (*liquidproto.Codec[*cronv1.ScheduleSpec], error)

NewScheduleCodec returns a deterministic, validating codec suitable for a message bus or cache boundary. Its wire bytes are not a database format.

func NewStatusSnapshotCodec

func NewStatusSnapshotCodec() (*liquidproto.Codec[*cronv1.StatusSnapshot], error)

NewStatusSnapshotCodec returns a validating Liquid Proto codec for read-only runtime status snapshots.

func OccurrenceToProto

func OccurrenceToProto(record cron.OccurrenceRecord) (*cronv1.RunSummary, error)

OccurrenceToProto maps one durable execution record to a status boundary.

func ScheduleFromProto

func ScheduleFromProto(message *cronv1.ScheduleSpec) (cron.Schedule, error)

ScheduleFromProto validates and maps a boundary message into the domain model without allowing protobuf types to leak into persistence.

func ScheduleToProto

func ScheduleToProto(schedule cron.Schedule) (*cronv1.ScheduleSpec, error)

ScheduleToProto projects an immutable domain schedule into its portable boundary representation.

func StoreSnapshotToProto

func StoreSnapshotToProto(snapshot cron.StoreSnapshot, observedAt time.Time) (*cronv1.StatusSnapshot, error)

StoreSnapshotToProto builds a stable, read-only boundary projection. It derives active counts and the latest run rather than treating protobuf as scheduler state.

func ValidateInvocation

func ValidateInvocation(message *cronv1.Invocation) error

ValidateInvocation validates a handler invocation boundary. A standalone invocation always represents an actual attempt, so attempt must be nonzero.

func ValidateJobDefinition

func ValidateJobDefinition(message *cronv1.JobDefinition) error

ValidateJobDefinition completes generated scalar validation with nested schedule and policy semantics.

func ValidateRunSummary

func ValidateRunSummary(message *cronv1.RunSummary) error

ValidateRunSummary applies generated refinements and state-dependent timestamp, attempt, error, and skip semantics.

func ValidateSchedule

func ValidateSchedule(message *cronv1.ScheduleSpec) error

ValidateSchedule applies generated Liquid refinements and the complete nested schedule contract.

func ValidateStatusSnapshot

func ValidateStatusSnapshot(message *cronv1.StatusSnapshot) error

ValidateStatusSnapshot validates a complete read-only status projection.

Types

This section is empty.

Jump to

Keyboard shortcuts

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