package release import ( "context" "crypto/sha256" "encoding/hex" "encoding/json" "github.com/carlosframework/platform/internal/hostwrite" ) func WithHostWrites(config hostwrite.Config) PassOption { return func(c *passConfig) { c.hostWrites = config } } func releaseIdentity(m *Manifest) (hostwrite.Identity, error) { raw, err := json.Marshal(m) if err != nil { return hostwrite.Identity{}, err } sum := sha256.Sum256(raw) return hostwrite.Identity{Release: "sha256:" + hex.EncodeToString(sum[:])}, nil } func withReleaseWork(ctx context.Context, work hostwrite.Work, id hostwrite.Identity, fn func() error) error { if ctx == nil || work == nil { return hostwrite.ErrUnavailable } return work.With(ctx, id, fn) } // WithSelectedRestarts supplies receivers that retain the original selection // through restart and rollback start. Receivers validate at their final effect; // network waits must not hold the hostguard flock. func WithSelectedRestarts(restart, start hostwrite.Callback) PassOption { return func(c *passConfig) { c.selectedRestart = restart; c.selectedStart = start } }