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 ¶
- Variables
- func NewScheduleCodec() (*liquidproto.Codec[*cronv1.ScheduleSpec], error)
- func NewStatusSnapshotCodec() (*liquidproto.Codec[*cronv1.StatusSnapshot], error)
- func NewTriggerDefinitionCodec() (*liquidproto.Codec[*cronv1.TriggerDefinition], error)
- func OccurrenceToProto(record cron.OccurrenceRecord) (*cronv1.RunSummary, error)
- func ScheduleFromProto(message *cronv1.ScheduleSpec) (cron.Schedule, error)
- func ScheduleToProto(schedule cron.Schedule) (*cronv1.ScheduleSpec, error)
- func StoreSnapshotToProto(snapshot cron.StoreSnapshot, observedAt time.Time) (*cronv1.StatusSnapshot, error)
- func TriggerDefinitionFromProto(message *cronv1.TriggerDefinition) (cron.TriggerDefinition, error)
- func TriggerDefinitionToProto(definition cron.TriggerDefinition) (*cronv1.TriggerDefinition, error)
- func ValidateInvocation(message *cronv1.Invocation) error
- func ValidateRunSummary(message *cronv1.RunSummary) error
- func ValidateSchedule(message *cronv1.ScheduleSpec) error
- func ValidateStatusSnapshot(message *cronv1.StatusSnapshot) error
- func ValidateTriggerDefinition(message *cronv1.TriggerDefinition) error
Constants ¶
This section is empty.
Variables ¶
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 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 NewTriggerDefinitionCodec ¶ added in v0.2.0
func NewTriggerDefinitionCodec() (*liquidproto.Codec[*cronv1.TriggerDefinition], error)
NewTriggerDefinitionCodec returns a validating Liquid Proto codec for portable trigger declarations.
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 TriggerDefinitionFromProto ¶ added in v0.2.0
func TriggerDefinitionFromProto(message *cronv1.TriggerDefinition) (cron.TriggerDefinition, error)
TriggerDefinitionFromProto validates and maps a boundary trigger definition into the domain without introducing a wire-shaped persistence model.
func TriggerDefinitionToProto ¶ added in v0.2.0
func TriggerDefinitionToProto(definition cron.TriggerDefinition) (*cronv1.TriggerDefinition, error)
TriggerDefinitionToProto maps a persistence-neutral domain definition to its portable boundary representation.
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 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.
func ValidateTriggerDefinition ¶ added in v0.2.0
func ValidateTriggerDefinition(message *cronv1.TriggerDefinition) error
ValidateTriggerDefinition completes generated scalar validation with nested schedule and policy semantics.
Types ¶
This section is empty.