distribution serves name-of: the reference it keeps an upstream copy under
The node-engine composes an upstream artifact's image from the holder's own name for the copy; distribution owns that naming (ParseSource, Source.Name), so it answers it on the image seat rather than another module repeating the rule. Builds: design 47 H2 H-A-513 second addendum
This commit is contained in:
@@ -34,7 +34,7 @@ func jsonFields(v any) map[string]bool {
|
||||
func TestTheVerbsSpeakTheSeatsContract(t *testing.T) {
|
||||
inputs := map[string]any{reg.VerbPublish: reg.PublishInput{}, reg.VerbPublishPart: reg.PublishPartInput{},
|
||||
reg.VerbVersions: reg.VersionsInput{}, reg.VerbRemove: reg.RemoveInput{}, reg.VerbHold: reg.HoldInput{},
|
||||
reg.VerbRelease: reg.ReleaseInput{}, reg.VerbMirror: reg.MirrorInput{}, reg.VerbTags: reg.TagsInput{}}
|
||||
reg.VerbRelease: reg.ReleaseInput{}, reg.VerbMirror: reg.MirrorInput{}, reg.VerbNameOf: reg.NameOfInput{}, reg.VerbTags: reg.TagsInput{}}
|
||||
seen := 0
|
||||
for _, tool := range tools(&holder.Verbs{}, kept[holder.Window]{}, nil) {
|
||||
seat, verb, ok := strings.Cut(tool.Name, ".")
|
||||
@@ -51,8 +51,8 @@ func TestTheVerbsSpeakTheSeatsContract(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if seen != 14 {
|
||||
t.Errorf("%d seat verbs served, want 14 (8 on the image seat, 6 on the artifact seat)", seen)
|
||||
if seen != 15 {
|
||||
t.Errorf("%d seat verbs served, want 15 (9 on the image seat, 6 on the artifact seat)", seen)
|
||||
}
|
||||
for event, want := range map[string]any{holder.EventPublished: ®.Outcome{}, holder.EventKept: ®.KeptEvent{}, holder.EventHeld: ®.Hold{}, holder.EventReleased: ®.Hold{}} {
|
||||
b, _ := json.Marshal(eventBody(event, holder.Event{Name: "m/a", Kind: holder.KindArchive, Digest: "sha256:aa", Holder: holder.Self, By: "x.artifact-store-tools"}))
|
||||
|
||||
@@ -364,6 +364,19 @@ func tools(v *holder.Verbs, windows kept[holder.Window], taken *asks) []stdio.To
|
||||
}
|
||||
return reg.MirrorAnswer{Digest: in.Digest, Reference: ref}, nil
|
||||
}},
|
||||
stdio.Tool{Name: holder.ImageSeat + "." + holder.VerbNameOf, Description: "The reference an outside image, as a manifest's from names it pinned by its digest, is kept under in the store (upstream/<host>/<path>@<digest> in the seat's form), the one mirror answers; reads only, asks no copy, refuses a from with no digest.",
|
||||
Input: obj(map[string]any{"from": s("<name>[:<tag>]@sha256:…")}, "from"),
|
||||
Run: func(args map[string]any) (any, error) {
|
||||
in, err := arg[reg.NameOfInput](args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ref, err := v.NameOf(holder.ImageSeat, in.From)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return reg.NameOfAnswer{Reference: ref}, nil
|
||||
}},
|
||||
stdio.Tool{Name: "registry_health", Description: "distribution's health check, run by the runtime each minute: versions of each seat asked through the store's read side (the program's port 5100); fails naming the program when it does not answer.",
|
||||
Input: obj(map[string]any{}),
|
||||
Run: func(map[string]any) (any, error) {
|
||||
|
||||
Reference in New Issue
Block a user