nfs-server reads who holds a seat through the placement client and the seat's state name, not go/delivery (B5e; ADR 0634 §1, §4; issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 15:23:30 +01:00
parent 45f4edbb36
commit 1d20825d69
4 changed files with 16 additions and 7 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ import (
"encoding/json"
"fmt"
"git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings"
"git.novox.be/novox/mesh-sdk/go/delivery"
assignerclient "git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient"
"os"
"path"
"sort"
@@ -51,7 +51,7 @@ type BackupFromBus struct {
// (clause 3). A machine whose backup seat nobody holds, and no readings at all, are errors: never an empty list read as
// "nothing to fear".
func BackupFrom(machine string, keys map[string][]byte, readings []diskreadings.Reading) (string, []string, error) {
holders, err := delivery.HoldersOf(keys, BackupSeat, machine)
holders, err := assignerclient.HoldersOf(keys, BackupSeat, machine)
if err != nil {
return "", nil, err
}
+10 -4
View File
@@ -13,6 +13,7 @@ import (
"context"
"encoding/json"
"fmt"
mesh "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
"os"
"os/signal"
"sort"
@@ -24,7 +25,6 @@ import (
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient"
"git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/delivery"
"git.novox.be/novox/mesh-sdk/go/views"
)
@@ -51,7 +51,7 @@ func main() {
return
}
m := Here()
seats.Follow(delivery.AssignerModule, delivery.SeatHoldersState, SeatHoldersTool)
seats.Follow(assignerModule, mesh.StateSeatHolders, SeatHoldersTool)
seats.Start(context.Background())
go ShareExports(m)
if err := stdio.Serve("", append(Tools(m), seats.Tools("nfs_server")...)); err != nil {
@@ -124,14 +124,20 @@ func readingsOf(node string) ([]diskreadings.Reading, error) {
}
// SeatHoldersTool is the assigner's read tool of who holds which seat, which the manifest invokes (ADR 0615).
const SeatHoldersTool = delivery.AssignerModule + ".assigner_read_seat_holders"
// assignerModule is the holder of the seat mesh-module-assigner whose seat-holders view this module follows: the one name
// of it here, the same as its manifest's `consumes` and `invokes` carry (the manifest test holds them equal).
const assignerModule = "mesh-delivery-assigner"
const SeatHoldersTool = assignerModule + ".assigner_read_seat_holders"
// seats is the picture of the placement seat's state of who holds which seat: asked of the assigner once and followed by
// its events, never read from its state (ADR 0615).
var seats = &views.Reader{Module: "nfs-server", Findings: meshconditionsclient.FindingWriter{State: stdio.State("findings")}, Acts: meshhandactsclient.Recorder{Ask: stdio.Ask}, Logf: func(f string, a ...any) { fmt.Fprintf(os.Stderr, "nfs-server: "+f+"\n", a...) }}
// seatHolderKeys is the placement seat's state of who holds which seat, every key.
func seatHolderKeys() (map[string][]byte, error) { return seats.Values(delivery.SeatHoldersRead) }
func seatHolderKeys() (map[string][]byte, error) {
return seats.Values(assignerModule + "." + mesh.StateSeatHolders)
}
// TakeWants reads every node's `mounts` state from the bus and writes what is asked of this machine to
// the wants file, for the root process. When the bus does not answer, the last wants stay.
@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings"
mesh "git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner"
"os"
"regexp"
"sort"
@@ -151,7 +152,7 @@ func TestTheManifestCarriesGrantsTheRosterTheWantsAndTheRemovalOrder(t *testing.
if len(full.Reads) != 2 || full.Reads[0] != diskreadings.ReadingsRead || full.Reads[1] != MountsState {
t.Errorf("reads: %v", full.Reads)
}
if len(full.Invokes) != 2 || full.Invokes[0] != SeatHoldersTool || full.Invokes[1] != "seat:mesh-hand-acts.hand-act" || len(full.Consumes) != 1 || full.Consumes[0] != "mesh-delivery-assigner.views.seat-holders" {
if len(full.Invokes) != 2 || full.Invokes[0] != SeatHoldersTool || full.Invokes[1] != "seat:mesh-hand-acts.hand-act" || len(full.Consumes) != 1 || full.Consumes[0] != assignerModule+".views."+mesh.StateSeatHolders {
t.Errorf("invokes %v, consumes %v", full.Invokes, full.Consumes)
}
roster := full.Facts["machines"]
+2
View File
@@ -5,6 +5,8 @@ go 1.26.0
require git.novox.be/novox/mesh-sdk/go v0.1.14-0.20261104174359-05b3e2e1b94f
require (
git.novox.be/novox/mesh-contracts/placement/go/clients/meshmoduleassignerclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/placement/go/seats/meshmoduleassigner v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshconditionsclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/health-and-repair/go/clients/meshhandactsclient v0.0.0-00010101000000-000000000000
git.novox.be/novox/mesh-contracts/go v0.0.0-20261104174344-ae5266e77639 // indirect