Keep builds on the bus under their module, so no lookup reads the bucket whole (issue 1121, ADR 0427)
mesh/merge-gate head c79591531575 merged into trunk aa02e7bf4e78 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head c79591531575 merged into trunk aa02e7bf4e78 — pass: its merge-check.sh passed
mesh/delivery delivered
mesh/merge-gate head c79591531575 merged into trunk aa02e7bf4e78 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head c79591531575 merged into trunk aa02e7bf4e78 — pass: its merge-check.sh passed
mesh/delivery delivered
Milestone 5 moved 8,599 build records onto the bus under bare build ids, each carrying its module's whole manifest. Every build lookup then read the whole bucket, and a delivery plan's send did that per module per machine while it held the plans and the machine's declaration: the send of build-agent never finished, and every other act and the status waited behind it. Builds now live under <module>.build.<id> (requests under req.<id>, id.<id> names a build's module), with pointer keys newest, worked, held, commit.<sha> and source.<reuse key> that move only to a newer build and are read as hints, repaired when wrong. Manifests are kept once in the same bucket under manifest.sha256-<hex>, so no grant the running bus lacks is needed. The old keys are laid out once at start, idempotently, and left unread. The calls a plan look makes on the silent clocks while it holds the plans are bounded, since the vendored kv.Keys ignores its context.
This commit is contained in:
@@ -3,6 +3,8 @@ package inventory
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/novox/mesh-controller/internal/chain"
|
||||
)
|
||||
|
||||
// A build whose source is unchanged is never a move (novox/hq issue 280).
|
||||
@@ -26,6 +28,7 @@ type sourceRow struct {
|
||||
id, commit, fingerprint string
|
||||
made []byte
|
||||
manifest []byte
|
||||
manifestDigest string
|
||||
failedGate bool
|
||||
}
|
||||
|
||||
@@ -97,6 +100,15 @@ func (i *Inventory) StandingBuild(ctx context.Context, module, build string) (st
|
||||
for k, b := range builds {
|
||||
if b.id == build {
|
||||
s := builds[standing(builds, k)]
|
||||
if len(s.manifest) == 0 && s.manifestDigest != "" {
|
||||
// The manifest is kept apart from the record (issue 1121): one Get.
|
||||
c, on, err := i.ChainReads(ctx, KindBuilds)
|
||||
if err != nil || !on {
|
||||
return "", nil, err
|
||||
}
|
||||
raw, err := manifestOfRecord(ctx, c, chain.Build{ID: s.id, ManifestDigest: s.manifestDigest})
|
||||
return s.id, raw, err
|
||||
}
|
||||
return s.id, s.manifest, nil
|
||||
}
|
||||
}
|
||||
@@ -106,6 +118,12 @@ func (i *Inventory) StandingBuild(ctx context.Context, module, build string) (st
|
||||
// SourceFingerprints is, per module, per commit, the source fingerprint of the newest successful build
|
||||
// from it that has one: module → commit → fingerprint. A commit whose builds carry none is absent.
|
||||
func (i *Inventory) SourceFingerprints(ctx context.Context) (map[string]map[string]string, error) {
|
||||
if c, on, err := i.ChainReads(ctx, KindBuilds); err != nil {
|
||||
return nil, err
|
||||
} else if on {
|
||||
// Read from the commit pointers, which carry each commit's source fingerprint: no record is read (issue 1121).
|
||||
return i.chainSourceFingerprints(ctx, c)
|
||||
}
|
||||
all, _, err := i.sourceRows(ctx, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -129,6 +147,12 @@ func (i *Inventory) SourceFingerprints(ctx context.Context) (map[string]map[stri
|
||||
|
||||
// BuildSourceFingerprints is SourceFingerprints for one module: commit → fingerprint.
|
||||
func (i *Inventory) BuildSourceFingerprints(ctx context.Context, module string) (map[string]string, error) {
|
||||
if c, on, err := i.ChainReads(ctx, KindBuilds); err != nil {
|
||||
return nil, err
|
||||
} else if on {
|
||||
// This module's commit pointers only (issue 1121).
|
||||
return i.chainBuildSourceFingerprints(ctx, c, module)
|
||||
}
|
||||
all, err := i.SourceFingerprints(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -142,6 +166,11 @@ func (i *Inventory) BuildSourceFingerprints(ctx context.Context, module string)
|
||||
// heldMade is, per module, what the build standing for its newest successful build made — what Held
|
||||
// answers (novox/hq issue 280).
|
||||
func (i *Inventory) heldMade(ctx context.Context) (map[string][]Artifact, error) {
|
||||
if c, on, err := i.ChainReads(ctx, KindBuilds); err != nil {
|
||||
return nil, err
|
||||
} else if on {
|
||||
return i.chainHeldMade(ctx, c)
|
||||
}
|
||||
all, _, err := i.sourceRows(ctx, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user