Prepare verified laboratory 7 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 20afc2c790
commit eb1b5c7b84
677 changed files with 208256 additions and 64 deletions
@@ -0,0 +1,29 @@
// Package lifecycle connects an explicitly supplied health monitor to composition cancellation.
package lifecycle
import (
"context"
"errors"
)
type Ports struct {
Watch func(context.Context) error
Stop func()
Report func()
}
type Runner struct{ ports Ports }
var ErrConfiguration = errors.New("invalid lifecycle configuration")
func New(p Ports) (*Runner, error) {
if p.Watch == nil || p.Stop == nil || p.Report == nil {
return nil, ErrConfiguration
}
return &Runner{p}, nil
}
func (r *Runner) Run(ctx context.Context) {
if e := r.ports.Watch(ctx); e != nil && ctx.Err() == nil {
r.ports.Report()
r.ports.Stop()
}
}