Builds: design 47 G A-117, §614, A-15, A-95 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
34 lines
1.8 KiB
Go
34 lines
1.8 KiB
Go
package seatwait
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
|
|
condseat "git.novox.be/novox/mesh-contracts/health-and-repair/go/seats/meshconditions"
|
|
"git.novox.be/novox/mesh-sdk/go/keys"
|
|
)
|
|
|
|
// EntryNotFoundKind is the finding a part writes when the catalog half holds no entry of a fingerprint the part holds a want or a
|
|
// running for (design 47 G §614, A-15, A-117): scope module, its id the fingerprint escaped as a name.
|
|
const EntryNotFoundKind = "entry-not-found"
|
|
|
|
// EntryNotFoundID is the finding's id for a fingerprint.
|
|
func EntryNotFoundID(fp string) string { return keys.EscapeName(fp) }
|
|
|
|
// SayEntryNotFound writes the finding for fp when notFound, and clears it when no longer: the entry answered later, or nothing the
|
|
// node holds names the fingerprint any more. A write or a clear that fails is returned for the caller to say.
|
|
func SayEntryNotFound(ctx context.Context, w Writer, node, observer, fp string, notFound bool, now func() time.Time) error {
|
|
id := EntryNotFoundID(fp)
|
|
if !notFound {
|
|
return w.Clear(ctx, scopeModule, id, EntryNotFoundKind, "the entry is answered, or nothing the node holds names its fingerprint")
|
|
}
|
|
return w.Write(ctx, condseat.Finding{Observer: observer, Kind: EntryNotFoundKind, Scope: scopeModule, ID: id,
|
|
Severity: condseat.FindingSeverityWarning, Source: EntryNotFoundKind,
|
|
Subject: condseat.Subject{Scope: scopeModule, ID: observer, Machine: node},
|
|
Summary: fmt.Sprintf("the catalog half holds no entry of the build %s, so %s composes nothing new of it", fp, node),
|
|
Headline: fmt.Sprintf("no entry of the build %s on %s", fp, node),
|
|
Explanation: "A want or a running names this build and the catalog half answered that it holds no entry of it. The finding clears when the entry is answered or nothing the node holds names the build.",
|
|
At: now()})
|
|
}
|