list answers by default the newest 20 short rows (key, call, start, end, outcome, movers' count and the first failed or could-not-run step with its module and why), and the whole pipelines only with full and a limit. show answers one mover's steps when it names one, the steps its filters hold, or else each mover's row, never every step of every mover. The tools program describes each seat verb's tool from its contract, which seatgen now generates a VerbDescription for; runner_cancel reads the whole pipelines with full. The runner seat's form is 6. Builds: design 47 H2 H-A-376, H-A-449, §789
729 lines
28 KiB
Go
729 lines
28 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// Package containerimageregistry is the contract of the seat "container-image-registry", defined whole (seats/container-image-registry/seat.json): The mesh's container images, in the one artifact store: the OCI distribution protocol's read side, an image's tags and mirroring an outside image.
|
|
package containerimageregistry
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
)
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "container-image-registry"
|
|
|
|
// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780):
|
|
// a reader of a value of another form says "form N, this reader knows M".
|
|
const Form = 1
|
|
|
|
// FormRegistry is the form of what the part registry adds.
|
|
const FormRegistry = 1
|
|
|
|
// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition
|
|
// whose fields changed while its forms did not (design 47 H2 §780).
|
|
const (
|
|
generatedForms = "1 registry:1"
|
|
generatedFieldsDigest = "Artifact=79361e4ab1cd HeldEvent=b6d4c12500df Hold=c5a97a2f2d5a HoldAnswer=7d536ccb729f HoldsBySeatNameDigestValue=db093998a869 KeptEvent=ec3ef89ef8a7 ListAnswer=ca49dd7f20ee Listed=b9f1d1232e64 MirrorAnswer=0d59df97b53b Outcome=1e66f7bf6725 PublishAnswer=a0df0b922e1e PublishPartAnswer=aebe3c6c89e9 PublishedEvent=ec3ef89ef8a7 RefusedEvent=ec3ef89ef8a7 ReleaseAnswer=d30bd6000a16 ReleasedEvent=b6d4c12500df RemoveAnswer=bccb5a322d69 RemovedEvent=ec3ef89ef8a7 Repository=740e54e0b3b0 TagsAnswer=fe178191458a TagsAnswerTagsItem=eee02e024d64 VersionsAnswer=47e11ca2aea9 WindowsByCallerValue=23d9294dde92 WindowsByCallerValueDroppedItem=d748f0e58825"
|
|
)
|
|
|
|
const (
|
|
VerbPublish = "publish"
|
|
VerbPublishPart = "publish-part"
|
|
VerbVersions = "versions"
|
|
VerbRemove = "remove"
|
|
VerbMirror = "mirror"
|
|
VerbTags = "tags"
|
|
VerbHold = "hold"
|
|
VerbRelease = "release"
|
|
VerbList = "list"
|
|
)
|
|
|
|
const (
|
|
EventPublished = "published"
|
|
EventRefused = "refused"
|
|
EventRemoved = "removed"
|
|
EventKept = "kept"
|
|
EventHeld = "held"
|
|
EventReleased = "released"
|
|
)
|
|
|
|
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
|
func Verbs() []string {
|
|
return []string{VerbPublish, VerbPublishPart, VerbVersions, VerbRemove, VerbMirror, VerbTags, VerbHold, VerbRelease, VerbList}
|
|
}
|
|
|
|
// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or
|
|
// does not describe (design 47 H2 H-A-449).
|
|
func VerbDescription(verb string) string {
|
|
switch verb {
|
|
case VerbPublish:
|
|
return "Open a transfer, naming the artifact and the digest of every part; answers the digests the holder lacks, which the caller then sends by publish-part. A transfer already open answers the parts held, so a cut transfer goes on from there. With no parts and a version, the held digest is published under that version and nothing is stored (the trunk's claim)."
|
|
case VerbPublishPart:
|
|
return "Send one chunk of one part of an open transfer; the last chunk of the last part ends the transfer, and the holder hashes what it received, asks builder_versions, stores it and says published or refused. A chunk's message stays under the bus's largest message (1 MiB), so at most 760 KiB of data, base64."
|
|
case VerbVersions:
|
|
return "The versions the seat holds of one name, newest first: each one's version, tag, digest, kind and when it was published."
|
|
case VerbRemove:
|
|
return "Remove one tagged version; the holder refuses an untagged one but for the retention removal of a bundle, archive or copied base, which the artifact sweep's holder asks; the caller is not judged (design 47 H2 §813 (7)). Every removal emits removed with its reason. A tagged version the store cannot remove alone, because another tag names its digest, stays whole, its tag and bytes kept: the answer says kept with the reason shared-digest and the tags still naming the digest, removed false, and kept is emitted, never removed; the caller ends there without a retry."
|
|
case VerbMirror:
|
|
return "Copy an outside image into the store by its pinned digest; emits published or refused."
|
|
case VerbTags:
|
|
return "The tags of one image and the digest each names."
|
|
case VerbHold:
|
|
return "Keep one untagged bundle, archive or copied base from removal by retention, as the artifact sweep's rules keep it (ADR 0617 §2); never an image of the holder's own. Emits held."
|
|
case VerbRelease:
|
|
return "Let a hold go; emits released. A release of what is not held answers released false and emits nothing, never an error: the outcome asked holds already. By hand only through the holder's own tool, the operator's session as the proved caller, recorded as a hand act."
|
|
case VerbList:
|
|
return "What the store holds of one repository, or of every repository the seat holds when none is named: every image manifest and index, each with its digest, whether it is an index (and the manifests an index names), the tags naming it, its size and whether it is held. Read from the store itself, so a manifest no tag names is listed too; it reads only (ADR 0632 §3)."
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// Events is every event published on the seat's subject: a new copy each call.
|
|
func Events() []string {
|
|
return []string{EventPublished, EventRefused, EventRemoved, EventKept, EventHeld, EventReleased}
|
|
}
|
|
|
|
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
|
|
const (
|
|
Family = "container-image-registry.events"
|
|
FamilyMaxAgeDays = 7
|
|
)
|
|
|
|
// SubjectPublished is where published is published.
|
|
const SubjectPublished = "mesh.seat.container-image-registry.event.published"
|
|
|
|
// SubjectRefused is where refused is published.
|
|
const SubjectRefused = "mesh.seat.container-image-registry.event.refused"
|
|
|
|
// SubjectRemoved is where removed is published.
|
|
const SubjectRemoved = "mesh.seat.container-image-registry.event.removed"
|
|
|
|
// SubjectKept is where kept is published.
|
|
const SubjectKept = "mesh.seat.container-image-registry.event.kept"
|
|
|
|
// SubjectHeld is where held is published.
|
|
const SubjectHeld = "mesh.seat.container-image-registry.event.held"
|
|
|
|
// SubjectReleased is where released is published.
|
|
const SubjectReleased = "mesh.seat.container-image-registry.event.released"
|
|
|
|
const (
|
|
StateHolds = "holds"
|
|
StateWindows = "windows"
|
|
)
|
|
|
|
// HoldsBySeatNameDigestKey is the key of one value of the state holds under the form "<seat>.<name>.<digest>".
|
|
func HoldsBySeatNameDigestKey(seat, name, digest string) string {
|
|
return seat + "." + name + "." + digest
|
|
}
|
|
|
|
// ParseHoldsBySeatNameDigestKey reads the parts of a key of the form "<seat>.<name>.<digest>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseHoldsBySeatNameDigestKey(key string) (string, string, string, bool) {
|
|
rest := key
|
|
v0, after0, found0 := strings.Cut(rest, ".")
|
|
if !found0 || v0 == "" {
|
|
return "", "", "", false
|
|
}
|
|
rest = after0
|
|
v2, after2, found2 := strings.Cut(rest, ".")
|
|
if !found2 || v2 == "" {
|
|
return "", "", "", false
|
|
}
|
|
rest = after2
|
|
if rest == "" {
|
|
return "", "", "", false
|
|
}
|
|
v4 := rest
|
|
rest = ""
|
|
if rest != "" {
|
|
return "", "", "", false
|
|
}
|
|
return v0, v2, v4, true
|
|
}
|
|
|
|
// DecodeHoldsBySeatNameDigestValue reads one value of the state holds under the form "<seat>.<name>.<digest>" as another part wrote it: a field HoldsBySeatNameDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeHoldsBySeatNameDigestValue(raw []byte) (HoldsBySeatNameDigestValue, int, error) {
|
|
var v HoldsBySeatNameDigestValue
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// WindowsByCallerKey is the key of one value of the state windows under the form "<caller>".
|
|
func WindowsByCallerKey(caller string) string { return caller }
|
|
|
|
// ParseWindowsByCallerKey reads the parts of a key of the form "<caller>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseWindowsByCallerKey(key string) (string, bool) {
|
|
rest := key
|
|
if rest == "" {
|
|
return "", false
|
|
}
|
|
v0 := rest
|
|
rest = ""
|
|
if rest != "" {
|
|
return "", false
|
|
}
|
|
return v0, true
|
|
}
|
|
|
|
// DecodeWindowsByCallerValue reads one value of the state windows under the form "<caller>" as another part wrote it: a field WindowsByCallerValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeWindowsByCallerValue(raw []byte) (WindowsByCallerValue, int, error) {
|
|
var v WindowsByCallerValue
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// Artifact is one published thing, as every registry event and answer names it.
|
|
type Artifact struct {
|
|
// the source commit it was built from
|
|
Commit string `json:"commit,omitempty"`
|
|
// its digest, sha256:<hex> (a Go package's h1: hash beside it in the version's record)
|
|
Digest string `json:"digest"`
|
|
// the build's fingerprint
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
// what it is
|
|
Kind string `json:"kind"`
|
|
// the package's, image's, bundle's or archive's name; a package's is its name in its own language (design 32): a Go package's the go.mod module path (git.novox.be/novox/mesh-sdk/go), an npm package's package.json's name (@novox/mesh-sdk)
|
|
Name string `json:"name"`
|
|
// the tag it carries, for a tagged version
|
|
Tag string `json:"tag,omitempty"`
|
|
// the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone
|
|
Version string `json:"version,omitempty"`
|
|
}
|
|
|
|
// The values of Artifact's kind.
|
|
const (
|
|
ArtifactKindPackage = "package"
|
|
ArtifactKindImage = "image"
|
|
ArtifactKindBundle = "bundle"
|
|
ArtifactKindArchive = "archive"
|
|
ArtifactKindUpstream = "upstream"
|
|
)
|
|
|
|
// Hold is the body of held and released.
|
|
type Hold struct {
|
|
// when, RFC 3339
|
|
At string `json:"at,omitempty"`
|
|
// the caller the holder proved
|
|
By string `json:"by,omitempty"`
|
|
// the digest
|
|
Digest string `json:"digest"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the module holding the seat
|
|
Holder string `json:"holder"`
|
|
// the name
|
|
Name string `json:"name"`
|
|
// why
|
|
Reason string `json:"reason,omitempty"`
|
|
}
|
|
|
|
// Listed is a type of the contract.
|
|
type Listed struct {
|
|
// for a manifest keeping one bundle or archive, the digest of that blob: what a reference names it by
|
|
Artifact string `json:"artifact,omitempty"`
|
|
// the manifest's digest, sha256:<hex>
|
|
Digest string `json:"digest"`
|
|
// a hold keeps it from retention
|
|
Held bool `json:"held"`
|
|
// it is an index, naming a manifest per platform
|
|
Index bool `json:"index"`
|
|
// for an index, the digests of the manifests it names
|
|
Platforms []string `json:"platforms,omitempty"`
|
|
// its bytes: its own content and every blob it names
|
|
Size int64 `json:"size"`
|
|
// the tags naming it, none for an untagged one
|
|
Tags []string `json:"tags,omitempty"`
|
|
}
|
|
|
|
// Outcome is the body of published, refused and removed.
|
|
type Outcome struct {
|
|
// the source commit it was built from
|
|
Commit string `json:"commit,omitempty"`
|
|
// its digest, sha256:<hex> (a Go package's h1: hash beside it in the version's record)
|
|
Digest string `json:"digest"`
|
|
// the build's fingerprint
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the module holding the seat that said it
|
|
Holder string `json:"holder"`
|
|
// what it is
|
|
Kind string `json:"kind"`
|
|
// the Go module path a Go package is fetched under, equal to name for a Go package (go-package-registry's published); empty for every other kind of artifact
|
|
Module string `json:"module,omitempty"`
|
|
// the package's, image's, bundle's or archive's name; a package's is its name in its own language (design 32): a Go package's the go.mod module path (git.novox.be/novox/mesh-sdk/go), an npm package's package.json's name (@novox/mesh-sdk)
|
|
Name string `json:"name"`
|
|
// why: a refusal's cause, a removal's (retention, tag-gone, by-hand), or why a removal was kept (shared-digest)
|
|
Reason string `json:"reason,omitempty"`
|
|
// the reference the seat answers: <registry>/<module>/<artifact>@sha256:<digest>, or <name>@<version> for a package (ADR 0605 §9)
|
|
Reference string `json:"reference,omitempty"`
|
|
// the tag it carries, for a tagged version
|
|
Tag string `json:"tag,omitempty"`
|
|
// for kept: the other tags still naming its digest
|
|
Tags []string `json:"tags,omitempty"`
|
|
// the transfer it ends, when it ended one
|
|
Transfer string `json:"transfer,omitempty"`
|
|
// the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone
|
|
Version string `json:"version,omitempty"`
|
|
}
|
|
|
|
// The values of Outcome's kind.
|
|
const (
|
|
OutcomeKindPackage = "package"
|
|
OutcomeKindImage = "image"
|
|
OutcomeKindBundle = "bundle"
|
|
OutcomeKindArchive = "archive"
|
|
OutcomeKindUpstream = "upstream"
|
|
)
|
|
|
|
// Part is one part of a transfer.
|
|
type Part struct {
|
|
// the part's digest, sha256:<hex>: an image's layer or config, a package's file, a bundle's blob
|
|
Digest string `json:"digest"`
|
|
// its size in bytes
|
|
Size int64 `json:"size"`
|
|
}
|
|
|
|
// Repository is a type of the contract.
|
|
type Repository struct {
|
|
// each manifest it holds, by digest
|
|
Manifests []Listed `json:"manifests"`
|
|
// the repository
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// PublishInput is what publish takes.
|
|
type PublishInput struct {
|
|
// the source commit it was built from
|
|
Commit string `json:"commit,omitempty"`
|
|
// its digest, sha256:<hex> (a Go package's h1: hash beside it in the version's record)
|
|
Digest string `json:"digest"`
|
|
// the build's fingerprint
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
// what it is
|
|
Kind string `json:"kind"`
|
|
// the package's, image's, bundle's or archive's name; a package's is its name in its own language (design 32): a Go package's the go.mod module path (git.novox.be/novox/mesh-sdk/go), an npm package's package.json's name (@novox/mesh-sdk)
|
|
Name string `json:"name"`
|
|
// every part's digest and size; none when the digest is already held
|
|
Parts []Part `json:"parts,omitempty"`
|
|
// the tag it carries, for a tagged version
|
|
Tag string `json:"tag,omitempty"`
|
|
// the transfer's name, the caller's own; the same name opens the same transfer again
|
|
Transfer string `json:"transfer"`
|
|
// the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone
|
|
Version string `json:"version,omitempty"`
|
|
}
|
|
|
|
// The values of PublishInput's kind.
|
|
const (
|
|
PublishInputKindPackage = "package"
|
|
PublishInputKindImage = "image"
|
|
PublishInputKindBundle = "bundle"
|
|
PublishInputKindArchive = "archive"
|
|
PublishInputKindUpstream = "upstream"
|
|
)
|
|
|
|
// PublishAnswer is what publish answers.
|
|
type PublishAnswer struct {
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the digest is held already: nothing to send; the outcome follows as an event
|
|
Held bool `json:"held,omitempty"`
|
|
// the digests of the parts the holder lacks, to send by publish-part
|
|
Lacks []string `json:"lacks,omitempty"`
|
|
// the transfer
|
|
Transfer string `json:"transfer"`
|
|
}
|
|
|
|
// PublishPartInput is what publish-part takes.
|
|
type PublishPartInput struct {
|
|
// the chunk's bytes, base64 (at most 760 KiB before encoding)
|
|
Data string `json:"data"`
|
|
// this chunk is the part's last
|
|
Last bool `json:"last"`
|
|
// the part's digest
|
|
Part string `json:"part"`
|
|
// the chunk's place in its part, from 0
|
|
Sequence int64 `json:"sequence"`
|
|
// the transfer
|
|
Transfer string `json:"transfer"`
|
|
}
|
|
|
|
// PublishPartAnswer is what publish-part answers.
|
|
type PublishPartAnswer struct {
|
|
// the part is whole and its bytes match its digest
|
|
Complete bool `json:"complete,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the part
|
|
Part string `json:"part"`
|
|
// the chunks of the part held so far
|
|
Received int64 `json:"received,omitempty"`
|
|
// the transfer
|
|
Transfer string `json:"transfer"`
|
|
}
|
|
|
|
// VersionsInput is what versions takes.
|
|
type VersionsInput struct {
|
|
// narrowed to one kind (optional)
|
|
Kind string `json:"kind,omitempty"`
|
|
// the name
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// VersionsAnswer is what versions answers.
|
|
type VersionsAnswer struct {
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the name
|
|
Name string `json:"name"`
|
|
// newest first
|
|
Versions []Artifact `json:"versions"`
|
|
}
|
|
|
|
// RemoveInput is what remove takes.
|
|
type RemoveInput struct {
|
|
// the digest (for a bundle, archive or copied base)
|
|
Digest string `json:"digest,omitempty"`
|
|
// the name
|
|
Name string `json:"name"`
|
|
// why it goes
|
|
Reason string `json:"reason"`
|
|
// the tag (for a tagged version)
|
|
Tag string `json:"tag,omitempty"`
|
|
// the version
|
|
Version string `json:"version,omitempty"`
|
|
}
|
|
|
|
// The values of RemoveInput's reason.
|
|
const (
|
|
RemoveInputReasonTagGone = "tag-gone"
|
|
RemoveInputReasonRetention = "retention"
|
|
)
|
|
|
|
// RemoveAnswer is what remove answers.
|
|
type RemoveAnswer struct {
|
|
Artifact *Artifact `json:"artifact,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// it stays whole, its tag and its bytes: the store cannot remove the tag alone while another tag names its digest (reason, tags)
|
|
Kept bool `json:"kept,omitempty"`
|
|
// why it was kept: shared-digest, another tag names its digest
|
|
Reason string `json:"reason,omitempty"`
|
|
// it is gone
|
|
Removed bool `json:"removed"`
|
|
// the other tags still naming its digest, when kept
|
|
Tags []string `json:"tags,omitempty"`
|
|
}
|
|
|
|
// The values of RemoveAnswer's reason.
|
|
const (
|
|
RemoveAnswerReasonSharedDigest = "shared-digest"
|
|
)
|
|
|
|
// MirrorInput is what mirror takes.
|
|
type MirrorInput struct {
|
|
// its pinned digest, sha256:<hex>
|
|
Digest string `json:"digest"`
|
|
// the name it is kept under
|
|
Name string `json:"name"`
|
|
// the outside image's reference
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
// MirrorAnswer is what mirror answers.
|
|
type MirrorAnswer struct {
|
|
// the digest stored
|
|
Digest string `json:"digest"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the reference the seat answers
|
|
Reference string `json:"reference"`
|
|
}
|
|
|
|
// TagsInput is what tags takes.
|
|
type TagsInput struct {
|
|
// the image
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// TagsAnswerTagsItem is a type of the contract.
|
|
type TagsAnswerTagsItem struct {
|
|
// its digest
|
|
Digest string `json:"digest"`
|
|
// the tag
|
|
Tag string `json:"tag"`
|
|
}
|
|
|
|
// TagsAnswer is what tags answers.
|
|
type TagsAnswer struct {
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the image
|
|
Name string `json:"name"`
|
|
// every tag
|
|
Tags []TagsAnswerTagsItem `json:"tags"`
|
|
}
|
|
|
|
// HoldInput is what hold takes.
|
|
type HoldInput struct {
|
|
// the digest
|
|
Digest string `json:"digest"`
|
|
// the name
|
|
Name string `json:"name"`
|
|
// which of the sweep's rules keeps it
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
// HoldAnswer is what hold answers.
|
|
type HoldAnswer struct {
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// it is held
|
|
Held bool `json:"held"`
|
|
// when the hold began, RFC 3339
|
|
Since string `json:"since,omitempty"`
|
|
}
|
|
|
|
// ReleaseInput is what release takes.
|
|
type ReleaseInput struct {
|
|
// the digest
|
|
Digest string `json:"digest"`
|
|
// the name
|
|
Name string `json:"name"`
|
|
// why it is let go
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
// ReleaseAnswer is what release answers.
|
|
type ReleaseAnswer struct {
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// a hold was let go; false when there was none
|
|
Released bool `json:"released"`
|
|
}
|
|
|
|
// ListInput is what list takes.
|
|
type ListInput struct {
|
|
// the repository, <module>/<artifact>; every repository of the seat when not given
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// ListAnswer is what list answers.
|
|
type ListAnswer struct {
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// each repository named, in order of its name
|
|
Repositories []Repository `json:"repositories"`
|
|
}
|
|
|
|
// PublishedEvent is the body of the event published.
|
|
type PublishedEvent = Outcome
|
|
|
|
// RefusedEvent is the body of the event refused.
|
|
type RefusedEvent = Outcome
|
|
|
|
// RemovedEvent is the body of the event removed.
|
|
type RemovedEvent = Outcome
|
|
|
|
// KeptEvent is the body of the event kept.
|
|
type KeptEvent = Outcome
|
|
|
|
// HeldEvent is the body of the event held.
|
|
type HeldEvent = Hold
|
|
|
|
// ReleasedEvent is the body of the event released.
|
|
type ReleasedEvent = Hold
|
|
|
|
// HoldsBySeatNameDigestValue is one value of the state holds under the key <seat>.<name>.<digest>.
|
|
type HoldsBySeatNameDigestValue struct {
|
|
By string `json:"by"`
|
|
Digest string `json:"digest"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
Kind string `json:"kind"`
|
|
Name string `json:"name"`
|
|
Seat string `json:"seat"`
|
|
// when (RFC 3339 time)
|
|
Since string `json:"since"`
|
|
Why string `json:"why,omitempty"`
|
|
}
|
|
|
|
// WindowsByCallerValueDroppedItem is a type of the contract.
|
|
type WindowsByCallerValueDroppedItem struct {
|
|
// when (RFC 3339 time)
|
|
At string `json:"at,omitempty"`
|
|
By string `json:"by,omitempty"`
|
|
Node string `json:"node"`
|
|
Why string `json:"why,omitempty"`
|
|
}
|
|
|
|
// WindowsByCallerValue is one value of the state windows under the key <caller>.
|
|
type WindowsByCallerValue struct {
|
|
// when it last closed (RFC 3339 time)
|
|
Closed string `json:"closed,omitempty"`
|
|
// retired nodes dropped by hand
|
|
Dropped []WindowsByCallerValueDroppedItem `json:"dropped,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the nodes holding it open
|
|
Holding []string `json:"holding,omitempty"`
|
|
LastHolding []string `json:"last_holding,omitempty"`
|
|
// the caller whose window it is
|
|
Name string `json:"name"`
|
|
Open bool `json:"open,omitempty"`
|
|
// node to when it began to hold
|
|
Since map[string]string `json:"since,omitempty"`
|
|
// of each node holding the window, why it holds it
|
|
Why map[string]string `json:"why,omitempty"`
|
|
}
|
|
|
|
// DecodePublishAnswer reads a PublishAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodePublishAnswer(raw []byte) (PublishAnswer, int, error) {
|
|
var v PublishAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodePublishPartAnswer reads a PublishPartAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodePublishPartAnswer(raw []byte) (PublishPartAnswer, int, error) {
|
|
var v PublishPartAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeVersionsAnswer reads a VersionsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeVersionsAnswer(raw []byte) (VersionsAnswer, int, error) {
|
|
var v VersionsAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeRemoveAnswer reads a RemoveAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeRemoveAnswer(raw []byte) (RemoveAnswer, int, error) {
|
|
var v RemoveAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeMirrorAnswer reads a MirrorAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeMirrorAnswer(raw []byte) (MirrorAnswer, int, error) {
|
|
var v MirrorAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeTagsAnswer reads a TagsAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeTagsAnswer(raw []byte) (TagsAnswer, int, error) {
|
|
var v TagsAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeHoldAnswer reads a HoldAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeHoldAnswer(raw []byte) (HoldAnswer, int, error) {
|
|
var v HoldAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeReleaseAnswer reads a ReleaseAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeReleaseAnswer(raw []byte) (ReleaseAnswer, int, error) {
|
|
var v ReleaseAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeListAnswer reads a ListAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeListAnswer(raw []byte) (ListAnswer, int, error) {
|
|
var v ListAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodePublishedEvent reads a PublishedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodePublishedEvent(raw []byte) (PublishedEvent, int, error) {
|
|
var v PublishedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeRefusedEvent reads a RefusedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeRefusedEvent(raw []byte) (RefusedEvent, int, error) {
|
|
var v RefusedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeRemovedEvent reads a RemovedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeRemovedEvent(raw []byte) (RemovedEvent, int, error) {
|
|
var v RemovedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeKeptEvent reads a KeptEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeKeptEvent(raw []byte) (KeptEvent, int, error) {
|
|
var v KeptEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeHeldEvent reads a HeldEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeHeldEvent(raw []byte) (HeldEvent, int, error) {
|
|
var v HeldEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeReleasedEvent reads a ReleasedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeReleasedEvent(raw []byte) (ReleasedEvent, int, error) {
|
|
var v ReleasedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// formRead is the form a value says on the wire: 1 when it says none, or is no object.
|
|
func formRead(raw []byte) int {
|
|
var f struct {
|
|
Form int `json:"form"`
|
|
}
|
|
if json.Unmarshal(raw, &f) != nil || f.Form < 1 {
|
|
return 1
|
|
}
|
|
return f.Form
|
|
}
|