mesh-build-go's steps bucket filled to the bus's 64 MiB cap (27,370 keys, none ever removed) and refused the end of a passed check, so the check read failed; mesh-build-node's (17.8 MB) and mesh-build-image's grow the same way. A step's key is per step: its reader reads its end within the step's bound, and a check's verdict is kept by the checker, so two days is ample. The node's pause key lived in the same bucket and would have ended by itself; it moves to a pauses state without an age (mesh-sdk fix/steps-bucket-ages, Puller.PausePut). No node is paused today, so nothing is carried over.
69 lines
2.6 KiB
Go
69 lines
2.6 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
stdio "git.novox.be/novox/mesh-sdk/go"
|
|
"git.novox.be/novox/mesh-sdk/go/buildstep"
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
// **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6; issue 1887 A3image), as mesh-build-go does: the seat
|
|
// node-build-image, at most the node's build capacity at once (its setting `capacity`); a delivery or check ask is a build
|
|
// (fetch, build, or copy of a pinned image), never a check of tests. The tools stay as the hand path (ADR 0525 §8).
|
|
|
|
// Seat is the node seat this module holds.
|
|
const Seat = "node-build-image"
|
|
|
|
func (m *Module) askSteps(steps []StepTool) buildstep.AskSteps {
|
|
byName := map[string]buildstep.StepFunc{}
|
|
for _, s := range steps {
|
|
run := s.Run
|
|
byName[s.Name] = func(ctx context.Context, args map[string]any) (any, error) {
|
|
defer m.holdArg(args)()
|
|
return run(ctx, args)
|
|
}
|
|
}
|
|
return buildstep.AskSteps{
|
|
Fetch: byName["build_image_fetch"], Build: byName["build_image_build"], Copy: byName["build_image_copy"],
|
|
Release: func(ws string) error { return m.spaces().Release(ws) },
|
|
Logf: m.Say,
|
|
}
|
|
}
|
|
|
|
// Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil).
|
|
func (m *Module) Puller(steps []StepTool, source buildstep.AskSource) *buildstep.Puller {
|
|
if source == nil {
|
|
source = buildstep.SeatAsks{Language: delivery.AskImage}
|
|
}
|
|
capacity := m.Capacity
|
|
// The capacity's own change wakes the puller (issue 1887): the runtime's watch of the config value as mesh-config
|
|
// resolved it; the settings file is read only when that watch cannot start. A test's Capacity is its own.
|
|
var watch func(string, func(stdio.ProvisionChange) error) error
|
|
if capacity == nil {
|
|
capacity = buildstep.NodeCapacity(m.Settings, buildstep.DefaultCapacities, m.Node, m.Say)
|
|
watch = buildstep.WatchConfigServed
|
|
}
|
|
ask := m.askSteps(steps)
|
|
var load func(string) ([]byte, error)
|
|
if m.ReadPauses.Get != nil {
|
|
load = func(key string) ([]byte, error) { return m.ReadPauses.Get(key) }
|
|
}
|
|
return &buildstep.Puller{Source: source, Language: delivery.AskImage, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load,
|
|
Capacity: capacity, WatchConfig: watch, Logf: m.Say,
|
|
Run: func(ctx context.Context, a delivery.StepAsk) (any, error) {
|
|
if err := m.Check(ctx); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := m.room(); err != nil {
|
|
return nil, err
|
|
}
|
|
return buildstep.RunAsk(ctx, ask, a)
|
|
}}
|
|
}
|
|
|
|
// SeatTools are the seat's verbs on this node (ADR 0525 §10).
|
|
func (m *Module) SeatTools(p *buildstep.Puller) []stdio.Tool {
|
|
return buildstep.SeatTools(Seat, "image", p)
|
|
}
|