Delivery sdk: graph, forms and packagename name the catalog client's and trunk's names, not mesh-sdk's go/delivery; forms holds BuiltArtifact (ADR 0634 §1, §2; issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
+18
-7
@@ -1,7 +1,7 @@
|
||||
// Package forms holds the artifact reference forms the builder writes a done build key in and the assigner holds a want
|
||||
// by (novox/hq ADR 0618 §1-§2, ADR 0624): logic only those two modules of mesh-delivery share, so it is mesh-delivery's
|
||||
// and not mesh-sdk's (ADR 0593 §1, ADR 0608 §5). The build key's fields (delivery.BuilderBuild.Needs,
|
||||
// delivery.BuiltArtifact.References) are the contract, in mesh-sdk.
|
||||
// and not mesh-sdk's (ADR 0593 §1, ADR 0608 §5). The build key's fields (BuilderBuild.Needs,
|
||||
// BuiltArtifact.References) are the builder's, in its package `builds`.
|
||||
package forms
|
||||
|
||||
import (
|
||||
@@ -10,10 +10,21 @@ import (
|
||||
"strings"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
"git.novox.be/novox/mesh-sdk/go/delivery"
|
||||
)
|
||||
|
||||
// artifactStore opens the artifact store's references (delivery.BuiltArtifact).
|
||||
// BuiltArtifact is one artifact of a done build, as the forms read it: its name, kind, digest and the reference that names
|
||||
// where it is, with every form it is named in (References, Reference among them; novox/hq ADR 0618, ADR 0624). A reader
|
||||
// that does not know References reads Reference alone. The builder's build key holds the same fields (its package
|
||||
// `builds`), whose type is this one, since both read the forms and the forms are logic of the sdk alone.
|
||||
type BuiltArtifact struct {
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Digest string `json:"digest"`
|
||||
Reference string `json:"reference,omitempty"`
|
||||
References []string `json:"references,omitempty"`
|
||||
}
|
||||
|
||||
// artifactStore opens the artifact store's references (BuiltArtifact).
|
||||
const artifactStore = "artifact-store://"
|
||||
|
||||
// The artifact reference forms (novox/hq ADR 0605 §9, ADR 0618 §1-§2, ADR 0624): each form a done key's reference may be
|
||||
@@ -55,7 +66,7 @@ type ArtifactForm struct {
|
||||
// ArtifactForms are the forms a builder knows, oldest first.
|
||||
type ArtifactForms []ArtifactForm
|
||||
|
||||
// Current are the forms the builder writes and the assigner knows: the three first forms (delivery.BuiltArtifact's
|
||||
// Current are the forms the builder writes and the assigner knows: the three first forms (BuiltArtifact's
|
||||
// reference by kind), then the registry seat's form of a bundle or an archive.
|
||||
var Current = ArtifactForms{
|
||||
// The registry form precedes the artifact-store form: what a build key kept of an image is recorded without the
|
||||
@@ -105,7 +116,7 @@ func (fs ArtifactForms) Reads(stated []string, form string) bool {
|
||||
|
||||
// Needs are the reader capabilities a done build's artifacts carry (ADR 0618 §1): `form:<name>` of every form any of
|
||||
// its references, single or listed, is written in, sorted. Nil when it names none (no artifact, or no reference).
|
||||
func (fs ArtifactForms) Needs(artifacts []delivery.BuiltArtifact) []string {
|
||||
func (fs ArtifactForms) Needs(artifacts []BuiltArtifact) []string {
|
||||
set := map[string]bool{}
|
||||
for _, a := range artifacts {
|
||||
for _, r := range append([]string{a.Reference}, a.References...) {
|
||||
@@ -206,7 +217,7 @@ func (fs ArtifactForms) Kept(kind string, present, counted map[string][]string)
|
||||
// its first answered in Reference, since a key names where its artifact is (ADR 0498 clause 1). An answered reference
|
||||
// in a form that derives an older one (ArtifactForm.Older) answers that older one too, so the build answers one form and
|
||||
// the key keeps each a counted node reads.
|
||||
func (fs ArtifactForms) Choose(a delivery.BuiltArtifact, answered []string, present, counted map[string][]string) delivery.BuiltArtifact {
|
||||
func (fs ArtifactForms) Choose(a BuiltArtifact, answered []string, present, counted map[string][]string) BuiltArtifact {
|
||||
kept := fs.Kept(a.Kind, present, counted)
|
||||
answered = fs.withOlder(a.Kind, answered)
|
||||
type ref struct {
|
||||
|
||||
Reference in New Issue
Block a user