Go: read the controller's seats and data answers in the SDK, not in each module #13

Open
opened 2026-10-08 19:39:29 +00:00 by mesh-admin · 0 comments
Contributor

Two catalogue modules parse the same controller answers with their own copies:

  • mesh-catalog modules/mounts/cmd/mounts/data.go (DataFrom) reads seat:mesh-controller.data.
  • mesh-catalog modules/nfs-server/cmd/nfs-server/backup.go (BackupFrom) reads seat:mesh-controller.seats and seat:mesh-controller.data, and finds the holder of a node seat and that module's data paths.

What the answers look like (both modules read every form):

  • {"answer": {"data": [{"machine","module","item","path","class", …}]}, "ok": true, "output": "<same as text>"}, or the bare object;
  • {"answer": {"seats": [{"seat", "holders": [{"module","node"}]}]}}.

Both copies follow one rule: an answer with no data list is an error, never an empty list read as "nothing there".

The rule (hq working-on-the-mesh): code shared between modules belongs in mesh-sdk. The move was too large to do in mesh-catalog #142, because it means a new SDK API, a go/v0.1.x tag, and both modules moving to it. So this issue records it, raised by the review of #142 (hq ADR 0263).

Ask: typed readers in mesh-sdk/go, for example stdio.DataOf(raw) ([]DataItem, error) and stdio.HoldersOf(raw, seat) ([]Holder, error), tested against the controller's real answer shapes. Then both modules move to them.

Two catalogue modules parse the same controller answers with their own copies: - `mesh-catalog modules/mounts/cmd/mounts/data.go` (`DataFrom`) reads `seat:mesh-controller.data`. - `mesh-catalog modules/nfs-server/cmd/nfs-server/backup.go` (`BackupFrom`) reads `seat:mesh-controller.seats` and `seat:mesh-controller.data`, and finds the holder of a node seat and that module's data paths. What the answers look like (both modules read every form): - `{"answer": {"data": [{"machine","module","item","path","class", …}]}, "ok": true, "output": "<same as text>"}`, or the bare object; - `{"answer": {"seats": [{"seat", "holders": [{"module","node"}]}]}}`. Both copies follow one rule: an answer with no data list is an error, never an empty list read as "nothing there". The rule (hq working-on-the-mesh): code shared between modules belongs in mesh-sdk. The move was too large to do in mesh-catalog #142, because it means a new SDK API, a `go/v0.1.x` tag, and both modules moving to it. So this issue records it, raised by the review of #142 (hq ADR 0263). Ask: typed readers in `mesh-sdk/go`, for example `stdio.DataOf(raw) ([]DataItem, error)` and `stdio.HoldersOf(raw, seat) ([]Holder, error)`, tested against the controller's real answer shapes. Then both modules move to them.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: novox/mesh-sdk#13