Files
mesh-host/internal/seatwait/restorepoint.go
T
jschoubben e7177db3cc H-A-178: key restore-point-missing by module and node; test the placements read
Findings are keyed by scope, id and kind across the mesh, so the module
alone as the id let two machines clear each other's restore-point-missing:
its id is now <module>.<node>, as a held module's is. Before the watch of
the assignments has caught up the point is asked as before and a missing
answer holds the move (H-A-178, built in d217056c); the composer's Watch
test now shows RecoveryPlaced answers read only once the assignments are
caught up.

Builds: design 47 H §456, H-A-177, H-A-178
2026-11-20 19:03:01 +01:00

36 lines
2.2 KiB
Go

package seatwait
import (
"context"
"fmt"
"time"
condseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
)
// RestorePointMissingKind is the finding the node-engine writes when it moves a module across a form change without its restore
// point, because the assigner's placements name no holder of the seat mesh-recovery anywhere on the mesh (design 47 H, H-A-177,
// H §456): a warning, scope the machine, its id `<module>.<node>` (H-A-178), as a held module's is. It clears at the module's
// next take-in with a point.
const RestorePointMissingKind = "restore-point-missing"
// RestorePointMissingID is the finding's id for a module on a node: findings are keyed by scope, id and kind across the mesh, so
// two machines never clear each other's (H-A-178).
func RestorePointMissingID(module, node string) string { return module + "." + node }
// SayRestorePointMissing writes the finding for module when missing, with the words naming what moved without a point, and clears
// it when no longer: a take-in of the module took its point. A write or a clear that fails is returned for the caller to say.
func SayRestorePointMissing(ctx context.Context, w Writer, node, observer, module, words string, missing bool, now func() time.Time) error {
id := RestorePointMissingID(module, node)
if !missing {
return w.Clear(ctx, scopeMachine, id, RestorePointMissingKind, "a take-in of the module took its restore point")
}
return w.Write(ctx, condseat.Finding{Observer: observer, Kind: RestorePointMissingKind, Scope: scopeMachine, ID: id,
Severity: condseat.FindingSeverityWarning, Source: RestorePointMissingKind,
Subject: condseat.Subject{Scope: scopeMachine, ID: id, Machine: node},
Summary: fmt.Sprintf("%s moved on %s without its restore point: %s", module, node, words),
Headline: fmt.Sprintf("%s moved without a restore point on %s", module, node),
Explanation: "No holder of the seat mesh-recovery is placed on the mesh, so the node-engine moved the module across a change of its kept data's form without taking a restore point first: that move cannot be reverted to the data as it was. The finding clears at the module's next take-in that takes its point.",
At: now()})
}