H-21: the manifest invokes revision (none-yet) and withheld, and config view-waits-minutes
The long-form invokes entry is read by mesh-sdk's second reader release (09d6070e): packaging's manifest tests pass with it placed and fail before it is joined. Builds: design 47 G §558, §617, §633, §635
This commit is contained in:
@@ -71,6 +71,8 @@ type Waiter struct {
|
||||
Reader Reader
|
||||
Writer Writer
|
||||
Clock Clock
|
||||
// Bound is how long the reader may wait; zero is the default Bound (the manifest's config `view-waits-minutes`, §633).
|
||||
Bound time.Duration
|
||||
// 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.
|
||||
@@ -121,7 +123,7 @@ func (w *Waiter) Changed() {
|
||||
return // an earlier process wrote it and the list is still unread: it stands until the first full read
|
||||
}
|
||||
w.since = w.Clock.Now()
|
||||
w.timer = w.Clock.AfterFunc(Bound, w.expired)
|
||||
w.timer = w.Clock.AfterFunc(w.bound(), w.expired)
|
||||
}
|
||||
|
||||
// Waiting says whether the bound is running or the finding stands, and since when.
|
||||
@@ -172,3 +174,10 @@ func observerOf(fixed string, of func() string) string {
|
||||
}
|
||||
return fixed
|
||||
}
|
||||
|
||||
func (w *Waiter) bound() time.Duration {
|
||||
if w.Bound > 0 {
|
||||
return w.Bound
|
||||
}
|
||||
return Bound
|
||||
}
|
||||
|
||||
@@ -233,9 +233,27 @@ func caseAnEntryNotFoundIsAFindingOfTheFingerprint(t *testing.T) {
|
||||
}
|
||||
|
||||
// ADR 0636 §1, the node's finding of a seat list unread.
|
||||
// §633: the bound is the manifest's `view-waits-minutes` when one is given: a finding at two minutes, none before.
|
||||
func caseAGivenBoundReplacesTheFiveMinutes(t *testing.T) {
|
||||
reader := &fakeReader{st: seatlist.Status{Heard: false, LastError: "no answer"}}
|
||||
clock := &fakeClock{now: time.Date(2026, 11, 5, 12, 0, 0, 0, time.UTC)}
|
||||
findings := &fakeFindings{}
|
||||
w := &Waiter{Node: "ace", Observer: "node-engine", Reader: reader, Writer: findings, Clock: clock, Bound: 2 * time.Minute}
|
||||
w.Changed()
|
||||
clock.advance(2*time.Minute - time.Second)
|
||||
if len(findings.put) != 0 {
|
||||
t.Fatalf("a finding was written before the given bound: %+v", findings.put)
|
||||
}
|
||||
clock.advance(time.Second)
|
||||
if len(findings.put) != 1 {
|
||||
t.Fatalf("no finding at the given bound: %+v", findings.put)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTheSeatListWait(t *testing.T) {
|
||||
for name, run := range map[string]func(*testing.T){
|
||||
"five minutes write one finding and the first full read clears it": caseTheNodeWritesOneFindingAfterFiveMinutesAndClearsItAtTheFirstFullRead,
|
||||
"a given bound replaces the five minutes": caseAGivenBoundReplacesTheFiveMinutes,
|
||||
"a read within the bound writes nothing": caseAReadWithinTheBoundWritesNothing,
|
||||
"a finding that cannot be written is said and tried again": caseAFindingThatCannotBeWrittenIsSaidAndTriedAgain,
|
||||
"a finding of an earlier process is cleared at the first full read": caseAFindingOfAnEarlierProcessIsClearedAtTheFirstFullRead,
|
||||
|
||||
Reference in New Issue
Block a user