Files
mesh-host/internal/seatwait/restorepoint.go
T
jschoubben d217056cf7 H-A-177: move a data module without its restore point where no recovery holder is placed
The node-engine held every data-holding module's take-in for good: it asked
the seat mesh-recovery for the restore point, and nothing answers because
no holder of the seat is placed on the mesh (H §456). It now asks only where
the assigner's placements it holds name a holder (and while they are not
read yet); where none is placed it moves the module without a point and
raises the finding restore-point-missing (warning, scope machine, id the
module), cleared at the module's next take-in that takes its point. A holder
placed that does not answer still holds the move.

Builds: design 47 H §456, H-A-177
2026-11-20 18:56:43 +01:00

30 lines
1.9 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 the module. It clears at the module's next take-in with a point.
const RestorePointMissingKind = "restore-point-missing"
// 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 {
if !missing {
return w.Clear(ctx, scopeMachine, module, RestorePointMissingKind, "a take-in of the module took its restore point")
}
return w.Write(ctx, condseat.Finding{Observer: observer, Kind: RestorePointMissingKind, Scope: scopeMachine, ID: module,
Severity: condseat.FindingSeverityWarning, Source: RestorePointMissingKind,
Subject: condseat.Subject{Scope: scopeMachine, ID: module, 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()})
}