Review round 1 of the bus want: a removal keeps the bus server, the have says a server made anew runs the want's fingerprint, the old build is read before the first write, and an unanswered inspect fails the apply rather than replacing the server (ADR 0594 §2, §4)
mesh/delivery-group group feat/774-bus-want rejected: composed together: the checker's verdict at the members' heads (a0ab6ce2e316): novox
mesh/delivery closed: the pull request closed unmerged
mesh/check failed: novox: not composed on novox: nats has not been built for this mesh: server is its "server" artifact… | 2c5f818d1522 on 798d73eb11e9
mesh/delivery-group group feat/774-bus-want rejected: composed together: the checker's verdict at the members' heads (a0ab6ce2e316): novox
mesh/delivery closed: the pull request closed unmerged
mesh/check failed: novox: not composed on novox: nats has not been built for this mesh: server is its "server" artifact… | 2c5f818d1522 on 798d73eb11e9
This commit is contained in:
+16
-1
@@ -59,6 +59,8 @@ type haveState struct {
|
||||
// nodeKeeps is what the node agent keeps as it runs on a want without the warrant's mark (HaveNode.Keeps, novox/hq
|
||||
// ADR 0594 §8), written into its key.
|
||||
nodeKeeps []string
|
||||
// removedWords is, by module in removed, what its removed have says when it is more than that it was removed.
|
||||
removedWords map[string]string
|
||||
// written is the build of each module this node-engine wrote a have key for and that the declaration it applied
|
||||
// still holds; removed is each such module the latest declaration no longer holds, with the build its key last
|
||||
// said, until the key is written once with the phase removed (issue 1369, novox/hq ADR 0408 §4: never deleted).
|
||||
@@ -508,6 +510,9 @@ func (q *Session) writeRemoved(ctx context.Context, b HaveBucket, node string) b
|
||||
}
|
||||
h := delivery.Have{V: delivery.Version, Build: s.removed[module], Phase: delivery.PhaseRemoved,
|
||||
Health: delivery.HealthUnknown, Detail: "the applied declaration no longer holds the module"}
|
||||
if words := s.removedWords[module]; words != "" {
|
||||
h.Detail = words
|
||||
}
|
||||
raw, err := delivery.EncodeHave(h)
|
||||
if err != nil {
|
||||
q.sayHave(fmt.Sprintf("cannot encode %s: %v", key, err))
|
||||
@@ -699,13 +704,23 @@ func (q *Session) NoteUserList(ctx context.Context, module string, w delivery.Us
|
||||
|
||||
// NoteRemoved takes that a module's own resources were removed, and writes its have with the phase removed once (issue
|
||||
// 1369): the key is never deleted.
|
||||
func (q *Session) NoteRemoved(ctx context.Context, module, build string) {
|
||||
//
|
||||
// words, when given, are the removed have's detail (the bus server left as it runs, novox/hq ADR 0594 §2).
|
||||
func (q *Session) NoteRemoved(ctx context.Context, module, build string, words ...string) {
|
||||
q.init()
|
||||
s := &q.haves
|
||||
s.mu.Lock()
|
||||
if s.removed == nil {
|
||||
s.removed = map[string]string{}
|
||||
}
|
||||
if said := strings.Join(words, ""); said != "" {
|
||||
if s.removedWords == nil {
|
||||
s.removedWords = map[string]string{}
|
||||
}
|
||||
s.removedWords[module] = said
|
||||
} else {
|
||||
delete(s.removedWords, module)
|
||||
}
|
||||
if f, ok := s.modules[module]; ok && build == "" {
|
||||
build = f.Build
|
||||
}
|
||||
|
||||
@@ -586,6 +586,12 @@ func TestAnAppliedModulesHaveNamesTheFingerprintAndTheDigestAndFollowsItsHealth(
|
||||
if got := l.have(t, "n1.nats"); got.FP != fp || got.Server != "build-1792674595610176744" {
|
||||
t.Fatalf("the bus's have: %+v", got)
|
||||
}
|
||||
// Its removal leaves the server, and its removed have says so (review of 774, round 1).
|
||||
q.NoteRemoved(context.Background(), "nats", "", "removed, but for nats.server: the bus server stays as it runs")
|
||||
if got := l.have(t, "n1.nats"); got.Phase != delivery.PhaseRemoved || !strings.Contains(got.Detail, "the bus server stays") {
|
||||
t.Fatalf("the bus's removed have: %+v", got)
|
||||
}
|
||||
q.NoteModule(context.Background(), ModuleFact{Module: "nats", FP: fp, Composed: dig, Server: "build-1792674595610176744"})
|
||||
q.NoteComposes(context.Background(), delivery.ComposesOwn, "it composes its own", delivery.KeepsBusServer)
|
||||
if n, err := delivery.DecodeHaveNode(l.kv["n1.node"].value); err != nil || !slices.Equal(n.Keeps, []string{delivery.KeepsBusServer}) ||
|
||||
n.Composes != delivery.ComposesOwn {
|
||||
|
||||
Reference in New Issue
Block a user