H-17: the node-engine's own name is read from its applied record or first composing
Discovery, the finding writer and the vault login names read it; no fixed name. Builds: design 47 G §527, §634 (A-149)
This commit is contained in:
@@ -25,7 +25,9 @@ const HeldKind = "module-held"
|
||||
type HeldKeeper struct {
|
||||
Node string
|
||||
Observer string
|
||||
Writer Writer
|
||||
// ObserverOf, when set, answers the observer at each write (see Waiter).
|
||||
ObserverOf func() string
|
||||
Writer Writer
|
||||
// Ctx is the run's context for the writer's acts; nil is the background.
|
||||
Ctx context.Context
|
||||
// Now is the clock; nil is time.Now.
|
||||
@@ -78,7 +80,7 @@ func (k *HeldKeeper) Reconcile(held map[string]string) {
|
||||
continue
|
||||
}
|
||||
id := HeldID(m, k.Node)
|
||||
f := condseat.Finding{Observer: k.Observer, Kind: HeldKind, Scope: scopeModule, ID: id, Severity: condseat.FindingSeverityWarning,
|
||||
f := condseat.Finding{Observer: observerOf(k.Observer, k.ObserverOf), Kind: HeldKind, Scope: scopeModule, ID: id, Severity: condseat.FindingSeverityWarning,
|
||||
Source: HeldKind,
|
||||
Subject: condseat.Subject{Scope: scopeModule, ID: id, Machine: k.Node},
|
||||
Summary: fmt.Sprintf("%s is held on %s: %s", m, k.Node, why),
|
||||
|
||||
@@ -65,9 +65,12 @@ func stands(w Writer, scope, id, kind string) bool {
|
||||
type Waiter struct {
|
||||
Node string
|
||||
Observer string
|
||||
Reader Reader
|
||||
Writer Writer
|
||||
Clock Clock
|
||||
// ObserverOf, when set, answers the observer at each write: the node-engine's own module, which a first start learns
|
||||
// from its first composing (design 47 G §527, §634).
|
||||
ObserverOf func() string
|
||||
Reader Reader
|
||||
Writer Writer
|
||||
Clock Clock
|
||||
// Ctx is the run's context for the writer's acts; nil is the background.
|
||||
Ctx context.Context
|
||||
// Say tells the node's journal; nil says nothing.
|
||||
@@ -143,7 +146,7 @@ func (w *Waiter) expired() {
|
||||
if w.stands() {
|
||||
return
|
||||
}
|
||||
f := condseat.Finding{Observer: w.Observer, Kind: Kind, Scope: scopeMachine, ID: w.Node, Severity: condseat.FindingSeverityWarning,
|
||||
f := condseat.Finding{Observer: observerOf(w.Observer, w.ObserverOf), Kind: Kind, Scope: scopeMachine, ID: w.Node, Severity: condseat.FindingSeverityWarning,
|
||||
Source: Kind, Subject: condseat.Subject{Scope: scopeMachine, ID: w.Node, Machine: w.Node},
|
||||
Summary: fmt.Sprintf("%s has read no complete seat list since %s: %s", w.Node, w.since.UTC().Format(time.RFC3339), st.Health()),
|
||||
Headline: fmt.Sprintf("%s waits for the seat list", w.Node),
|
||||
@@ -161,3 +164,11 @@ func (w *Waiter) say(s string) {
|
||||
w.Say(s)
|
||||
}
|
||||
}
|
||||
|
||||
// observerOf is of() when it is given, else fixed.
|
||||
func observerOf(fixed string, of func() string) string {
|
||||
if of != nil {
|
||||
return of()
|
||||
}
|
||||
return fixed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user