G1, D0: seat readers decode tolerantly and say their form
The seat generator gives every value, event and answer the wire field form (left out while 1) and a tolerant decoder answering the form it read; each contract carries its forms and a digest of its fields, and the compare fails a definition whose fields changed while its form did not. Every delivery seat is regenerated, and the readers take the form. Builds: design 47 H2 §780; H-A-352
This commit is contained in:
@@ -68,7 +68,7 @@ func TestTheAssignersAsksAreTheSeatMeshWantsAsks(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if v, err := meshwants.DecodeAsksByHoldModuleFingerprintValue(raw); err != nil || v.Asking != 2 {
|
||||
if v, _, err := meshwants.DecodeAsksByHoldModuleFingerprintValue(raw); err != nil || v.Asking != 2 {
|
||||
t.Errorf("the ask %s is not the seat's Ask: %+v, %v", raw, v, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func NamesIn(s PackagesState) PackageNames {
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
v, err := meshcatalog.DecodePackagesByPackageSeriesValue(value) // the indexer's value of a series key (mesh-sdk's contract, J4)
|
||||
v, _, err := meshcatalog.DecodePackagesByPackageSeriesValue(value) // the indexer's value of a series key (mesh-sdk's contract, J4)
|
||||
if err != nil || v.Package != built {
|
||||
continue
|
||||
}
|
||||
@@ -56,7 +56,7 @@ func NamedModule(key string, value []byte) (module, name string, ok bool) {
|
||||
if !isSeriesKey(key) {
|
||||
return "", "", false
|
||||
}
|
||||
v, err := meshcatalog.DecodePackagesByPackageSeriesValue(value)
|
||||
v, _, err := meshcatalog.DecodePackagesByPackageSeriesValue(value)
|
||||
if err != nil || v.Name == "" {
|
||||
return "", "", false
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func Carriers(s PackagesState) func(ctx context.Context, name string) ([]Built,
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
v, err := meshcatalog.DecodePackagesByPackageSeriesValue(value)
|
||||
v, _, err := meshcatalog.DecodePackagesByPackageSeriesValue(value)
|
||||
if err != nil || v.Name != name {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -213,10 +213,10 @@ func TestTakeInBodiesAndNoneYetAreTheSeatsTypes(t *testing.T) {
|
||||
}
|
||||
|
||||
// design 47 H-A-48: the indexer stamps no source revision on a module; the take-in's commit names it, so a module value and an
|
||||
// entry's inputs carrying src or fp-src are not the seat's.
|
||||
// entry's inputs carrying src or fp-src are not the seat's: a reader leaves them unread (design 47 H2 §780).
|
||||
func TestNoSourceStamps(t *testing.T) {
|
||||
if _, err := seat.DecodeModulesByModuleValue([]byte(`{"v":1,"repository":"mesh-sdk","commit":"` + hex64("a")[:40] + `","manifest":"` + hex64("b") + `","path":"go","src":41,"fp-src":41}`)); err == nil {
|
||||
t.Error("a module value carrying src and fp-src is read")
|
||||
if v, form, err := seat.DecodeModulesByModuleValue([]byte(`{"v":1,"repository":"mesh-sdk","commit":"` + hex64("a")[:40] + `","manifest":"` + hex64("b") + `","path":"go","src":41,"fp-src":41}`)); err != nil || v.Repository != "mesh-sdk" || form != 1 {
|
||||
t.Errorf("a module value carrying src and fp-src is not read past them: %+v %d %v", v, form, err)
|
||||
}
|
||||
var in seat.EntryInputs
|
||||
dec := json.NewDecoder(strings.NewReader(`{"src":41,"fp-src":41}`))
|
||||
|
||||
@@ -58,7 +58,7 @@ func DecodeSource(data []byte) (seat.SourceByBranchValue, error) {
|
||||
if err := keys.CheckVersion(data); err != nil {
|
||||
return seat.SourceByBranchValue{}, err
|
||||
}
|
||||
s, err := seat.DecodeSourceByBranchValue(data)
|
||||
s, _, err := seat.DecodeSourceByBranchValue(data)
|
||||
if err != nil {
|
||||
return s, fmt.Errorf("meshdeliveryclient: a source does not fit its shape: %w", err)
|
||||
}
|
||||
@@ -80,7 +80,7 @@ func DecodeOwed(data []byte) (seat.OwedByRepositoryNumberHeadActValue, error) {
|
||||
if err := keys.CheckVersion(data); err != nil {
|
||||
return seat.OwedByRepositoryNumberHeadActValue{}, err
|
||||
}
|
||||
o, err := seat.DecodeOwedByRepositoryNumberHeadActValue(data)
|
||||
o, _, err := seat.DecodeOwedByRepositoryNumberHeadActValue(data)
|
||||
if err != nil {
|
||||
return o, fmt.Errorf("meshdeliveryclient: an owed value does not fit its shape: %w", err)
|
||||
}
|
||||
|
||||
@@ -140,7 +140,8 @@ func TestGateValuesRefuseWhatTheirRulesRefuse(t *testing.T) {
|
||||
if _, err := DecodeSource([]byte(`{"v":2,"source":1,"call":"c","heads":{"a":"b"}}`)); !errors.Is(err, keys.ErrUnknownVersion) {
|
||||
t.Errorf("another version: %v", err)
|
||||
}
|
||||
if _, err := DecodeSource([]byte(`{"v":1,"source":1,"call":"c","heads":{"a":"b"},"extra":1}`)); err == nil {
|
||||
t.Error("an unknown field decodes")
|
||||
// design 47 H2 §780: a reader leaves a field it does not know unread.
|
||||
if s, err := DecodeSource([]byte(`{"v":1,"source":1,"call":"0123456789abcdef","heads":{"a":"b"},"extra":1}`)); err != nil || s.Source != 1 {
|
||||
t.Errorf("an unknown field is not read past: %+v %v", s, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ func DecodeWant(data []byte) (Want, error) {
|
||||
if err := keys.CheckVersion(data); err != nil {
|
||||
return Want{}, err
|
||||
}
|
||||
w, err := seat.DecodeWantsByWantNodeModuleValue(data)
|
||||
w, _, err := seat.DecodeWantsByWantNodeModuleValue(data)
|
||||
if err != nil {
|
||||
return Want{}, fmt.Errorf("wants: value does not fit its shape: %w", err)
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func DecodeNodeWant(data []byte) (NodeWant, error) {
|
||||
if err := keys.CheckVersion(data); err != nil {
|
||||
return NodeWant{}, err
|
||||
}
|
||||
w, err := seat.DecodeWantsByWantNodeNodeValue(data)
|
||||
w, _, err := seat.DecodeWantsByWantNodeNodeValue(data)
|
||||
if err != nil {
|
||||
return NodeWant{}, fmt.Errorf("wants: a node's own want does not fit its shape: %w", err)
|
||||
}
|
||||
@@ -298,7 +298,7 @@ func DecodeHeld(data []byte) (Held, error) {
|
||||
if err := keys.CheckVersion(data); err != nil {
|
||||
return Held{}, err
|
||||
}
|
||||
h, err := seat.DecodeWantsByHeldModuleFingerprintValue(data)
|
||||
h, _, err := seat.DecodeWantsByHeldModuleFingerprintValue(data)
|
||||
if err != nil {
|
||||
return Held{}, fmt.Errorf("wants: value does not fit its shape: %w", err)
|
||||
}
|
||||
|
||||
@@ -76,17 +76,18 @@ func TestWantsAreWhatTheEarlierCodecWrote(t *testing.T) {
|
||||
t.Errorf("%s: written", name)
|
||||
}
|
||||
}
|
||||
// design 47 H §750, H-A-37: a want names no digest, rule or newest; the earlier fields are refused.
|
||||
// design 47 H §750, H-A-37: a want names no digest, rule or newest; a reader leaves the earlier fields unread
|
||||
// (design 47 H2 §780).
|
||||
for _, old := range []string{`"composed":"` + c + `"`, `"parts":{"x:image":"` + d + `"}`, `"rule":3`, `"newest":"` + b + `"`, `"kept-on":"n1"`} {
|
||||
if _, err := DecodeWant([]byte(`{"v":1,"fp":"` + a + `",` + old + `}`)); err == nil {
|
||||
t.Errorf("a want naming %s is read", old)
|
||||
if w, err := DecodeWant([]byte(`{"v":1,"fp":"` + a + `",` + old + `}`)); err != nil || w.Fp != a {
|
||||
t.Errorf("a want naming %s is not read past it: %+v %v", old, w, err)
|
||||
}
|
||||
}
|
||||
if _, err := DecodeWant([]byte(`{"fp":"` + a + `","self":true}`)); !errors.Is(err, keys.ErrUnknownVersion) {
|
||||
t.Errorf("no version: %v", err)
|
||||
}
|
||||
if _, err := DecodeWant([]byte(`{"v":1,"fp":"` + a + `","self":true,"extra":1}`)); err == nil {
|
||||
t.Error("an unknown field is read")
|
||||
if w, err := DecodeWant([]byte(`{"v":1,"fp":"` + a + `","self":true,"extra":1}`)); err != nil || !w.Self {
|
||||
t.Errorf("an unknown field is not read past (design 47 H2 §780): %+v %v", w, err)
|
||||
}
|
||||
})
|
||||
t.Run("node want and hold", func(t *testing.T) {
|
||||
@@ -108,8 +109,9 @@ func TestWantsAreWhatTheEarlierCodecWrote(t *testing.T) {
|
||||
t.Errorf("%s: written", name)
|
||||
}
|
||||
}
|
||||
if _, err := DecodeNodeWant([]byte(`{"v":1,"composed":"` + c + `","fp":"` + a + `"}`)); err == nil {
|
||||
t.Error("a fingerprint in a node's own want is read")
|
||||
// design 47 H2 §780: a fingerprint is no field of a node's own want, and a reader leaves it unread.
|
||||
if back, err := DecodeNodeWant([]byte(`{"v":1,"composed":"` + c + `","fp":"` + a + `"}`)); err != nil || back.Composed != c {
|
||||
t.Errorf("a node's own want naming a fingerprint is not read past it: %+v %v", back, err)
|
||||
}
|
||||
raw, err = EncodeHeld(Held{Node: "anchor", Words: "unhealthy"})
|
||||
if err != nil {
|
||||
|
||||
@@ -4,15 +4,27 @@
|
||||
package containerimageregistry
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"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 = "63651a5f06aa41743b7c77ff25bed94a2b3ad6bcc39ac9f15ffcd51ff55a3c9d"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbPublish = "publish"
|
||||
VerbPublishPart = "publish-part"
|
||||
@@ -102,18 +114,13 @@ func ParseHoldsBySeatNameDigestKey(key string) (string, string, string, bool) {
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeHoldsBySeatNameDigestValue reads one value of the state holds under the form "<seat>.<name>.<digest>", refusing a field HoldsBySeatNameDigestValue does not know and any text after the value.
|
||||
func DecodeHoldsBySeatNameDigestValue(raw []byte) (HoldsBySeatNameDigestValue, error) {
|
||||
// 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
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// WindowsByCallerKey is the key of one value of the state windows under the form "<caller>".
|
||||
@@ -133,18 +140,13 @@ func ParseWindowsByCallerKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeWindowsByCallerValue reads one value of the state windows under the form "<caller>", refusing a field WindowsByCallerValue does not know and any text after the value.
|
||||
func DecodeWindowsByCallerValue(raw []byte) (WindowsByCallerValue, error) {
|
||||
// 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
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Artifact is one published thing, as every registry event and answer names it.
|
||||
@@ -182,6 +184,8 @@ type Hold struct {
|
||||
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
|
||||
@@ -216,6 +220,8 @@ type Outcome struct {
|
||||
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
|
||||
@@ -296,6 +302,8 @@ const (
|
||||
|
||||
// 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
|
||||
@@ -322,6 +330,8 @@ type PublishPartInput struct {
|
||||
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
|
||||
@@ -340,6 +350,8 @@ type VersionsInput struct {
|
||||
|
||||
// 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
|
||||
@@ -369,6 +381,8 @@ const (
|
||||
// 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
|
||||
@@ -398,6 +412,8 @@ type MirrorInput struct {
|
||||
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"`
|
||||
}
|
||||
@@ -418,6 +434,8 @@ type TagsAnswerTagsItem struct {
|
||||
|
||||
// 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
|
||||
@@ -436,6 +454,8 @@ type HoldInput struct {
|
||||
|
||||
// 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
|
||||
@@ -454,6 +474,8 @@ type ReleaseInput struct {
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -466,6 +488,8 @@ type ListInput struct {
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -492,9 +516,11 @@ type ReleasedEvent = Hold
|
||||
type HoldsBySeatNameDigestValue struct {
|
||||
By string `json:"by"`
|
||||
Digest string `json:"digest"`
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Seat string `json:"seat"`
|
||||
// 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"`
|
||||
@@ -515,6 +541,8 @@ type WindowsByCallerValue struct {
|
||||
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"`
|
||||
@@ -526,3 +554,149 @@ type WindowsByCallerValue struct {
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,17 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "git"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "76d91e80e3c40c239af4ab4ea133e72f3757b17fbbf98452cb53cbe15f343a57"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbPull = "pull"
|
||||
VerbBranch = "branch"
|
||||
@@ -129,18 +138,13 @@ func ParseFailedStepsByModuleFingerprintStepKey(key string) (string, string, str
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeFailedStepsByModuleFingerprintStepValue reads one value of the state failed-steps under the form "<module>.<fingerprint>.<step>", refusing a field FailedStepsByModuleFingerprintStepValue does not know and any text after the value.
|
||||
func DecodeFailedStepsByModuleFingerprintStepValue(raw []byte) (FailedStepsByModuleFingerprintStepValue, error) {
|
||||
// DecodeFailedStepsByModuleFingerprintStepValue reads one value of the state failed-steps under the form "<module>.<fingerprint>.<step>" as another part wrote it: a field FailedStepsByModuleFingerprintStepValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeFailedStepsByModuleFingerprintStepValue(raw []byte) (FailedStepsByModuleFingerprintStepValue, int, error) {
|
||||
var v FailedStepsByModuleFingerprintStepValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// CallsByCallCallKey is the key of one value of the state calls under the form "call.<call>".
|
||||
@@ -164,18 +168,13 @@ func ParseCallsByCallCallKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeCallsByCallCallValue reads one value of the state calls under the form "call.<call>", refusing a field CallsByCallCallValue does not know and any text after the value.
|
||||
func DecodeCallsByCallCallValue(raw []byte) (CallsByCallCallValue, error) {
|
||||
// DecodeCallsByCallCallValue reads one value of the state calls under the form "call.<call>" as another part wrote it: a field CallsByCallCallValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeCallsByCallCallValue(raw []byte) (CallsByCallCallValue, int, error) {
|
||||
var v CallsByCallCallValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Call is one merge call, written before its first merge and updated as each member merges (design 47 H §766).
|
||||
@@ -184,7 +183,9 @@ type Call struct {
|
||||
Account string `json:"account"`
|
||||
At time.Time `json:"at"`
|
||||
// the caller as who@node
|
||||
By string `json:"by"`
|
||||
By string `json:"by"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Members []CallMember `json:"members"`
|
||||
// merge-called was said for it
|
||||
Said bool `json:"said"`
|
||||
@@ -242,7 +243,9 @@ type FailedStep struct {
|
||||
Commits []string `json:"commits"`
|
||||
// the build-input fingerprint the step failed at
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
Module string `json:"module"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Module string `json:"module"`
|
||||
// the run that failed it: the runner's pipeline key
|
||||
Run string `json:"run"`
|
||||
// why it failed, as the runner's step-ended said
|
||||
@@ -369,6 +372,8 @@ type MergeCalled struct {
|
||||
By string `json:"by"`
|
||||
// the merge call, 16 lowercase hex characters made once per call
|
||||
Call string `json:"call"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// one per landed member
|
||||
Members []MergeCalledMembersItem `json:"members"`
|
||||
// one per member not merged after every member was judged (design 47 H §767)
|
||||
@@ -390,8 +395,10 @@ type PullAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,omitempty"`
|
||||
Merging *Merging `json:"merging,omitempty"`
|
||||
Pull *Pull `json:"pull,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Merging *Merging `json:"merging,omitempty"`
|
||||
Pull *Pull `json:"pull,omitempty"`
|
||||
}
|
||||
|
||||
// BranchInput is what branch takes.
|
||||
@@ -407,6 +414,8 @@ type BranchAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// a commit, its full 40-hex sha
|
||||
Head string `json:"head,omitempty"`
|
||||
Repository string `json:"repository,omitempty"`
|
||||
@@ -421,6 +430,8 @@ type OpenPullsAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// every open pull request; said empty when none is open, so an answer that lacks it is never read as none
|
||||
Pulls []OpenPull `json:"pulls"`
|
||||
}
|
||||
@@ -442,6 +453,8 @@ type TagsAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// another page exists
|
||||
More bool `json:"more,omitempty"`
|
||||
// the page
|
||||
@@ -473,6 +486,8 @@ type TreesAnswer struct {
|
||||
ErrorKind ErrorKind `json:"error-kind,omitempty"`
|
||||
// directory to {path: blob id}
|
||||
Files map[string]map[string]string `json:"files,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// directory to {path: object id}
|
||||
Paths map[string]map[string]string `json:"paths,omitempty"`
|
||||
// the root tree's hash
|
||||
@@ -502,6 +517,8 @@ type FileAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 path
|
||||
Path string `json:"path,omitempty"`
|
||||
// what was read
|
||||
@@ -531,6 +548,8 @@ type ContainsAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 other
|
||||
In string `json:"in,omitempty"`
|
||||
}
|
||||
@@ -552,6 +571,8 @@ type StatusesAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 newest of each context
|
||||
Statuses []Status `json:"statuses,omitempty"`
|
||||
}
|
||||
@@ -588,6 +609,8 @@ type StatusAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 id was already held on the pull request or the note, so nothing was done again
|
||||
Held bool `json:"held,omitempty"`
|
||||
// the act's id, as the caller gave it
|
||||
@@ -613,6 +636,8 @@ type CommentAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 id was already held on the pull request or the note, so nothing was done again
|
||||
Held bool `json:"held,omitempty"`
|
||||
// the act's id, as the caller gave it
|
||||
@@ -638,6 +663,8 @@ type ViewAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 id was already held on the pull request or the note, so nothing was done again
|
||||
Held bool `json:"held,omitempty"`
|
||||
// the act's id, as the caller gave it
|
||||
@@ -663,6 +690,8 @@ type NoteAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 id was already held on the pull request or the note, so nothing was done again
|
||||
Held bool `json:"held,omitempty"`
|
||||
// the act's id, as the caller gave it
|
||||
@@ -696,6 +725,8 @@ type MergePullAnswer struct {
|
||||
// why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// each member's outcome, in the order named
|
||||
Members []MemberOutcome `json:"members,omitempty"`
|
||||
}
|
||||
@@ -715,6 +746,8 @@ type TagAnswer struct {
|
||||
// why the forge could not write it: set alone with error-kind
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorKind ErrorKind `json:"error-kind,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 forge holds the tag at that commit now
|
||||
Performed bool `json:"performed,omitempty"`
|
||||
// the tag, as asked
|
||||
@@ -732,6 +765,8 @@ type PullUpdatedEvent struct {
|
||||
// its head branch
|
||||
Branch string `json:"branch"`
|
||||
Change *Change `json:"change,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// a commit, its full 40-hex sha
|
||||
Head string `json:"head"`
|
||||
// the pull request's number
|
||||
@@ -753,6 +788,8 @@ type PullMergedEvent struct {
|
||||
// its head branch
|
||||
Branch string `json:"branch"`
|
||||
Change *Change `json:"change,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// a commit, its full 40-hex sha
|
||||
Head string `json:"head"`
|
||||
// the head's statuses by context, their states; absent when they could not be read
|
||||
@@ -779,6 +816,8 @@ type PullClosedEvent struct {
|
||||
Base string `json:"base"`
|
||||
// its head branch
|
||||
Branch string `json:"branch"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// a commit, its full 40-hex sha
|
||||
Head string `json:"head"`
|
||||
// the pull request's number
|
||||
@@ -801,6 +840,8 @@ type ForgePullEvent struct {
|
||||
Base string `json:"base,omitempty"`
|
||||
// its head branch
|
||||
Branch string `json:"branch,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// its head commit
|
||||
Head string `json:"head,omitempty"`
|
||||
// the merge commit
|
||||
@@ -823,6 +864,8 @@ type ForgeStatusEvent struct {
|
||||
Context string `json:"context"`
|
||||
// what it says
|
||||
Description string `json:"description,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 repository, <owner>/<name>
|
||||
Repository string `json:"repository"`
|
||||
// who set it
|
||||
@@ -833,6 +876,8 @@ type ForgeStatusEvent struct {
|
||||
|
||||
// ForgeDeleteEvent is the body of the event forge-delete.
|
||||
type ForgeDeleteEvent 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 deleted branch or tag
|
||||
Ref string `json:"ref"`
|
||||
// branch or tag
|
||||
@@ -847,6 +892,8 @@ type ForgeDeleteEvent struct {
|
||||
type RepoWritableEvent struct {
|
||||
// the account that writes it now
|
||||
Account string `json:"account"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the repository, <owner>/<name>
|
||||
Repository string `json:"repository"`
|
||||
}
|
||||
@@ -855,6 +902,8 @@ type RepoWritableEvent struct {
|
||||
type BranchMovedEvent struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Branch string `json:"branch"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the head the webhook said, a commit's full 40-hex sha; read again by branch
|
||||
Head string `json:"head,omitempty"`
|
||||
// the repository, <owner>/<name>
|
||||
@@ -869,3 +918,221 @@ type FailedStepsByModuleFingerprintStepValue = FailedStep
|
||||
|
||||
// CallsByCallCallValue is one value of the state calls under the key call.<call>.
|
||||
type CallsByCallCallValue = Call
|
||||
|
||||
// DecodePullAnswer reads a PullAnswer 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 DecodePullAnswer(raw []byte) (PullAnswer, int, error) {
|
||||
var v PullAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeBranchAnswer reads a BranchAnswer 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 DecodeBranchAnswer(raw []byte) (BranchAnswer, int, error) {
|
||||
var v BranchAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeOpenPullsAnswer reads a OpenPullsAnswer 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 DecodeOpenPullsAnswer(raw []byte) (OpenPullsAnswer, int, error) {
|
||||
var v OpenPullsAnswer
|
||||
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
|
||||
}
|
||||
|
||||
// DecodeTreesAnswer reads a TreesAnswer 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 DecodeTreesAnswer(raw []byte) (TreesAnswer, int, error) {
|
||||
var v TreesAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFileAnswer reads a FileAnswer 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 DecodeFileAnswer(raw []byte) (FileAnswer, int, error) {
|
||||
var v FileAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeContainsAnswer reads a ContainsAnswer 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 DecodeContainsAnswer(raw []byte) (ContainsAnswer, int, error) {
|
||||
var v ContainsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStatusesAnswer reads a StatusesAnswer 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 DecodeStatusesAnswer(raw []byte) (StatusesAnswer, int, error) {
|
||||
var v StatusesAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStatusAnswer reads a StatusAnswer 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 DecodeStatusAnswer(raw []byte) (StatusAnswer, int, error) {
|
||||
var v StatusAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeCommentAnswer reads a CommentAnswer 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 DecodeCommentAnswer(raw []byte) (CommentAnswer, int, error) {
|
||||
var v CommentAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeViewAnswer reads a ViewAnswer 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 DecodeViewAnswer(raw []byte) (ViewAnswer, int, error) {
|
||||
var v ViewAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeNoteAnswer reads a NoteAnswer 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 DecodeNoteAnswer(raw []byte) (NoteAnswer, int, error) {
|
||||
var v NoteAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeMergePullAnswer reads a MergePullAnswer 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 DecodeMergePullAnswer(raw []byte) (MergePullAnswer, int, error) {
|
||||
var v MergePullAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeTagAnswer reads a TagAnswer 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 DecodeTagAnswer(raw []byte) (TagAnswer, int, error) {
|
||||
var v TagAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePullUpdatedEvent reads a PullUpdatedEvent 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 DecodePullUpdatedEvent(raw []byte) (PullUpdatedEvent, int, error) {
|
||||
var v PullUpdatedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePullMergedEvent reads a PullMergedEvent 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 DecodePullMergedEvent(raw []byte) (PullMergedEvent, int, error) {
|
||||
var v PullMergedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePullClosedEvent reads a PullClosedEvent 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 DecodePullClosedEvent(raw []byte) (PullClosedEvent, int, error) {
|
||||
var v PullClosedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeForgePullEvent reads a ForgePullEvent 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 DecodeForgePullEvent(raw []byte) (ForgePullEvent, int, error) {
|
||||
var v ForgePullEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeForgeStatusEvent reads a ForgeStatusEvent 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 DecodeForgeStatusEvent(raw []byte) (ForgeStatusEvent, int, error) {
|
||||
var v ForgeStatusEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeForgeDeleteEvent reads a ForgeDeleteEvent 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 DecodeForgeDeleteEvent(raw []byte) (ForgeDeleteEvent, int, error) {
|
||||
var v ForgeDeleteEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRepoWritableEvent reads a RepoWritableEvent 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 DecodeRepoWritableEvent(raw []byte) (RepoWritableEvent, int, error) {
|
||||
var v RepoWritableEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeBranchMovedEvent reads a BranchMovedEvent 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 DecodeBranchMovedEvent(raw []byte) (BranchMovedEvent, int, error) {
|
||||
var v BranchMovedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeMergeCalledEvent reads a MergeCalledEvent 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 DecodeMergeCalledEvent(raw []byte) (MergeCalledEvent, int, error) {
|
||||
var v MergeCalledEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -3,9 +3,27 @@
|
||||
// Package gopackageregistry is the contract of the seat "go-package-registry", defined whole (seats/go-package-registry/seat.json): The mesh's Go modules: Go's module proxy protocol's read side, and publishing over the bus.
|
||||
package gopackageregistry
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// Seat is the seat's name.
|
||||
const Seat = "go-package-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 = "b80afb127966ec05c9c822eab0ab43488e6ee0a9d0f43cb1334e4fa32f07bb35"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbPublish = "publish"
|
||||
VerbPublishPart = "publish-part"
|
||||
@@ -83,6 +101,8 @@ type Outcome struct {
|
||||
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
|
||||
@@ -155,6 +175,8 @@ const (
|
||||
|
||||
// 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
|
||||
@@ -181,6 +203,8 @@ type PublishPartInput struct {
|
||||
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
|
||||
@@ -199,6 +223,8 @@ type VersionsInput struct {
|
||||
|
||||
// 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
|
||||
@@ -228,6 +254,8 @@ const (
|
||||
// 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
|
||||
@@ -260,3 +288,86 @@ type GoPackageRegistryForm struct {
|
||||
// the read side's address
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -3,11 +3,25 @@
|
||||
// Package meshartifactsweep is the contract of the seat "mesh-artifact-sweep", defined whole (seats/mesh-artifact-sweep/seat.json): no description.
|
||||
package meshartifactsweep
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-artifact-sweep"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "15ff15679b43316c05f50583f7ed5e367eac2ba26003374b05a94f5107857a92"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbArtifacts = "artifacts"
|
||||
VerbHeld = "held"
|
||||
@@ -47,6 +61,8 @@ type ArtifactsGone struct {
|
||||
Event string `json:"event"`
|
||||
// the key's fingerprint
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// every reference of the key the store does not hold, sorted
|
||||
Gone []string `json:"gone"`
|
||||
// the builder's done key
|
||||
@@ -80,6 +96,8 @@ type HeldInput struct {
|
||||
|
||||
// HeldAnswer is what held answers.
|
||||
type HeldAnswer 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 references the store answered 404 for
|
||||
Gone []string `json:"gone"`
|
||||
// the references the store holds
|
||||
@@ -127,3 +145,68 @@ type ImagesAnswer = map[string]any
|
||||
|
||||
// ArtifactsGoneEvent is the body of the event artifacts-gone.
|
||||
type ArtifactsGoneEvent = ArtifactsGone
|
||||
|
||||
// DecodeArtifactsAnswer reads a ArtifactsAnswer 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 DecodeArtifactsAnswer(raw []byte) (ArtifactsAnswer, int, error) {
|
||||
var v ArtifactsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeHeldAnswer reads a HeldAnswer 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 DecodeHeldAnswer(raw []byte) (HeldAnswer, int, error) {
|
||||
var v HeldAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeCollectAnswer reads a CollectAnswer 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 DecodeCollectAnswer(raw []byte) (CollectAnswer, int, error) {
|
||||
var v CollectAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeMirrorsAnswer reads a MirrorsAnswer 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 DecodeMirrorsAnswer(raw []byte) (MirrorsAnswer, int, error) {
|
||||
var v MirrorsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeImagesAnswer reads a ImagesAnswer 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 DecodeImagesAnswer(raw []byte) (ImagesAnswer, int, error) {
|
||||
var v ImagesAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeArtifactsGoneEvent reads a ArtifactsGoneEvent 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 DecodeArtifactsGoneEvent(raw []byte) (ArtifactsGoneEvent, int, error) {
|
||||
var v ArtifactsGoneEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -3,11 +3,25 @@
|
||||
// Package meshbuilds is the contract of the seat "mesh-builds", defined whole (seats/mesh-builds/seat.json): The builder's seat: it says each artifact it published and each agreed toolchain, and answers a module's reserved version. Held once for the mesh (design 47 G section 52, section 307).
|
||||
package meshbuilds
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-builds"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "4001613559208a0a99ed933d22eefad947365f8bcd6ba091dc4edb5e869d4798"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbReserved = "reserved"
|
||||
VerbPublished = "published"
|
||||
@@ -94,6 +108,8 @@ type PackagePublished struct {
|
||||
Dependencies []Dependency `json:"dependencies,omitempty"`
|
||||
// the published artifact's 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
|
||||
Module string `json:"module"`
|
||||
// the catalog revision number of that branch the build was made from, the indexer's count (design 47 H-A-218, H-A-220); absent from a reservation made before the field
|
||||
@@ -112,6 +128,8 @@ type StepEnded struct {
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
// each entry the step built, by module and fingerprint
|
||||
Entries []BuildEntry `json:"entries"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the ask's id
|
||||
ID string `json:"id"`
|
||||
// the node the builder ran it on, as in the subject
|
||||
@@ -180,6 +198,8 @@ type ToolchainAgreed struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// each digest the nodes reporting the agreed version report, as it stood when the version was agreed, with those nodes (design 47 G section 472, section 495)
|
||||
Digests []ToolchainAgreedDigestsItem `json:"digests"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the language whose agreed toolchain changed
|
||||
Language string `json:"language"`
|
||||
V int64 `json:"v"`
|
||||
@@ -210,6 +230,8 @@ type ReservedAnswer struct {
|
||||
Artifacts []ReservedAnswerArtifactsItem `json:"artifacts,omitempty"`
|
||||
// a name no entry carries, or a version neither reserved nor released, naming which; set alone (design 47 G 582, 679)
|
||||
Error string `json:"error,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
|
||||
Module string `json:"module,omitempty"`
|
||||
// true when the version is released: the catalog holds it, and artifacts are the ones its release recorded with their digests; false when it is reserved (design 47 G 582, 679)
|
||||
@@ -234,6 +256,8 @@ type PublishedAnswer struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// the published artifact's digest, when published; absent for a release kept before the digest was kept (design 47 H-A-331)
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// true when the artifact built at the fingerprint is published; a number a take-over withdrew is never published (design 47 H-A-331)
|
||||
Published bool `json:"published"`
|
||||
// the version it is published at, MAJOR.MINOR.PATCH, when published
|
||||
@@ -251,3 +275,59 @@ type ToolchainAgreedEvent = ToolchainAgreed
|
||||
|
||||
// StepEndedEvent is the body of the event step-ended.
|
||||
type StepEndedEvent = StepEnded
|
||||
|
||||
// DecodeReservedAnswer reads a ReservedAnswer 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 DecodeReservedAnswer(raw []byte) (ReservedAnswer, int, error) {
|
||||
var v ReservedAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePublishedAnswer reads a PublishedAnswer 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 DecodePublishedAnswer(raw []byte) (PublishedAnswer, int, error) {
|
||||
var v PublishedAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePackagePublishedEvent reads a PackagePublishedEvent 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 DecodePackagePublishedEvent(raw []byte) (PackagePublishedEvent, int, error) {
|
||||
var v PackagePublishedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeToolchainAgreedEvent reads a ToolchainAgreedEvent 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 DecodeToolchainAgreedEvent(raw []byte) (ToolchainAgreedEvent, int, error) {
|
||||
var v ToolchainAgreedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepEndedEvent reads a StepEndedEvent 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 DecodeStepEndedEvent(raw []byte) (StepEndedEvent, int, error) {
|
||||
var v StepEndedEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package meshcatalog
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,17 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-catalog"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "5a5f6106fe9ee419cc10e40c34f4e901b9ee9215033079381243d04d898e5c7c"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbModules = "modules"
|
||||
VerbModule = "module"
|
||||
@@ -132,18 +141,13 @@ func ParseManifestsByDigestKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeManifestsByDigestValue reads one value of the state manifests under the form "<digest>", refusing a field ManifestsByDigestValue does not know and any text after the value.
|
||||
func DecodeManifestsByDigestValue(raw []byte) (ManifestsByDigestValue, error) {
|
||||
// DecodeManifestsByDigestValue reads one value of the state manifests under the form "<digest>" as another part wrote it: a field ManifestsByDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeManifestsByDigestValue(raw []byte) (ManifestsByDigestValue, int, error) {
|
||||
var v ManifestsByDigestValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// ModulesByModuleKey is the key of one value of the state modules under the form "<module>".
|
||||
@@ -163,18 +167,13 @@ func ParseModulesByModuleKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeModulesByModuleValue reads one value of the state modules under the form "<module>", refusing a field ModulesByModuleValue does not know and any text after the value.
|
||||
func DecodeModulesByModuleValue(raw []byte) (ModulesByModuleValue, error) {
|
||||
// DecodeModulesByModuleValue reads one value of the state modules under the form "<module>" as another part wrote it: a field ModulesByModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeModulesByModuleValue(raw []byte) (ModulesByModuleValue, int, error) {
|
||||
var v ModulesByModuleValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// CandidatesByGroupKey is the key of one value of the state candidates under the form "<group>".
|
||||
@@ -194,18 +193,13 @@ func ParseCandidatesByGroupKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeCandidatesByGroupValue reads one value of the state candidates under the form "<group>", refusing a field CandidatesByGroupValue does not know and any text after the value.
|
||||
func DecodeCandidatesByGroupValue(raw []byte) (CandidatesByGroupValue, error) {
|
||||
// DecodeCandidatesByGroupValue reads one value of the state candidates under the form "<group>" as another part wrote it: a field CandidatesByGroupValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeCandidatesByGroupValue(raw []byte) (CandidatesByGroupValue, int, error) {
|
||||
var v CandidatesByGroupValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PredefinedByListKey is the key of one value of the state predefined under the form "list".
|
||||
@@ -224,18 +218,13 @@ func ParsePredefinedByListKey(key string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// DecodePredefinedByListValue reads one value of the state predefined under the form "list", refusing a field PredefinedByListValue does not know and any text after the value.
|
||||
func DecodePredefinedByListValue(raw []byte) (PredefinedByListValue, error) {
|
||||
// DecodePredefinedByListValue reads one value of the state predefined under the form "list" as another part wrote it: a field PredefinedByListValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePredefinedByListValue(raw []byte) (PredefinedByListValue, int, error) {
|
||||
var v PredefinedByListValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PackagesByModuleKey is the key of one value of the state packages under the form "<module>".
|
||||
@@ -255,18 +244,13 @@ func ParsePackagesByModuleKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodePackagesByModuleValue reads one value of the state packages under the form "<module>", refusing a field PackagesByModuleValue does not know and any text after the value.
|
||||
func DecodePackagesByModuleValue(raw []byte) (PackagesByModuleValue, error) {
|
||||
// DecodePackagesByModuleValue reads one value of the state packages under the form "<module>" as another part wrote it: a field PackagesByModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePackagesByModuleValue(raw []byte) (PackagesByModuleValue, int, error) {
|
||||
var v PackagesByModuleValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PackagesByPackageSeriesKey is the key of one value of the state packages under the form "<package>.<series>".
|
||||
@@ -291,18 +275,13 @@ func ParsePackagesByPackageSeriesKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodePackagesByPackageSeriesValue reads one value of the state packages under the form "<package>.<series>", refusing a field PackagesByPackageSeriesValue does not know and any text after the value.
|
||||
func DecodePackagesByPackageSeriesValue(raw []byte) (PackagesByPackageSeriesValue, error) {
|
||||
// DecodePackagesByPackageSeriesValue reads one value of the state packages under the form "<package>.<series>" as another part wrote it: a field PackagesByPackageSeriesValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePackagesByPackageSeriesValue(raw []byte) (PackagesByPackageSeriesValue, int, error) {
|
||||
var v PackagesByPackageSeriesValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// CatalogRevisionsByBranchRevisionKey is the key of one value of the state catalog-revisions under the form "<branch>.<revision>".
|
||||
@@ -329,18 +308,13 @@ func ParseCatalogRevisionsByBranchRevisionKey(key string) (string, string, bool)
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeCatalogRevisionsByBranchRevisionValue reads one value of the state catalog-revisions under the form "<branch>.<revision>", refusing a field CatalogRevisionsByBranchRevisionValue does not know and any text after the value.
|
||||
func DecodeCatalogRevisionsByBranchRevisionValue(raw []byte) (CatalogRevisionsByBranchRevisionValue, error) {
|
||||
// DecodeCatalogRevisionsByBranchRevisionValue reads one value of the state catalog-revisions under the form "<branch>.<revision>" as another part wrote it: a field CatalogRevisionsByBranchRevisionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeCatalogRevisionsByBranchRevisionValue(raw []byte) (CatalogRevisionsByBranchRevisionValue, int, error) {
|
||||
var v CatalogRevisionsByBranchRevisionValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// CatalogRevisionsByCandidateGroupHeadsKey is the key of one value of the state catalog-revisions under the form "candidate.<group>.<heads>".
|
||||
@@ -371,18 +345,13 @@ func ParseCatalogRevisionsByCandidateGroupHeadsKey(key string) (string, string,
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodeCatalogRevisionsByCandidateGroupHeadsValue reads one value of the state catalog-revisions under the form "candidate.<group>.<heads>", refusing a field CatalogRevisionsByCandidateGroupHeadsValue does not know and any text after the value.
|
||||
func DecodeCatalogRevisionsByCandidateGroupHeadsValue(raw []byte) (CatalogRevisionsByCandidateGroupHeadsValue, error) {
|
||||
// DecodeCatalogRevisionsByCandidateGroupHeadsValue reads one value of the state catalog-revisions under the form "candidate.<group>.<heads>" as another part wrote it: a field CatalogRevisionsByCandidateGroupHeadsValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeCatalogRevisionsByCandidateGroupHeadsValue(raw []byte) (CatalogRevisionsByCandidateGroupHeadsValue, int, error) {
|
||||
var v CatalogRevisionsByCandidateGroupHeadsValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// CatalogRevisionsByEntryDigestKey is the key of one value of the state catalog-revisions under the form "entry.<digest>".
|
||||
@@ -406,18 +375,13 @@ func ParseCatalogRevisionsByEntryDigestKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeCatalogRevisionsByEntryDigestValue reads one value of the state catalog-revisions under the form "entry.<digest>", refusing a field CatalogRevisionsByEntryDigestValue does not know and any text after the value.
|
||||
func DecodeCatalogRevisionsByEntryDigestValue(raw []byte) (CatalogRevisionsByEntryDigestValue, error) {
|
||||
// DecodeCatalogRevisionsByEntryDigestValue reads one value of the state catalog-revisions under the form "entry.<digest>" as another part wrote it: a field CatalogRevisionsByEntryDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeCatalogRevisionsByEntryDigestValue(raw []byte) (CatalogRevisionsByEntryDigestValue, int, error) {
|
||||
var v CatalogRevisionsByEntryDigestValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// RegistrationsByModuleKey is the key of one value of the state registrations under the form "<module>".
|
||||
@@ -437,18 +401,13 @@ func ParseRegistrationsByModuleKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeRegistrationsByModuleValue reads one value of the state registrations under the form "<module>", refusing a field RegistrationsByModuleValue does not know and any text after the value.
|
||||
func DecodeRegistrationsByModuleValue(raw []byte) (RegistrationsByModuleValue, error) {
|
||||
// DecodeRegistrationsByModuleValue reads one value of the state registrations under the form "<module>" as another part wrote it: a field RegistrationsByModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeRegistrationsByModuleValue(raw []byte) (RegistrationsByModuleValue, int, error) {
|
||||
var v RegistrationsByModuleValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// RegistrationHistoryByModuleVersionKey is the key of one value of the state registration-history under the form "<module>.<version>".
|
||||
@@ -475,18 +434,13 @@ func ParseRegistrationHistoryByModuleVersionKey(key string) (string, string, boo
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeRegistrationHistoryByModuleVersionValue reads one value of the state registration-history under the form "<module>.<version>", refusing a field RegistrationHistoryByModuleVersionValue does not know and any text after the value.
|
||||
func DecodeRegistrationHistoryByModuleVersionValue(raw []byte) (RegistrationHistoryByModuleVersionValue, error) {
|
||||
// DecodeRegistrationHistoryByModuleVersionValue reads one value of the state registration-history under the form "<module>.<version>" as another part wrote it: a field RegistrationHistoryByModuleVersionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeRegistrationHistoryByModuleVersionValue(raw []byte) (RegistrationHistoryByModuleVersionValue, int, error) {
|
||||
var v RegistrationHistoryByModuleVersionValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// VersionsByModuleVersionKey is the key of one value of the state versions under the form "<module>.<version>".
|
||||
@@ -511,18 +465,13 @@ func ParseVersionsByModuleVersionKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeVersionsByModuleVersionValue reads one value of the state versions under the form "<module>.<version>", refusing a field VersionsByModuleVersionValue does not know and any text after the value.
|
||||
func DecodeVersionsByModuleVersionValue(raw []byte) (VersionsByModuleVersionValue, error) {
|
||||
// DecodeVersionsByModuleVersionValue reads one value of the state versions under the form "<module>.<version>" as another part wrote it: a field VersionsByModuleVersionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeVersionsByModuleVersionValue(raw []byte) (VersionsByModuleVersionValue, int, error) {
|
||||
var v VersionsByModuleVersionValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// BuildEdgesByModuleBranchKey is the key of one value of the state build-edges under the form "<module>.<branch>".
|
||||
@@ -547,18 +496,13 @@ func ParseBuildEdgesByModuleBranchKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeBuildEdgesByModuleBranchValue reads one value of the state build-edges under the form "<module>.<branch>", refusing a field BuildEdgesByModuleBranchValue does not know and any text after the value.
|
||||
func DecodeBuildEdgesByModuleBranchValue(raw []byte) (BuildEdgesByModuleBranchValue, error) {
|
||||
// DecodeBuildEdgesByModuleBranchValue reads one value of the state build-edges under the form "<module>.<branch>" as another part wrote it: a field BuildEdgesByModuleBranchValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeBuildEdgesByModuleBranchValue(raw []byte) (BuildEdgesByModuleBranchValue, int, error) {
|
||||
var v BuildEdgesByModuleBranchValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// InputsByTimeDigestKey is the key of one value of the state inputs under the form "<time>.<digest>".
|
||||
@@ -583,18 +527,13 @@ func ParseInputsByTimeDigestKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeInputsByTimeDigestValue reads one value of the state inputs under the form "<time>.<digest>", refusing a field InputsByTimeDigestValue does not know and any text after the value.
|
||||
func DecodeInputsByTimeDigestValue(raw []byte) (InputsByTimeDigestValue, error) {
|
||||
// DecodeInputsByTimeDigestValue reads one value of the state inputs under the form "<time>.<digest>" as another part wrote it: a field InputsByTimeDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeInputsByTimeDigestValue(raw []byte) (InputsByTimeDigestValue, int, error) {
|
||||
var v InputsByTimeDigestValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// ActingRule is a rule a seat the module claims declares in its acts: the step the module acts in, on which entries, and how long a new version of it may take before it acts (design 47, An acting part's new version acts first).
|
||||
@@ -642,6 +581,8 @@ type BuildEdge struct {
|
||||
// BuildEdges is the newest build's edge entries of a module on a watched branch other than the first, keyed by its fingerprint, which releases no version (design 47 G section 374).
|
||||
type BuildEdges struct {
|
||||
Edges []VersionEdge `json:"edges"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the build's fingerprint
|
||||
Fp string `json:"fp"`
|
||||
Source int64 `json:"source,omitempty"`
|
||||
@@ -664,6 +605,8 @@ type CatalogEntry struct {
|
||||
Contributes []string `json:"contributes,omitempty"`
|
||||
// the edges into this module's artifacts, each from the artifact that comes first; the build and the delivery order by these alone
|
||||
Edges []Edge `json:"edges,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// its fingerprint (src2: and 64 hex digits); absent when it has none
|
||||
Fp string `json:"fp,omitempty"`
|
||||
Inputs *EntryInputs `json:"inputs,omitempty"`
|
||||
@@ -723,6 +666,8 @@ type CatalogRevision struct {
|
||||
Definitions []CatalogRevisionDefinitionsItem `json:"definitions,omitempty"`
|
||||
// one per module, by name
|
||||
Entries []EntryRef `json:"entries"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// a candidate's group
|
||||
Group string `json:"group,omitempty"`
|
||||
// a candidate's heads
|
||||
@@ -801,6 +746,8 @@ type Fill struct {
|
||||
Bytes int64 `json:"bytes"`
|
||||
// bytes
|
||||
Cap int64 `json:"cap"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// what full refuses, such as the next revision and the pending merge it would take in
|
||||
Refused string `json:"refused,omitempty"`
|
||||
// the kept data, by its name in the holder's manifest
|
||||
@@ -866,7 +813,9 @@ type Registration struct {
|
||||
// its watched branches, the first the default a placement runs
|
||||
Branches []string `json:"branches"`
|
||||
// who asked the change
|
||||
By string `json:"by,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Module string `json:"module"`
|
||||
// its git origin, the repository as <owner>/<name>
|
||||
Origin string `json:"origin"`
|
||||
@@ -885,6 +834,8 @@ type Registration struct {
|
||||
type RegistrationAsked struct {
|
||||
// the ask's id
|
||||
Ask string `json:"ask,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// every value the change moves, as the ask names it ("nats:program unit: required -> bypass")
|
||||
Lines []string `json:"lines,omitempty"`
|
||||
Module string `json:"module"`
|
||||
@@ -1010,6 +961,8 @@ type VersionEntry struct {
|
||||
Artifacts []VersionArtifact `json:"artifacts"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Edges []VersionEdge `json:"edges,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// released late: lower than the module's highest, recorded and not said
|
||||
Late bool `json:"late,omitempty"`
|
||||
// the module
|
||||
@@ -1081,6 +1034,8 @@ type ModulesAnswerModulesItem struct {
|
||||
|
||||
// ModulesAnswer is what modules answers.
|
||||
type ModulesAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Modules []ModulesAnswerModulesItem `json:"modules"`
|
||||
}
|
||||
|
||||
@@ -1108,6 +1063,8 @@ type ModuleAnswerModule struct {
|
||||
|
||||
// ModuleAnswer is what module answers.
|
||||
type ModuleAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Module ModuleAnswerModule `json:"module"`
|
||||
}
|
||||
|
||||
@@ -1157,7 +1114,9 @@ type SeatDefinitionsAnswerSeatsItem struct {
|
||||
|
||||
// SeatDefinitionsAnswer is what seat-definitions answers.
|
||||
type SeatDefinitionsAnswer struct {
|
||||
Entry *SeatDefinitionsAnswerEntry `json:"entry,omitempty"`
|
||||
Entry *SeatDefinitionsAnswerEntry `json:"entry,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Found bool `json:"found,omitempty"`
|
||||
Revision int64 `json:"revision,omitempty"`
|
||||
Seat string `json:"seat,omitempty"`
|
||||
@@ -1184,6 +1143,8 @@ type RevisionInput struct {
|
||||
type RevisionAnswer struct {
|
||||
// this page's entries whole, by module name
|
||||
Entries []CatalogEntry `json:"entries,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 to ask after for the next page; absent on the last
|
||||
Next string `json:"next,omitempty"`
|
||||
// true for a watched branch with no revision yet: no revision, no entries and no error follow, and a reader holds the branch's view ready and empty (design 47 G section 530)
|
||||
@@ -1202,6 +1163,8 @@ type RegistrationsInput struct {
|
||||
// RegistrationsAnswer is what registrations answers.
|
||||
type RegistrationsAnswer struct {
|
||||
Fill *Fill `json:"fill,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// every version of the one module asked, oldest first
|
||||
History []Registration `json:"history,omitempty"`
|
||||
Registrations []Registration `json:"registrations"`
|
||||
@@ -1256,6 +1219,8 @@ type VersionsInput struct {
|
||||
|
||||
// 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 module
|
||||
Module string `json:"module"`
|
||||
Versions []VersionEntry `json:"versions"`
|
||||
@@ -1272,6 +1237,8 @@ type OutdatedInput struct {
|
||||
// OutdatedAnswer is what outdated answers.
|
||||
type OutdatedAnswer struct {
|
||||
Behind []Outdated `json:"behind"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
}
|
||||
|
||||
// InputInput is what input takes.
|
||||
@@ -1288,6 +1255,8 @@ type InputAnswer struct {
|
||||
Chunks int64 `json:"chunks"`
|
||||
// the input's sha256
|
||||
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"`
|
||||
}
|
||||
|
||||
// EntryInput is what entry takes.
|
||||
@@ -1299,18 +1268,24 @@ type EntryInput struct {
|
||||
// EntryAnswer is what entry answers.
|
||||
type EntryAnswer struct {
|
||||
Entry CatalogEntry `json:"entry"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
}
|
||||
|
||||
// SeatDefinitionChangedEvent is the body of the event seat-definition-changed.
|
||||
type SeatDefinitionChangedEvent struct {
|
||||
Digest string `json:"digest"`
|
||||
Seat string `json:"seat"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Seat string `json:"seat"`
|
||||
// trunk
|
||||
Source string `json:"source"`
|
||||
}
|
||||
|
||||
// SeatDefinitionRemovedEvent is the body of the event seat-definition-removed.
|
||||
type SeatDefinitionRemovedEvent struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Seat string `json:"seat"`
|
||||
}
|
||||
|
||||
@@ -1326,9 +1301,11 @@ type CatalogRevisionEvent struct {
|
||||
// the modules whose entries differ from the revision before it of the same kind
|
||||
Changed []string `json:"changed,omitempty"`
|
||||
// how many entries it lists
|
||||
Entries int64 `json:"entries,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
Entries int64 `json:"entries,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
// trunk or candidate: a candidate's moves no running part
|
||||
Kind string `json:"kind"`
|
||||
// for call-kind release, the module released (H-A-215)
|
||||
@@ -1361,9 +1338,11 @@ type RoomEvent = Fill
|
||||
|
||||
// RegistrationChangedEvent is the body of the event registration-changed.
|
||||
type RegistrationChangedEvent struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
Module string `json:"module"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Module string `json:"module"`
|
||||
// every value it moved, one line each
|
||||
Moved []string `json:"moved"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
@@ -1376,6 +1355,8 @@ type VersionReleasedEvent struct {
|
||||
// each artifact's digest
|
||||
Artifacts []VersionArtifact `json:"artifacts"`
|
||||
At *time.Time `json:"at,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
|
||||
Module string `json:"module"`
|
||||
// the source revision built
|
||||
@@ -1388,6 +1369,8 @@ type VersionReleasedEvent struct {
|
||||
// VersionsFilledEvent is the body of the event versions-filled.
|
||||
type VersionsFilledEvent struct {
|
||||
At time.Time `json:"at"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// how many modules were filled
|
||||
Modules int64 `json:"modules,omitempty"`
|
||||
V int64 `json:"v"`
|
||||
@@ -1395,6 +1378,8 @@ type VersionsFilledEvent struct {
|
||||
|
||||
// ManifestsByDigestValue is one value of the state manifests under the key <digest>.
|
||||
type ManifestsByDigestValue 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 manifest, UTF-8 JSON text
|
||||
Manifest string `json:"manifest"`
|
||||
Module string `json:"module"`
|
||||
@@ -1418,6 +1403,8 @@ type ModulesByModuleValueInputs2 struct {
|
||||
// ModulesByModuleValue is one value of the state modules under the key <module>.
|
||||
type ModulesByModuleValue struct {
|
||||
Commit string `json:"commit"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the old-form fingerprint
|
||||
Fp string `json:"fp,omitempty"`
|
||||
// src2: fingerprint
|
||||
@@ -1464,7 +1451,9 @@ type CandidatesByGroupValuePullsItem struct {
|
||||
// CandidatesByGroupValue is one value of the state candidates under the key <group>.
|
||||
type CandidatesByGroupValue struct {
|
||||
// the source revision it is read on
|
||||
Base int64 `json:"base"`
|
||||
Base int64 `json:"base"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Fpset string `json:"fpset,omitempty"`
|
||||
Group string `json:"group"`
|
||||
Heads string `json:"heads"`
|
||||
@@ -1478,6 +1467,8 @@ type PredefinedByListValue struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Commit string `json:"commit"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the foundation's predefined list as kept
|
||||
List any `json:"list"`
|
||||
// the layout version
|
||||
@@ -1496,6 +1487,8 @@ type PackagesByModuleValue struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Commit string `json:"commit"`
|
||||
Dir string `json:"dir,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 Go module path
|
||||
Module string `json:"module"`
|
||||
Packages []PackagesByModuleValuePackagesItem `json:"packages"`
|
||||
@@ -1571,7 +1564,9 @@ type PackagesByPackageSeriesValueNumbered struct {
|
||||
// PackagesByPackageSeriesValue is one value of the state packages under the key <package>.<series>.
|
||||
type PackagesByPackageSeriesValue struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
GoModule string `json:"go-module,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Newest *PackagesByPackageSeriesValueNewest `json:"newest,omitempty"`
|
||||
@@ -1606,3 +1601,230 @@ type BuildEdgesByModuleBranchValue = BuildEdges
|
||||
|
||||
// InputsByTimeDigestValue is one value of the state inputs under the key <time>.<digest>.
|
||||
type InputsByTimeDigestValue = string
|
||||
|
||||
// DecodeModulesAnswer reads a ModulesAnswer 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 DecodeModulesAnswer(raw []byte) (ModulesAnswer, int, error) {
|
||||
var v ModulesAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeModuleAnswer reads a ModuleAnswer 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 DecodeModuleAnswer(raw []byte) (ModuleAnswer, int, error) {
|
||||
var v ModuleAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeProvidesAnswer reads a ProvidesAnswer 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 DecodeProvidesAnswer(raw []byte) (ProvidesAnswer, int, error) {
|
||||
var v ProvidesAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeDependentsAnswer reads a DependentsAnswer 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 DecodeDependentsAnswer(raw []byte) (DependentsAnswer, int, error) {
|
||||
var v DependentsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeSeatDefinitionsAnswer reads a SeatDefinitionsAnswer 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 DecodeSeatDefinitionsAnswer(raw []byte) (SeatDefinitionsAnswer, int, error) {
|
||||
var v SeatDefinitionsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRevisionAnswer reads a RevisionAnswer 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 DecodeRevisionAnswer(raw []byte) (RevisionAnswer, int, error) {
|
||||
var v RevisionAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRegistrationsAnswer reads a RegistrationsAnswer 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 DecodeRegistrationsAnswer(raw []byte) (RegistrationsAnswer, int, error) {
|
||||
var v RegistrationsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRegisterAnswer reads a RegisterAnswer 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 DecodeRegisterAnswer(raw []byte) (RegisterAnswer, int, error) {
|
||||
var v RegisterAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePolicyAnswer reads a PolicyAnswer 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 DecodePolicyAnswer(raw []byte) (PolicyAnswer, int, error) {
|
||||
var v PolicyAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWatchAnswer reads a WatchAnswer 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 DecodeWatchAnswer(raw []byte) (WatchAnswer, int, error) {
|
||||
var v WatchAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeUnwatchAnswer reads a UnwatchAnswer 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 DecodeUnwatchAnswer(raw []byte) (UnwatchAnswer, int, error) {
|
||||
var v UnwatchAnswer
|
||||
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
|
||||
}
|
||||
|
||||
// DecodeOutdatedAnswer reads a OutdatedAnswer 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 DecodeOutdatedAnswer(raw []byte) (OutdatedAnswer, int, error) {
|
||||
var v OutdatedAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeInputAnswer reads a InputAnswer 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 DecodeInputAnswer(raw []byte) (InputAnswer, int, error) {
|
||||
var v InputAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeEntryAnswer reads a EntryAnswer 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 DecodeEntryAnswer(raw []byte) (EntryAnswer, int, error) {
|
||||
var v EntryAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeSeatDefinitionChangedEvent reads a SeatDefinitionChangedEvent 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 DecodeSeatDefinitionChangedEvent(raw []byte) (SeatDefinitionChangedEvent, int, error) {
|
||||
var v SeatDefinitionChangedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeSeatDefinitionRemovedEvent reads a SeatDefinitionRemovedEvent 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 DecodeSeatDefinitionRemovedEvent(raw []byte) (SeatDefinitionRemovedEvent, int, error) {
|
||||
var v SeatDefinitionRemovedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeCatalogRevisionEvent reads a CatalogRevisionEvent 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 DecodeCatalogRevisionEvent(raw []byte) (CatalogRevisionEvent, int, error) {
|
||||
var v CatalogRevisionEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFillingEvent reads a FillingEvent 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 DecodeFillingEvent(raw []byte) (FillingEvent, int, error) {
|
||||
var v FillingEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFullEvent reads a FullEvent 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 DecodeFullEvent(raw []byte) (FullEvent, int, error) {
|
||||
var v FullEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRoomEvent reads a RoomEvent 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 DecodeRoomEvent(raw []byte) (RoomEvent, int, error) {
|
||||
var v RoomEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRegistrationChangedEvent reads a RegistrationChangedEvent 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 DecodeRegistrationChangedEvent(raw []byte) (RegistrationChangedEvent, int, error) {
|
||||
var v RegistrationChangedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeVersionReleasedEvent reads a VersionReleasedEvent 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 DecodeVersionReleasedEvent(raw []byte) (VersionReleasedEvent, int, error) {
|
||||
var v VersionReleasedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeVersionsFilledEvent reads a VersionsFilledEvent 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 DecodeVersionsFilledEvent(raw []byte) (VersionsFilledEvent, int, error) {
|
||||
var v VersionsFilledEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package meshdelivery
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,17 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-delivery"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "5b82311f8d11e063f4390ced15268added07104679f488516bd8cb30b14d22d6"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbDeliveries = "deliveries"
|
||||
VerbShow = "show"
|
||||
@@ -117,18 +126,13 @@ func ParseSourceByBranchKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeSourceByBranchValue reads one value of the state source under the form "<branch>", refusing a field SourceByBranchValue does not know and any text after the value.
|
||||
func DecodeSourceByBranchValue(raw []byte) (SourceByBranchValue, error) {
|
||||
// DecodeSourceByBranchValue reads one value of the state source under the form "<branch>" as another part wrote it: a field SourceByBranchValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeSourceByBranchValue(raw []byte) (SourceByBranchValue, int, error) {
|
||||
var v SourceByBranchValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// OwedByRepositoryNumberHeadActKey is the key of one value of the state owed under the form "<repository>.<number>.<head>.<act>".
|
||||
@@ -165,18 +169,13 @@ func ParseOwedByRepositoryNumberHeadActKey(key string) (string, string, string,
|
||||
return v0, v2, v4, v6, true
|
||||
}
|
||||
|
||||
// DecodeOwedByRepositoryNumberHeadActValue reads one value of the state owed under the form "<repository>.<number>.<head>.<act>", refusing a field OwedByRepositoryNumberHeadActValue does not know and any text after the value.
|
||||
func DecodeOwedByRepositoryNumberHeadActValue(raw []byte) (OwedByRepositoryNumberHeadActValue, error) {
|
||||
// DecodeOwedByRepositoryNumberHeadActValue reads one value of the state owed under the form "<repository>.<number>.<head>.<act>" as another part wrote it: a field OwedByRepositoryNumberHeadActValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeOwedByRepositoryNumberHeadActValue(raw []byte) (OwedByRepositoryNumberHeadActValue, int, error) {
|
||||
var v OwedByRepositoryNumberHeadActValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// HeadsByRepositoryBranchKey is the key of one value of the state heads under the form "<repository>.<branch>".
|
||||
@@ -201,18 +200,13 @@ func ParseHeadsByRepositoryBranchKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeHeadsByRepositoryBranchValue reads one value of the state heads under the form "<repository>.<branch>", refusing a field HeadsByRepositoryBranchValue does not know and any text after the value.
|
||||
func DecodeHeadsByRepositoryBranchValue(raw []byte) (HeadsByRepositoryBranchValue, error) {
|
||||
// DecodeHeadsByRepositoryBranchValue reads one value of the state heads under the form "<repository>.<branch>" as another part wrote it: a field HeadsByRepositoryBranchValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeHeadsByRepositoryBranchValue(raw []byte) (HeadsByRepositoryBranchValue, int, error) {
|
||||
var v HeadsByRepositoryBranchValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Fill is the delivery records' ledger's fill against its cap.
|
||||
@@ -222,6 +216,8 @@ type Fill struct {
|
||||
Bytes int64 `json:"bytes"`
|
||||
// bytes
|
||||
Cap int64 `json:"cap"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// what full refuses, such as the next record
|
||||
Refused string `json:"refused,omitempty"`
|
||||
// the kept data, by its name in the holder's manifest
|
||||
@@ -238,6 +234,8 @@ type Owed struct {
|
||||
Context string `json:"context,omitempty"`
|
||||
// a status: what it says
|
||||
Description string `json:"description,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 pull request's head the act is for
|
||||
Head string `json:"head"`
|
||||
// the act's id, the same each time it is said again; a comment and a note line carry it, so the forge holds it once
|
||||
@@ -322,6 +320,8 @@ type SourceAnswer struct {
|
||||
Call string `json:"call,omitempty"`
|
||||
// why it could not be read
|
||||
Error string `json:"error,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// every repository the source revision names, by name
|
||||
Repositories []SourceHead `json:"repositories,omitempty"`
|
||||
// the source revision's number on the bus; 0 before the first
|
||||
@@ -350,8 +350,10 @@ type RecoveryAnswer struct {
|
||||
// the caller the runtime proved
|
||||
By string `json:"by,omitempty"`
|
||||
// the merge commit
|
||||
Commit string `json:"commit"`
|
||||
Recovery bool `json:"recovery"`
|
||||
Commit string `json:"commit"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Recovery bool `json:"recovery"`
|
||||
// the repository
|
||||
Repository string `json:"repository,omitempty"`
|
||||
}
|
||||
@@ -367,6 +369,8 @@ type RecordOpenedEvent struct {
|
||||
Branch string `json:"branch"`
|
||||
// the merge call
|
||||
Call string `json:"call"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// its milestone, <branch>.<source>
|
||||
Milestone string `json:"milestone"`
|
||||
// the record's id
|
||||
@@ -393,6 +397,8 @@ type RecordEndedEvent struct {
|
||||
Branch string `json:"branch"`
|
||||
// the merge call
|
||||
Call string `json:"call"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// its milestone, <branch>.<source>
|
||||
Milestone string `json:"milestone"`
|
||||
// the record's id
|
||||
@@ -421,6 +427,8 @@ type SourceMovedEvent struct {
|
||||
Branch string `json:"branch"`
|
||||
// the merge call that moved it
|
||||
Call string `json:"call"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the repositories it moved
|
||||
Heads []SourceMovedEventHeadsItem `json:"heads"`
|
||||
// the source revision, numbered by the gate alone
|
||||
@@ -439,6 +447,8 @@ type RecoveryMergedEvent struct {
|
||||
By string `json:"by,omitempty"`
|
||||
// the merge commit
|
||||
Commit string `json:"commit"`
|
||||
// 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 the merge changed, from the delivery record
|
||||
Module string `json:"module,omitempty"`
|
||||
// the repository
|
||||
@@ -452,6 +462,8 @@ type RecoveryMergedEvent struct {
|
||||
type SourceByBranchValue struct {
|
||||
// the merge call that moved it; a call the newest revision already carries writes nothing (design 47 H §737, H-A-33)
|
||||
Call string `json:"call"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// repository to the merged head, a full commit
|
||||
Heads map[string]string `json:"heads"`
|
||||
// the branch's source revision, one above its newest
|
||||
@@ -465,18 +477,150 @@ type OwedByRepositoryNumberHeadActValue struct {
|
||||
// status=<context>, view, note or comment.<seq>
|
||||
Act string `json:"act"`
|
||||
Context string `json:"context,omitempty"`
|
||||
Ref string `json:"ref,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Target string `json:"target,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Ref string `json:"ref,omitempty"`
|
||||
State string `json:"state,omitempty"`
|
||||
Target string `json:"target,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
}
|
||||
|
||||
// HeadsByRepositoryBranchValue is one value of the state heads under the key <repository>.<branch>.
|
||||
type HeadsByRepositoryBranchValue 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 head head-moved said
|
||||
Head string `json:"head"`
|
||||
// when it was first heard
|
||||
Since time.Time `json:"since"`
|
||||
}
|
||||
|
||||
// DecodeDeliveriesAnswer reads a DeliveriesAnswer 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 DecodeDeliveriesAnswer(raw []byte) (DeliveriesAnswer, int, error) {
|
||||
var v DeliveriesAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeShowAnswer reads a ShowAnswer 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 DecodeShowAnswer(raw []byte) (ShowAnswer, int, error) {
|
||||
var v ShowAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeSourceAnswer reads a SourceAnswer 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 DecodeSourceAnswer(raw []byte) (SourceAnswer, int, error) {
|
||||
var v SourceAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStalledAnswer reads a StalledAnswer 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 DecodeStalledAnswer(raw []byte) (StalledAnswer, int, error) {
|
||||
var v StalledAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRecoveryAnswer reads a RecoveryAnswer 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 DecodeRecoveryAnswer(raw []byte) (RecoveryAnswer, int, error) {
|
||||
var v RecoveryAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeOwedEvent reads a OwedEvent 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 DecodeOwedEvent(raw []byte) (OwedEvent, int, error) {
|
||||
var v OwedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRecordOpenedEvent reads a RecordOpenedEvent 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 DecodeRecordOpenedEvent(raw []byte) (RecordOpenedEvent, int, error) {
|
||||
var v RecordOpenedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRecordEndedEvent reads a RecordEndedEvent 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 DecodeRecordEndedEvent(raw []byte) (RecordEndedEvent, int, error) {
|
||||
var v RecordEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFillingEvent reads a FillingEvent 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 DecodeFillingEvent(raw []byte) (FillingEvent, int, error) {
|
||||
var v FillingEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFullEvent reads a FullEvent 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 DecodeFullEvent(raw []byte) (FullEvent, int, error) {
|
||||
var v FullEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRoomEvent reads a RoomEvent 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 DecodeRoomEvent(raw []byte) (RoomEvent, int, error) {
|
||||
var v RoomEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeSourceMovedEvent reads a SourceMovedEvent 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 DecodeSourceMovedEvent(raw []byte) (SourceMovedEvent, int, error) {
|
||||
var v SourceMovedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRecoveryMergedEvent reads a RecoveryMergedEvent 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 DecodeRecoveryMergedEvent(raw []byte) (RecoveryMergedEvent, int, error) {
|
||||
var v RecoveryMergedEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,15 +4,24 @@
|
||||
package meshdeliveryview
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-delivery-view"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "ac6cec2da8dbfcbc3c88f4e1b3d519539c433bfb755c89a2670c99ec96ac9472"
|
||||
)
|
||||
|
||||
const (
|
||||
StateAnswers = "answers"
|
||||
)
|
||||
@@ -45,18 +54,13 @@ func ParseAnswersByHoldModuleFingerprintViewKey(key string) (string, string, boo
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByHoldModuleFingerprintViewValue reads one value of the state answers under the form "hold.<module>.<fingerprint>.view", refusing a field AnswersByHoldModuleFingerprintViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByHoldModuleFingerprintViewValue(raw []byte) (AnswersByHoldModuleFingerprintViewValue, error) {
|
||||
// DecodeAnswersByHoldModuleFingerprintViewValue reads one value of the state answers under the form "hold.<module>.<fingerprint>.view" as another part wrote it: a field AnswersByHoldModuleFingerprintViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByHoldModuleFingerprintViewValue(raw []byte) (AnswersByHoldModuleFingerprintViewValue, int, error) {
|
||||
var v AnswersByHoldModuleFingerprintViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AnswersByRestoreNodeModuleFingerprintViewKey is the key of one value of the state answers under the form "restore.<node>.<module>.<fingerprint>.view".
|
||||
@@ -92,18 +96,13 @@ func ParseAnswersByRestoreNodeModuleFingerprintViewKey(key string) (string, stri
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByRestoreNodeModuleFingerprintViewValue reads one value of the state answers under the form "restore.<node>.<module>.<fingerprint>.view", refusing a field AnswersByRestoreNodeModuleFingerprintViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByRestoreNodeModuleFingerprintViewValue(raw []byte) (AnswersByRestoreNodeModuleFingerprintViewValue, error) {
|
||||
// DecodeAnswersByRestoreNodeModuleFingerprintViewValue reads one value of the state answers under the form "restore.<node>.<module>.<fingerprint>.view" as another part wrote it: a field AnswersByRestoreNodeModuleFingerprintViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByRestoreNodeModuleFingerprintViewValue(raw []byte) (AnswersByRestoreNodeModuleFingerprintViewValue, int, error) {
|
||||
var v AnswersByRestoreNodeModuleFingerprintViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AnswersByBackupNodeModuleFingerprintViewKey is the key of one value of the state answers under the form "backup.<node>.<module>.<fingerprint>.view".
|
||||
@@ -139,18 +138,13 @@ func ParseAnswersByBackupNodeModuleFingerprintViewKey(key string) (string, strin
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByBackupNodeModuleFingerprintViewValue reads one value of the state answers under the form "backup.<node>.<module>.<fingerprint>.view", refusing a field AnswersByBackupNodeModuleFingerprintViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByBackupNodeModuleFingerprintViewValue(raw []byte) (AnswersByBackupNodeModuleFingerprintViewValue, error) {
|
||||
// DecodeAnswersByBackupNodeModuleFingerprintViewValue reads one value of the state answers under the form "backup.<node>.<module>.<fingerprint>.view" as another part wrote it: a field AnswersByBackupNodeModuleFingerprintViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByBackupNodeModuleFingerprintViewValue(raw []byte) (AnswersByBackupNodeModuleFingerprintViewValue, int, error) {
|
||||
var v AnswersByBackupNodeModuleFingerprintViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AnswersByRecordNodeModuleDigestViewKey is the key of one value of the state answers under the form "record.<node>.<module>.<digest>.view".
|
||||
@@ -186,18 +180,13 @@ func ParseAnswersByRecordNodeModuleDigestViewKey(key string) (string, string, st
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByRecordNodeModuleDigestViewValue reads one value of the state answers under the form "record.<node>.<module>.<digest>.view", refusing a field AnswersByRecordNodeModuleDigestViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByRecordNodeModuleDigestViewValue(raw []byte) (AnswersByRecordNodeModuleDigestViewValue, error) {
|
||||
// DecodeAnswersByRecordNodeModuleDigestViewValue reads one value of the state answers under the form "record.<node>.<module>.<digest>.view" as another part wrote it: a field AnswersByRecordNodeModuleDigestViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByRecordNodeModuleDigestViewValue(raw []byte) (AnswersByRecordNodeModuleDigestViewValue, int, error) {
|
||||
var v AnswersByRecordNodeModuleDigestViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AnswersByOutsideNodeModuleFingerprintViewKey is the key of one value of the state answers under the form "outside.<node>.<module>.<fingerprint>.view".
|
||||
@@ -233,18 +222,13 @@ func ParseAnswersByOutsideNodeModuleFingerprintViewKey(key string) (string, stri
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByOutsideNodeModuleFingerprintViewValue reads one value of the state answers under the form "outside.<node>.<module>.<fingerprint>.view", refusing a field AnswersByOutsideNodeModuleFingerprintViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByOutsideNodeModuleFingerprintViewValue(raw []byte) (AnswersByOutsideNodeModuleFingerprintViewValue, error) {
|
||||
// DecodeAnswersByOutsideNodeModuleFingerprintViewValue reads one value of the state answers under the form "outside.<node>.<module>.<fingerprint>.view" as another part wrote it: a field AnswersByOutsideNodeModuleFingerprintViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByOutsideNodeModuleFingerprintViewValue(raw []byte) (AnswersByOutsideNodeModuleFingerprintViewValue, int, error) {
|
||||
var v AnswersByOutsideNodeModuleFingerprintViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AnswersByRevertNodeModuleFingerprintViewKey is the key of one value of the state answers under the form "revert.<node>.<module>.<fingerprint>.view".
|
||||
@@ -280,18 +264,13 @@ func ParseAnswersByRevertNodeModuleFingerprintViewKey(key string) (string, strin
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByRevertNodeModuleFingerprintViewValue reads one value of the state answers under the form "revert.<node>.<module>.<fingerprint>.view", refusing a field AnswersByRevertNodeModuleFingerprintViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByRevertNodeModuleFingerprintViewValue(raw []byte) (AnswersByRevertNodeModuleFingerprintViewValue, error) {
|
||||
// DecodeAnswersByRevertNodeModuleFingerprintViewValue reads one value of the state answers under the form "revert.<node>.<module>.<fingerprint>.view" as another part wrote it: a field AnswersByRevertNodeModuleFingerprintViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByRevertNodeModuleFingerprintViewValue(raw []byte) (AnswersByRevertNodeModuleFingerprintViewValue, int, error) {
|
||||
var v AnswersByRevertNodeModuleFingerprintViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AnswersByAssignmentsProposalViewKey is the key of one value of the state answers under the form "assignments.<proposal>.view".
|
||||
@@ -317,24 +296,21 @@ func ParseAnswersByAssignmentsProposalViewKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeAnswersByAssignmentsProposalViewValue reads one value of the state answers under the form "assignments.<proposal>.view", refusing a field AnswersByAssignmentsProposalViewValue does not know and any text after the value.
|
||||
func DecodeAnswersByAssignmentsProposalViewValue(raw []byte) (AnswersByAssignmentsProposalViewValue, error) {
|
||||
// DecodeAnswersByAssignmentsProposalViewValue reads one value of the state answers under the form "assignments.<proposal>.view" as another part wrote it: a field AnswersByAssignmentsProposalViewValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAnswersByAssignmentsProposalViewValue(raw []byte) (AnswersByAssignmentsProposalViewValue, int, error) {
|
||||
var v AnswersByAssignmentsProposalViewValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Answer is the status view's answer to an ask.
|
||||
type Answer struct {
|
||||
// the asking it answers
|
||||
Asking string `json:"asking"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the option the person chose
|
||||
Option string `json:"option"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
@@ -362,3 +338,14 @@ type AnswersByRevertNodeModuleFingerprintViewValue = Answer
|
||||
|
||||
// AnswersByAssignmentsProposalViewValue is one value of the state answers under the key assignments.<proposal>.view.
|
||||
type AnswersByAssignmentsProposalViewValue = Answer
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package meshpipelinerunner
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,17 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-pipeline-runner"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "2d4126b89f49cd84c62136ef5010ef34c41f541169e64ed2a4c7558100cc5416"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbRun = "run"
|
||||
VerbStart = "start"
|
||||
@@ -178,18 +187,13 @@ func ParsePipelinesByBranchRevisionKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodePipelinesByBranchRevisionValue reads one value of the state pipelines under the form "<branch>.<revision>", refusing a field PipelinesByBranchRevisionValue does not know and any text after the value.
|
||||
func DecodePipelinesByBranchRevisionValue(raw []byte) (PipelinesByBranchRevisionValue, error) {
|
||||
// DecodePipelinesByBranchRevisionValue reads one value of the state pipelines under the form "<branch>.<revision>" as another part wrote it: a field PipelinesByBranchRevisionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePipelinesByBranchRevisionValue(raw []byte) (PipelinesByBranchRevisionValue, int, error) {
|
||||
var v PipelinesByBranchRevisionValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PipelinesByBranchSourcePublishedPackageVersionKey is the key of one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>".
|
||||
@@ -226,18 +230,13 @@ func ParsePipelinesByBranchSourcePublishedPackageVersionKey(key string) (string,
|
||||
return v0, v2, v4, v6, true
|
||||
}
|
||||
|
||||
// DecodePipelinesByBranchSourcePublishedPackageVersionValue reads one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>", refusing a field PipelinesByBranchSourcePublishedPackageVersionValue does not know and any text after the value.
|
||||
func DecodePipelinesByBranchSourcePublishedPackageVersionValue(raw []byte) (PipelinesByBranchSourcePublishedPackageVersionValue, error) {
|
||||
// DecodePipelinesByBranchSourcePublishedPackageVersionValue reads one value of the state pipelines under the form "<branch>.<source>.published.<package>.<version>" as another part wrote it: a field PipelinesByBranchSourcePublishedPackageVersionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePipelinesByBranchSourcePublishedPackageVersionValue(raw []byte) (PipelinesByBranchSourcePublishedPackageVersionValue, int, error) {
|
||||
var v PipelinesByBranchSourcePublishedPackageVersionValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PipelinesByBranchRunRunKey is the key of one value of the state pipelines under the form "<branch>.run.<run>".
|
||||
@@ -262,18 +261,13 @@ func ParsePipelinesByBranchRunRunKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodePipelinesByBranchRunRunValue reads one value of the state pipelines under the form "<branch>.run.<run>", refusing a field PipelinesByBranchRunRunValue does not know and any text after the value.
|
||||
func DecodePipelinesByBranchRunRunValue(raw []byte) (PipelinesByBranchRunRunValue, error) {
|
||||
// DecodePipelinesByBranchRunRunValue reads one value of the state pipelines under the form "<branch>.run.<run>" as another part wrote it: a field PipelinesByBranchRunRunValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePipelinesByBranchRunRunValue(raw []byte) (PipelinesByBranchRunRunValue, int, error) {
|
||||
var v PipelinesByBranchRunRunValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PipelinesByStepsPipelineMoverKey is the key of one value of the state pipelines under the form "steps.<pipeline>.<mover>".
|
||||
@@ -304,18 +298,13 @@ func ParsePipelinesByStepsPipelineMoverKey(key string) (string, string, bool) {
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodePipelinesByStepsPipelineMoverValue reads one value of the state pipelines under the form "steps.<pipeline>.<mover>", refusing a field PipelinesByStepsPipelineMoverValue does not know and any text after the value.
|
||||
func DecodePipelinesByStepsPipelineMoverValue(raw []byte) (PipelinesByStepsPipelineMoverValue, error) {
|
||||
// DecodePipelinesByStepsPipelineMoverValue reads one value of the state pipelines under the form "steps.<pipeline>.<mover>" as another part wrote it: a field PipelinesByStepsPipelineMoverValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePipelinesByStepsPipelineMoverValue(raw []byte) (PipelinesByStepsPipelineMoverValue, int, error) {
|
||||
var v PipelinesByStepsPipelineMoverValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// QueueByQueueNextKey is the key of one value of the state queue under the form "queue.next".
|
||||
@@ -334,18 +323,13 @@ func ParseQueueByQueueNextKey(key string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// DecodeQueueByQueueNextValue reads one value of the state queue under the form "queue.next", refusing a field QueueByQueueNextValue does not know and any text after the value.
|
||||
func DecodeQueueByQueueNextValue(raw []byte) (QueueByQueueNextValue, error) {
|
||||
// DecodeQueueByQueueNextValue reads one value of the state queue under the form "queue.next" as another part wrote it: a field QueueByQueueNextValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeQueueByQueueNextValue(raw []byte) (QueueByQueueNextValue, int, error) {
|
||||
var v QueueByQueueNextValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// QueueByWaitingSequenceKey is the key of one value of the state queue under the form "waiting.<sequence>".
|
||||
@@ -369,18 +353,13 @@ func ParseQueueByWaitingSequenceKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeQueueByWaitingSequenceValue reads one value of the state queue under the form "waiting.<sequence>", refusing a field QueueByWaitingSequenceValue does not know and any text after the value.
|
||||
func DecodeQueueByWaitingSequenceValue(raw []byte) (QueueByWaitingSequenceValue, error) {
|
||||
// DecodeQueueByWaitingSequenceValue reads one value of the state queue under the form "waiting.<sequence>" as another part wrote it: a field QueueByWaitingSequenceValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeQueueByWaitingSequenceValue(raw []byte) (QueueByWaitingSequenceValue, int, error) {
|
||||
var v QueueByWaitingSequenceValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// QueueByRunningPipelineKey is the key of one value of the state queue under the form "running.<pipeline>".
|
||||
@@ -404,18 +383,13 @@ func ParseQueueByRunningPipelineKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeQueueByRunningPipelineValue reads one value of the state queue under the form "running.<pipeline>", refusing a field QueueByRunningPipelineValue does not know and any text after the value.
|
||||
func DecodeQueueByRunningPipelineValue(raw []byte) (QueueByRunningPipelineValue, error) {
|
||||
// DecodeQueueByRunningPipelineValue reads one value of the state queue under the form "running.<pipeline>" as another part wrote it: a field QueueByRunningPipelineValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeQueueByRunningPipelineValue(raw []byte) (QueueByRunningPipelineValue, int, error) {
|
||||
var v QueueByRunningPipelineValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// KeptByLevelDigestKey is the key of one value of the state kept under the form "<level>.<digest>".
|
||||
@@ -440,18 +414,13 @@ func ParseKeptByLevelDigestKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeKeptByLevelDigestValue reads one value of the state kept under the form "<level>.<digest>", refusing a field KeptByLevelDigestValue does not know and any text after the value.
|
||||
func DecodeKeptByLevelDigestValue(raw []byte) (KeptByLevelDigestValue, error) {
|
||||
// DecodeKeptByLevelDigestValue reads one value of the state kept under the form "<level>.<digest>" as another part wrote it: a field KeptByLevelDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeKeptByLevelDigestValue(raw []byte) (KeptByLevelDigestValue, int, error) {
|
||||
var v KeptByLevelDigestValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// StepLogByPipelineKey is the key of one value of the state step-log under the form "<pipeline>".
|
||||
@@ -471,18 +440,13 @@ func ParseStepLogByPipelineKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeStepLogByPipelineValue reads one value of the state step-log under the form "<pipeline>", refusing a field StepLogByPipelineValue does not know and any text after the value.
|
||||
func DecodeStepLogByPipelineValue(raw []byte) (StepLogByPipelineValue, error) {
|
||||
// DecodeStepLogByPipelineValue reads one value of the state step-log under the form "<pipeline>" as another part wrote it: a field StepLogByPipelineValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepLogByPipelineValue(raw []byte) (StepLogByPipelineValue, int, error) {
|
||||
var v StepLogByPipelineValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// StepOutputsByPipelineStepArtifactKey is the key of one value of the state step-outputs under the form "<pipeline>.<step>.<artifact>".
|
||||
@@ -514,18 +478,13 @@ func ParseStepOutputsByPipelineStepArtifactKey(key string) (string, string, stri
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeStepOutputsByPipelineStepArtifactValue reads one value of the state step-outputs under the form "<pipeline>.<step>.<artifact>", refusing a field StepOutputsByPipelineStepArtifactValue does not know and any text after the value.
|
||||
func DecodeStepOutputsByPipelineStepArtifactValue(raw []byte) (StepOutputsByPipelineStepArtifactValue, error) {
|
||||
// DecodeStepOutputsByPipelineStepArtifactValue reads one value of the state step-outputs under the form "<pipeline>.<step>.<artifact>" as another part wrote it: a field StepOutputsByPipelineStepArtifactValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepOutputsByPipelineStepArtifactValue(raw []byte) (StepOutputsByPipelineStepArtifactValue, int, error) {
|
||||
var v StepOutputsByPipelineStepArtifactValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Accepted is a failed optional step a person accepted, recorded in the hand-act log.
|
||||
@@ -542,6 +501,8 @@ type Fill struct {
|
||||
Bytes int64 `json:"bytes"`
|
||||
// bytes
|
||||
Cap int64 `json:"cap"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the kept data, by its name in the holder's manifest
|
||||
Store string `json:"store"`
|
||||
}
|
||||
@@ -550,6 +511,8 @@ type Fill struct {
|
||||
type KeptResult struct {
|
||||
// sha256:<hex> of what the package's tests read
|
||||
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"`
|
||||
// when a carry last read it: the runner ages it 30 days after (design 47 G section 330)
|
||||
LastRead *time.Time `json:"last-read,omitempty"`
|
||||
// unit or integration
|
||||
@@ -564,6 +527,8 @@ type KeptResult struct {
|
||||
type LogEntry struct {
|
||||
Artifact string `json:"artifact,omitempty"`
|
||||
At time.Time `json:"at"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the keys of the kept results the step wrote or carried, <level>.<digest>, which the runner ages by their last-read (design 47 G sections 330, 470)
|
||||
Kept []string `json:"kept,omitempty"`
|
||||
// the module of the mover whose step the entry is of (H-A-190)
|
||||
@@ -665,6 +630,8 @@ type Pipeline struct {
|
||||
// how often the pipeline has ended: 1 at its first end, one higher at each end again after a passing rerun, so the assigner takes a later end of the same source revision (design 47 G sections 29, 325)
|
||||
EndCount int64 `json:"end-count,omitempty"`
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// how many movers the pipeline has, set by list alone (H-A-191)
|
||||
MoverCount int64 `json:"mover-count,omitempty"`
|
||||
// the modules the pipeline moves, its take-in's entries (design 47 H §746)
|
||||
@@ -717,6 +684,8 @@ type PipelineEnded struct {
|
||||
// how often the pipeline has ended: 1 at its first end, one higher at each end again after a passing rerun, so the assigner takes a later end of the same source revision (design 47 G sections 29, 325)
|
||||
EndCount int64 `json:"end-count,omitempty"`
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// per mover its fingerprint, released version, step results and tier, in the delivery order (design 47 H §746, H-A-2)
|
||||
Movers []MoverEnded `json:"movers"`
|
||||
Outcome string `json:"outcome"`
|
||||
@@ -751,6 +720,8 @@ type PipelineStarted struct {
|
||||
Branch string `json:"branch"`
|
||||
// the merge call whose source revision the take-in took in (design 47 H §746)
|
||||
Call string `json:"call,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 pipeline's movers
|
||||
Movers []Mover `json:"movers"`
|
||||
// the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
|
||||
@@ -778,7 +749,9 @@ type Published struct {
|
||||
type RunStarted struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// the caller the runtime proved
|
||||
By string `json:"by"`
|
||||
By string `json:"by"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Members []Member `json:"members"`
|
||||
Run string `json:"run"`
|
||||
V int64 `json:"v"`
|
||||
@@ -813,7 +786,9 @@ type StepEvent struct {
|
||||
Commit string `json:"commit"`
|
||||
// the module's build-input fingerprint at the commit
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
Module string `json:"module"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Module string `json:"module"`
|
||||
// the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
|
||||
Pipeline string `json:"pipeline"`
|
||||
Result StepResult `json:"result"`
|
||||
@@ -977,6 +952,8 @@ type Wait struct {
|
||||
Commit string `json:"commit,omitempty"`
|
||||
// the module's build-input fingerprint at the commit
|
||||
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"`
|
||||
// for its end, how it ended: answered, ran, superseded
|
||||
How string `json:"how,omitempty"`
|
||||
// for a step's wait, the mover whose step waits (design 47 H-A-72)
|
||||
@@ -1024,6 +1001,8 @@ const (
|
||||
|
||||
// Waiting is a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72).
|
||||
type Waiting 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 pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747)
|
||||
Pipeline string `json:"pipeline"`
|
||||
}
|
||||
@@ -1054,6 +1033,8 @@ type RunInput struct {
|
||||
|
||||
// RunAnswer is what run answers.
|
||||
type RunAnswer 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 pipelines' keys
|
||||
Pipelines []string `json:"pipelines,omitempty"`
|
||||
Run string `json:"run"`
|
||||
@@ -1069,6 +1050,8 @@ type StartInput struct {
|
||||
|
||||
// StartAnswer is what start answers.
|
||||
type StartAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipeline string `json:"pipeline"`
|
||||
}
|
||||
|
||||
@@ -1082,7 +1065,9 @@ type ShowInput struct {
|
||||
|
||||
// ShowAnswer is what show answers.
|
||||
type ShowAnswer struct {
|
||||
Fill []Fill `json:"fill,omitempty"`
|
||||
Fill []Fill `json:"fill,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Log []LogEntry `json:"log,omitempty"`
|
||||
// the outputs' names in step-outputs
|
||||
Outputs []string `json:"outputs,omitempty"`
|
||||
@@ -1100,7 +1085,9 @@ type ListInput struct {
|
||||
|
||||
// ListAnswer is what list answers.
|
||||
type ListAnswer struct {
|
||||
Fill *Fill `json:"fill,omitempty"`
|
||||
Fill *Fill `json:"fill,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipelines []Pipeline `json:"pipelines"`
|
||||
}
|
||||
|
||||
@@ -1110,6 +1097,8 @@ type StandsInput struct {
|
||||
|
||||
// StandsAnswer is what stands answers.
|
||||
type StandsAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Stands []Wait `json:"stands"`
|
||||
}
|
||||
|
||||
@@ -1135,8 +1124,10 @@ const (
|
||||
|
||||
// WhyCarriedAnswer is what why-carried answers.
|
||||
type WhyCarriedAnswer struct {
|
||||
CarriedFrom string `json:"carried-from,omitempty"`
|
||||
Kept []KeptResult `json:"kept,omitempty"`
|
||||
CarriedFrom string `json:"carried-from,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Kept []KeptResult `json:"kept,omitempty"`
|
||||
}
|
||||
|
||||
// KeptInput is what kept takes.
|
||||
@@ -1148,7 +1139,9 @@ type KeptInput struct {
|
||||
|
||||
// KeptAnswer is what kept answers.
|
||||
type KeptAnswer struct {
|
||||
Fill *Fill `json:"fill,omitempty"`
|
||||
Fill *Fill `json:"fill,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Kept []KeptResult `json:"kept"`
|
||||
}
|
||||
|
||||
@@ -1170,6 +1163,8 @@ const (
|
||||
|
||||
// ReviewAnswer is what review answers.
|
||||
type ReviewAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipeline string `json:"pipeline,omitempty"`
|
||||
Result StepResult `json:"result"`
|
||||
}
|
||||
@@ -1200,6 +1195,8 @@ const (
|
||||
|
||||
// RerunAnswer is what rerun answers.
|
||||
type RerunAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipeline string `json:"pipeline"`
|
||||
Result *StepResult `json:"result,omitempty"`
|
||||
}
|
||||
@@ -1230,6 +1227,8 @@ const (
|
||||
|
||||
// AcceptAnswer is what accept answers.
|
||||
type AcceptAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Result StepResult `json:"result"`
|
||||
}
|
||||
|
||||
@@ -1243,6 +1242,8 @@ type CancelInput struct {
|
||||
|
||||
// CancelAnswer is what cancel answers.
|
||||
type CancelAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipeline Pipeline `json:"pipeline"`
|
||||
}
|
||||
|
||||
@@ -1256,6 +1257,8 @@ type EndAgainInput struct {
|
||||
|
||||
// EndAgainAnswer is what end-again answers.
|
||||
type EndAgainAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipeline Pipeline `json:"pipeline"`
|
||||
}
|
||||
|
||||
@@ -1269,6 +1272,8 @@ type PlaceInput struct {
|
||||
|
||||
// PlaceAnswer is what place answers.
|
||||
type PlaceAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Pipeline Pipeline `json:"pipeline"`
|
||||
}
|
||||
|
||||
@@ -1284,6 +1289,8 @@ type AskAgainInput struct {
|
||||
|
||||
// AskAgainAnswer is what ask-again answers.
|
||||
type AskAgainAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Result StepResult `json:"result"`
|
||||
}
|
||||
|
||||
@@ -1305,7 +1312,9 @@ const (
|
||||
|
||||
// TestRunsAnswer is what test-runs answers.
|
||||
type TestRunsAnswer struct {
|
||||
Fill Fill `json:"fill"`
|
||||
Fill Fill `json:"fill"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Runs []TestRun `json:"runs"`
|
||||
}
|
||||
|
||||
@@ -1321,6 +1330,8 @@ type TestRunsDropInput struct {
|
||||
type TestRunsDropAnswer struct {
|
||||
// the readers it ended
|
||||
Ended []TestRunReader `json:"ended,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 entry deleted
|
||||
Run TestRun `json:"run"`
|
||||
}
|
||||
@@ -1366,6 +1377,8 @@ type PipelinesByBranchRunRunValue = Pipeline
|
||||
|
||||
// PipelinesByStepsPipelineMoverValue is one value of the state pipelines under the key steps.<pipeline>.<mover>.
|
||||
type PipelinesByStepsPipelineMoverValue 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 mover's steps
|
||||
Steps []StepResult `json:"steps"`
|
||||
// the step-log entries of the mover's steps that ended and are not appended to the step log yet, in order (H-A-189)
|
||||
@@ -1380,6 +1393,8 @@ type QueueByWaitingSequenceValue = Waiting
|
||||
|
||||
// QueueByRunningPipelineValue is one value of the state queue under the key running.<pipeline>.
|
||||
type QueueByRunningPipelineValue 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 pipeline's key, as the key names it
|
||||
Pipeline string `json:"pipeline"`
|
||||
}
|
||||
@@ -1392,3 +1407,248 @@ type StepLogByPipelineValue = LogEntry
|
||||
|
||||
// StepOutputsByPipelineStepArtifactValue is one value of the state step-outputs under the key <pipeline>.<step>.<artifact>.
|
||||
type StepOutputsByPipelineStepArtifactValue = string
|
||||
|
||||
// DecodeRunAnswer reads a RunAnswer 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 DecodeRunAnswer(raw []byte) (RunAnswer, int, error) {
|
||||
var v RunAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStartAnswer reads a StartAnswer 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 DecodeStartAnswer(raw []byte) (StartAnswer, int, error) {
|
||||
var v StartAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeShowAnswer reads a ShowAnswer 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 DecodeShowAnswer(raw []byte) (ShowAnswer, int, error) {
|
||||
var v ShowAnswer
|
||||
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
|
||||
}
|
||||
|
||||
// DecodeStandsAnswer reads a StandsAnswer 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 DecodeStandsAnswer(raw []byte) (StandsAnswer, int, error) {
|
||||
var v StandsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWhyCarriedAnswer reads a WhyCarriedAnswer 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 DecodeWhyCarriedAnswer(raw []byte) (WhyCarriedAnswer, int, error) {
|
||||
var v WhyCarriedAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeKeptAnswer reads a KeptAnswer 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 DecodeKeptAnswer(raw []byte) (KeptAnswer, int, error) {
|
||||
var v KeptAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeReviewAnswer reads a ReviewAnswer 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 DecodeReviewAnswer(raw []byte) (ReviewAnswer, int, error) {
|
||||
var v ReviewAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRerunAnswer reads a RerunAnswer 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 DecodeRerunAnswer(raw []byte) (RerunAnswer, int, error) {
|
||||
var v RerunAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeAcceptAnswer reads a AcceptAnswer 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 DecodeAcceptAnswer(raw []byte) (AcceptAnswer, int, error) {
|
||||
var v AcceptAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeCancelAnswer reads a CancelAnswer 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 DecodeCancelAnswer(raw []byte) (CancelAnswer, int, error) {
|
||||
var v CancelAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeEndAgainAnswer reads a EndAgainAnswer 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 DecodeEndAgainAnswer(raw []byte) (EndAgainAnswer, int, error) {
|
||||
var v EndAgainAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePlaceAnswer reads a PlaceAnswer 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 DecodePlaceAnswer(raw []byte) (PlaceAnswer, int, error) {
|
||||
var v PlaceAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeAskAgainAnswer reads a AskAgainAnswer 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 DecodeAskAgainAnswer(raw []byte) (AskAgainAnswer, int, error) {
|
||||
var v AskAgainAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeTestRunsAnswer reads a TestRunsAnswer 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 DecodeTestRunsAnswer(raw []byte) (TestRunsAnswer, int, error) {
|
||||
var v TestRunsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeTestRunsDropAnswer reads a TestRunsDropAnswer 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 DecodeTestRunsDropAnswer(raw []byte) (TestRunsDropAnswer, int, error) {
|
||||
var v TestRunsDropAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePipelineStartedEvent reads a PipelineStartedEvent 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 DecodePipelineStartedEvent(raw []byte) (PipelineStartedEvent, int, error) {
|
||||
var v PipelineStartedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePipelineEndedEvent reads a PipelineEndedEvent 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 DecodePipelineEndedEvent(raw []byte) (PipelineEndedEvent, int, error) {
|
||||
var v PipelineEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRunStartedEvent reads a RunStartedEvent 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 DecodeRunStartedEvent(raw []byte) (RunStartedEvent, int, error) {
|
||||
var v RunStartedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepStartedEvent reads a StepStartedEvent 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 DecodeStepStartedEvent(raw []byte) (StepStartedEvent, int, error) {
|
||||
var v StepStartedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepEndedEvent reads a StepEndedEvent 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 DecodeStepEndedEvent(raw []byte) (StepEndedEvent, int, error) {
|
||||
var v StepEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWaitHeldEvent reads a WaitHeldEvent 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 DecodeWaitHeldEvent(raw []byte) (WaitHeldEvent, int, error) {
|
||||
var v WaitHeldEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWaitEndedEvent reads a WaitEndedEvent 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 DecodeWaitEndedEvent(raw []byte) (WaitEndedEvent, int, error) {
|
||||
var v WaitEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFillingEvent reads a FillingEvent 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 DecodeFillingEvent(raw []byte) (FillingEvent, int, error) {
|
||||
var v FillingEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFullEvent reads a FullEvent 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 DecodeFullEvent(raw []byte) (FullEvent, int, error) {
|
||||
var v FullEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRoomEvent reads a RoomEvent 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 DecodeRoomEvent(raw []byte) (RoomEvent, int, error) {
|
||||
var v RoomEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package meshwants
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,17 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "mesh-wants"
|
||||
|
||||
// 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
|
||||
|
||||
// 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"
|
||||
generatedFieldsDigest = "280599cf6fa081300f8fc5d858a3798579b46dc38604d0087f33fb3f00945b4d"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbUpgrade = "upgrade"
|
||||
VerbBus = "bus"
|
||||
@@ -160,18 +169,13 @@ func ParseWantsByWantNodeModuleKey(key string) (string, string, bool) {
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodeWantsByWantNodeModuleValue reads one value of the state wants under the form "want.<node>.<module>", refusing a field WantsByWantNodeModuleValue does not know and any text after the value.
|
||||
func DecodeWantsByWantNodeModuleValue(raw []byte) (WantsByWantNodeModuleValue, error) {
|
||||
// DecodeWantsByWantNodeModuleValue reads one value of the state wants under the form "want.<node>.<module>" as another part wrote it: a field WantsByWantNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeWantsByWantNodeModuleValue(raw []byte) (WantsByWantNodeModuleValue, int, error) {
|
||||
var v WantsByWantNodeModuleValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// WantsByWantNodeNodeKey is the key of one value of the state wants under the form "want.<node>.node".
|
||||
@@ -195,18 +199,13 @@ func ParseWantsByWantNodeNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeWantsByWantNodeNodeValue reads one value of the state wants under the form "want.<node>.node", refusing a field WantsByWantNodeNodeValue does not know and any text after the value.
|
||||
func DecodeWantsByWantNodeNodeValue(raw []byte) (WantsByWantNodeNodeValue, error) {
|
||||
// DecodeWantsByWantNodeNodeValue reads one value of the state wants under the form "want.<node>.node" as another part wrote it: a field WantsByWantNodeNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeWantsByWantNodeNodeValue(raw []byte) (WantsByWantNodeNodeValue, int, error) {
|
||||
var v WantsByWantNodeNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// WantsByHeldModuleFingerprintKey is the key of one value of the state wants under the form "held.<module>.<fingerprint>".
|
||||
@@ -237,18 +236,13 @@ func ParseWantsByHeldModuleFingerprintKey(key string) (string, string, bool) {
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodeWantsByHeldModuleFingerprintValue reads one value of the state wants under the form "held.<module>.<fingerprint>", refusing a field WantsByHeldModuleFingerprintValue does not know and any text after the value.
|
||||
func DecodeWantsByHeldModuleFingerprintValue(raw []byte) (WantsByHeldModuleFingerprintValue, error) {
|
||||
// DecodeWantsByHeldModuleFingerprintValue reads one value of the state wants under the form "held.<module>.<fingerprint>" as another part wrote it: a field WantsByHeldModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeWantsByHeldModuleFingerprintValue(raw []byte) (WantsByHeldModuleFingerprintValue, int, error) {
|
||||
var v WantsByHeldModuleFingerprintValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByHoldModuleFingerprintKey is the key of one value of the state asks under the form "hold.<module>.<fingerprint>".
|
||||
@@ -279,18 +273,13 @@ func ParseAsksByHoldModuleFingerprintKey(key string) (string, string, bool) {
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodeAsksByHoldModuleFingerprintValue reads one value of the state asks under the form "hold.<module>.<fingerprint>", refusing a field AsksByHoldModuleFingerprintValue does not know and any text after the value.
|
||||
func DecodeAsksByHoldModuleFingerprintValue(raw []byte) (AsksByHoldModuleFingerprintValue, error) {
|
||||
// DecodeAsksByHoldModuleFingerprintValue reads one value of the state asks under the form "hold.<module>.<fingerprint>" as another part wrote it: a field AsksByHoldModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByHoldModuleFingerprintValue(raw []byte) (AsksByHoldModuleFingerprintValue, int, error) {
|
||||
var v AsksByHoldModuleFingerprintValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByRestoreNodeModuleFingerprintKey is the key of one value of the state asks under the form "restore.<node>.<module>.<fingerprint>".
|
||||
@@ -326,18 +315,13 @@ func ParseAsksByRestoreNodeModuleFingerprintKey(key string) (string, string, str
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAsksByRestoreNodeModuleFingerprintValue reads one value of the state asks under the form "restore.<node>.<module>.<fingerprint>", refusing a field AsksByRestoreNodeModuleFingerprintValue does not know and any text after the value.
|
||||
func DecodeAsksByRestoreNodeModuleFingerprintValue(raw []byte) (AsksByRestoreNodeModuleFingerprintValue, error) {
|
||||
// DecodeAsksByRestoreNodeModuleFingerprintValue reads one value of the state asks under the form "restore.<node>.<module>.<fingerprint>" as another part wrote it: a field AsksByRestoreNodeModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByRestoreNodeModuleFingerprintValue(raw []byte) (AsksByRestoreNodeModuleFingerprintValue, int, error) {
|
||||
var v AsksByRestoreNodeModuleFingerprintValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByBackupNodeModuleFingerprintKey is the key of one value of the state asks under the form "backup.<node>.<module>.<fingerprint>".
|
||||
@@ -373,18 +357,13 @@ func ParseAsksByBackupNodeModuleFingerprintKey(key string) (string, string, stri
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAsksByBackupNodeModuleFingerprintValue reads one value of the state asks under the form "backup.<node>.<module>.<fingerprint>", refusing a field AsksByBackupNodeModuleFingerprintValue does not know and any text after the value.
|
||||
func DecodeAsksByBackupNodeModuleFingerprintValue(raw []byte) (AsksByBackupNodeModuleFingerprintValue, error) {
|
||||
// DecodeAsksByBackupNodeModuleFingerprintValue reads one value of the state asks under the form "backup.<node>.<module>.<fingerprint>" as another part wrote it: a field AsksByBackupNodeModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByBackupNodeModuleFingerprintValue(raw []byte) (AsksByBackupNodeModuleFingerprintValue, int, error) {
|
||||
var v AsksByBackupNodeModuleFingerprintValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByRecordNodeModuleDigestKey is the key of one value of the state asks under the form "record.<node>.<module>.<digest>".
|
||||
@@ -420,18 +399,13 @@ func ParseAsksByRecordNodeModuleDigestKey(key string) (string, string, string, b
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAsksByRecordNodeModuleDigestValue reads one value of the state asks under the form "record.<node>.<module>.<digest>", refusing a field AsksByRecordNodeModuleDigestValue does not know and any text after the value.
|
||||
func DecodeAsksByRecordNodeModuleDigestValue(raw []byte) (AsksByRecordNodeModuleDigestValue, error) {
|
||||
// DecodeAsksByRecordNodeModuleDigestValue reads one value of the state asks under the form "record.<node>.<module>.<digest>" as another part wrote it: a field AsksByRecordNodeModuleDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByRecordNodeModuleDigestValue(raw []byte) (AsksByRecordNodeModuleDigestValue, int, error) {
|
||||
var v AsksByRecordNodeModuleDigestValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByOutsideNodeModuleFingerprintKey is the key of one value of the state asks under the form "outside.<node>.<module>.<fingerprint>".
|
||||
@@ -467,18 +441,13 @@ func ParseAsksByOutsideNodeModuleFingerprintKey(key string) (string, string, str
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAsksByOutsideNodeModuleFingerprintValue reads one value of the state asks under the form "outside.<node>.<module>.<fingerprint>", refusing a field AsksByOutsideNodeModuleFingerprintValue does not know and any text after the value.
|
||||
func DecodeAsksByOutsideNodeModuleFingerprintValue(raw []byte) (AsksByOutsideNodeModuleFingerprintValue, error) {
|
||||
// DecodeAsksByOutsideNodeModuleFingerprintValue reads one value of the state asks under the form "outside.<node>.<module>.<fingerprint>" as another part wrote it: a field AsksByOutsideNodeModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByOutsideNodeModuleFingerprintValue(raw []byte) (AsksByOutsideNodeModuleFingerprintValue, int, error) {
|
||||
var v AsksByOutsideNodeModuleFingerprintValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByRevertNodeModuleFingerprintKey is the key of one value of the state asks under the form "revert.<node>.<module>.<fingerprint>".
|
||||
@@ -514,18 +483,13 @@ func ParseAsksByRevertNodeModuleFingerprintKey(key string) (string, string, stri
|
||||
return v1, v3, v5, true
|
||||
}
|
||||
|
||||
// DecodeAsksByRevertNodeModuleFingerprintValue reads one value of the state asks under the form "revert.<node>.<module>.<fingerprint>", refusing a field AsksByRevertNodeModuleFingerprintValue does not know and any text after the value.
|
||||
func DecodeAsksByRevertNodeModuleFingerprintValue(raw []byte) (AsksByRevertNodeModuleFingerprintValue, error) {
|
||||
// DecodeAsksByRevertNodeModuleFingerprintValue reads one value of the state asks under the form "revert.<node>.<module>.<fingerprint>" as another part wrote it: a field AsksByRevertNodeModuleFingerprintValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByRevertNodeModuleFingerprintValue(raw []byte) (AsksByRevertNodeModuleFingerprintValue, int, error) {
|
||||
var v AsksByRevertNodeModuleFingerprintValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AsksByAssignmentsProposalKey is the key of one value of the state asks under the form "assignments.<proposal>".
|
||||
@@ -549,18 +513,13 @@ func ParseAsksByAssignmentsProposalKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeAsksByAssignmentsProposalValue reads one value of the state asks under the form "assignments.<proposal>", refusing a field AsksByAssignmentsProposalValue does not know and any text after the value.
|
||||
func DecodeAsksByAssignmentsProposalValue(raw []byte) (AsksByAssignmentsProposalValue, error) {
|
||||
// DecodeAsksByAssignmentsProposalValue reads one value of the state asks under the form "assignments.<proposal>" as another part wrote it: a field AsksByAssignmentsProposalValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAsksByAssignmentsProposalValue(raw []byte) (AsksByAssignmentsProposalValue, int, error) {
|
||||
var v AsksByAssignmentsProposalValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DifferencesByNodeModuleKey is the key of one value of the state differences under the form "<node>.<module>".
|
||||
@@ -585,18 +544,13 @@ func ParseDifferencesByNodeModuleKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeDifferencesByNodeModuleValue reads one value of the state differences under the form "<node>.<module>", refusing a field DifferencesByNodeModuleValue does not know and any text after the value.
|
||||
func DecodeDifferencesByNodeModuleValue(raw []byte) (DifferencesByNodeModuleValue, error) {
|
||||
// DecodeDifferencesByNodeModuleValue reads one value of the state differences under the form "<node>.<module>" as another part wrote it: a field DifferencesByNodeModuleValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeDifferencesByNodeModuleValue(raw []byte) (DifferencesByNodeModuleValue, int, error) {
|
||||
var v DifferencesByNodeModuleValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// CompositionsByGroupHeadsKey is the key of one value of the state compositions under the form "<group>.<heads>".
|
||||
@@ -621,18 +575,13 @@ func ParseCompositionsByGroupHeadsKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeCompositionsByGroupHeadsValue reads one value of the state compositions under the form "<group>.<heads>", refusing a field CompositionsByGroupHeadsValue does not know and any text after the value.
|
||||
func DecodeCompositionsByGroupHeadsValue(raw []byte) (CompositionsByGroupHeadsValue, error) {
|
||||
// DecodeCompositionsByGroupHeadsValue reads one value of the state compositions under the form "<group>.<heads>" as another part wrote it: a field CompositionsByGroupHeadsValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeCompositionsByGroupHeadsValue(raw []byte) (CompositionsByGroupHeadsValue, int, error) {
|
||||
var v CompositionsByGroupHeadsValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AssignmentRevisionsByTrunkRevisionKey is the key of one value of the state assignment-revisions under the form "trunk.<revision>".
|
||||
@@ -656,18 +605,13 @@ func ParseAssignmentRevisionsByTrunkRevisionKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeAssignmentRevisionsByTrunkRevisionValue reads one value of the state assignment-revisions under the form "trunk.<revision>", refusing a field AssignmentRevisionsByTrunkRevisionValue does not know and any text after the value.
|
||||
func DecodeAssignmentRevisionsByTrunkRevisionValue(raw []byte) (AssignmentRevisionsByTrunkRevisionValue, error) {
|
||||
// DecodeAssignmentRevisionsByTrunkRevisionValue reads one value of the state assignment-revisions under the form "trunk.<revision>" as another part wrote it: a field AssignmentRevisionsByTrunkRevisionValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAssignmentRevisionsByTrunkRevisionValue(raw []byte) (AssignmentRevisionsByTrunkRevisionValue, int, error) {
|
||||
var v AssignmentRevisionsByTrunkRevisionValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AssignmentRevisionsByCandidateGroupHeadsKey is the key of one value of the state assignment-revisions under the form "candidate.<group>.<heads>".
|
||||
@@ -698,18 +642,13 @@ func ParseAssignmentRevisionsByCandidateGroupHeadsKey(key string) (string, strin
|
||||
return v1, v3, true
|
||||
}
|
||||
|
||||
// DecodeAssignmentRevisionsByCandidateGroupHeadsValue reads one value of the state assignment-revisions under the form "candidate.<group>.<heads>", refusing a field AssignmentRevisionsByCandidateGroupHeadsValue does not know and any text after the value.
|
||||
func DecodeAssignmentRevisionsByCandidateGroupHeadsValue(raw []byte) (AssignmentRevisionsByCandidateGroupHeadsValue, error) {
|
||||
// DecodeAssignmentRevisionsByCandidateGroupHeadsValue reads one value of the state assignment-revisions under the form "candidate.<group>.<heads>" as another part wrote it: a field AssignmentRevisionsByCandidateGroupHeadsValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAssignmentRevisionsByCandidateGroupHeadsValue(raw []byte) (AssignmentRevisionsByCandidateGroupHeadsValue, int, error) {
|
||||
var v AssignmentRevisionsByCandidateGroupHeadsValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AssignmentRevisionsByEntryDigestKey is the key of one value of the state assignment-revisions under the form "entry.<digest>".
|
||||
@@ -733,18 +672,13 @@ func ParseAssignmentRevisionsByEntryDigestKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodeAssignmentRevisionsByEntryDigestValue reads one value of the state assignment-revisions under the form "entry.<digest>", refusing a field AssignmentRevisionsByEntryDigestValue does not know and any text after the value.
|
||||
func DecodeAssignmentRevisionsByEntryDigestValue(raw []byte) (AssignmentRevisionsByEntryDigestValue, error) {
|
||||
// DecodeAssignmentRevisionsByEntryDigestValue reads one value of the state assignment-revisions under the form "entry.<digest>" as another part wrote it: a field AssignmentRevisionsByEntryDigestValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeAssignmentRevisionsByEntryDigestValue(raw []byte) (AssignmentRevisionsByEntryDigestValue, int, error) {
|
||||
var v AssignmentRevisionsByEntryDigestValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Ask is an ask the assigner puts to a person: the router's ask whole, as the assigner composes it, and how many times it was written at its key.
|
||||
@@ -753,7 +687,9 @@ type Ask struct {
|
||||
Ask map[string]any `json:"ask"`
|
||||
// the times the assigner wrote the ask at this key: 0 or 1 for the first, n for the n-th
|
||||
Asking int64 `json:"asking,omitempty"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
}
|
||||
|
||||
// AssignmentEntry is one module version on a node of an assignment graph revision, stored once by its digest (ADR 0656).
|
||||
@@ -763,6 +699,8 @@ type AssignmentEntry struct {
|
||||
// the digest of its catalog graph entry
|
||||
Catalog string `json:"catalog"`
|
||||
Edges []Edge `json:"edges,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 fingerprint it is to run
|
||||
Fp string `json:"fp"`
|
||||
// the requirements no step of the order resolves (design 47 G section 357): the entry is held, naming the candidates, and nothing is guessed
|
||||
@@ -793,8 +731,10 @@ type AssignmentRevision struct {
|
||||
// what made it: catalog-revision, placement-changed or capabilities-changed
|
||||
Cause string `json:"cause,omitempty"`
|
||||
Entries []NodeEntryRef `json:"entries"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
// trunk or candidate
|
||||
Kind string `json:"kind"`
|
||||
// the digest of the placements it was computed from
|
||||
@@ -921,6 +861,8 @@ type DifferenceRefusedItem struct {
|
||||
// Difference is two assignment graph revisions compared: a change's delivery, with its order read off the edges and no plan stored (ADR 0656).
|
||||
type Difference struct {
|
||||
Changes []Change `json:"changes"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the revision compared from
|
||||
From int64 `json:"from"`
|
||||
Group string `json:"group,omitempty"`
|
||||
@@ -959,6 +901,8 @@ type Fill struct {
|
||||
Bytes int64 `json:"bytes"`
|
||||
// bytes
|
||||
Cap int64 `json:"cap"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// what full refuses
|
||||
Refused string `json:"refused,omitempty"`
|
||||
// the kept data, by its name in the holder's manifest
|
||||
@@ -998,6 +942,8 @@ type NotRunning struct {
|
||||
// PipelineWanted is a pipeline's wants written to the end, said once: running when every tier's movers run on every present placing machine, tier-late when a tier passed tier-bound (design 47 H §751, H-A-56, H-A-72, H-A-75).
|
||||
type PipelineWanted struct {
|
||||
Branch string `json:"branch"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// for tier-late, the late tier's movers not running and the machines they do not run on
|
||||
NotRunning []NotRunning `json:"not-running,omitempty"`
|
||||
Outcome string `json:"outcome"`
|
||||
@@ -1042,6 +988,8 @@ type StepEnded struct {
|
||||
Commit string `json:"commit"`
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the ask's id
|
||||
ID string `json:"id"`
|
||||
Module string `json:"module"`
|
||||
@@ -1119,7 +1067,9 @@ type Wait struct {
|
||||
ClockFrom *time.Time `json:"clock-from,omitempty"`
|
||||
// a put's wait: the fingerprint of the build put
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
Fp string `json:"fp,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Fp string `json:"fp,omitempty"`
|
||||
// on wait-ended: ran, released or superseded
|
||||
How string `json:"how,omitempty"`
|
||||
// a dependent's delivery wait: the machines the dependency's version has yet to reach
|
||||
@@ -1199,6 +1149,8 @@ type RevisionInput struct {
|
||||
|
||||
// RevisionAnswer is what revision answers.
|
||||
type RevisionAnswer struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Revision AssignmentRevision `json:"revision"`
|
||||
}
|
||||
|
||||
@@ -1219,6 +1171,8 @@ type EntryInput struct {
|
||||
type EntryAnswer struct {
|
||||
Digest string `json:"digest"`
|
||||
Entry AssignmentEntry `json:"entry"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
}
|
||||
|
||||
// DifferenceInput is what difference takes.
|
||||
@@ -1246,6 +1200,8 @@ type InputAnswer struct {
|
||||
Chunks int64 `json:"chunks"`
|
||||
// the input's sha256
|
||||
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"`
|
||||
}
|
||||
|
||||
// CompositionsInput is what compositions takes.
|
||||
@@ -1257,7 +1213,9 @@ type CompositionsInput struct {
|
||||
|
||||
// CompositionsAnswer is what compositions answers.
|
||||
type CompositionsAnswer struct {
|
||||
Fill Fill `json:"fill"`
|
||||
Fill Fill `json:"fill"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Runs []CompositionRun `json:"runs"`
|
||||
}
|
||||
|
||||
@@ -1274,6 +1232,8 @@ type CompositionsDropInput struct {
|
||||
type CompositionsDropAnswer struct {
|
||||
// the readers it ended
|
||||
Ended []CompositionReader `json:"ended,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 entry deleted
|
||||
Run CompositionRun `json:"run"`
|
||||
}
|
||||
@@ -1290,32 +1250,38 @@ type AssignmentRevisionEvent struct {
|
||||
// the catalog graph revision of each watched branch a placement names, which the entries come from
|
||||
Catalogs []CatalogOf `json:"catalogs"`
|
||||
Cause string `json:"cause,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
Kind string `json:"kind"`
|
||||
Revision int64 `json:"revision"`
|
||||
V int64 `json:"v"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
Kind string `json:"kind"`
|
||||
Revision int64 `json:"revision"`
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// DifferenceEvent is the body of the event difference.
|
||||
type DifferenceEvent struct {
|
||||
// how many module versions it changes
|
||||
Changes int64 `json:"changes,omitempty"`
|
||||
From int64 `json:"from"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
Nodes []string `json:"nodes,omitempty"`
|
||||
Source int64 `json:"source,omitempty"`
|
||||
To int64 `json:"to"`
|
||||
V int64 `json:"v"`
|
||||
Changes int64 `json:"changes,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
From int64 `json:"from"`
|
||||
Group string `json:"group,omitempty"`
|
||||
Heads string `json:"heads,omitempty"`
|
||||
Nodes []string `json:"nodes,omitempty"`
|
||||
Source int64 `json:"source,omitempty"`
|
||||
To int64 `json:"to"`
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// WantedEvent is the body of the event wanted.
|
||||
type WantedEvent struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fp string `json:"fp"`
|
||||
Module string `json:"module"`
|
||||
Node string `json:"node"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Fp string `json:"fp"`
|
||||
Module string `json:"module"`
|
||||
Node string `json:"node"`
|
||||
// the pipeline whose passed end the want was written from, its key <branch>.<source>; absent for a placement's build (design 47 H-A-56)
|
||||
Pipeline string `json:"pipeline,omitempty"`
|
||||
// true when the assigner removes the want of that node and module (the node left, or the module was unplaced); fp is then the fingerprint last wanted there (design 47 G section 693)
|
||||
@@ -1351,7 +1317,9 @@ type StepProgressEvent struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
Phase string `json:"phase"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Phase string `json:"phase"`
|
||||
// the composition runs the step waits on, by machine, each with its ask (design 47 G §723, §729)
|
||||
Shared []Shared `json:"shared,omitempty"`
|
||||
}
|
||||
@@ -1368,8 +1336,10 @@ const (
|
||||
type WantsByWantNodeModuleValue struct {
|
||||
// again or skip
|
||||
Backup string `json:"backup,omitempty"`
|
||||
Fp string `json:"fp,omitempty"`
|
||||
Hold bool `json:"hold,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Fp string `json:"fp,omitempty"`
|
||||
Hold bool `json:"hold,omitempty"`
|
||||
// the pipeline whose passed end released the version, its key <branch>.<source>; absent for a placement's build (design 47 H §750, H-A-37)
|
||||
Pipeline string `json:"pipeline,omitempty"`
|
||||
Put bool `json:"put,omitempty"`
|
||||
@@ -1401,13 +1371,17 @@ const (
|
||||
// WantsByWantNodeNodeValue is one value of the state wants under the key want.<node>.node.
|
||||
type WantsByWantNodeNodeValue struct {
|
||||
Composed string `json:"composed"`
|
||||
Self bool `json:"self,omitempty"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
Words string `json:"words,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Self bool `json:"self,omitempty"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
Words string `json:"words,omitempty"`
|
||||
}
|
||||
|
||||
// WantsByHeldModuleFingerprintValue is one value of the state wants under the key held.<module>.<fingerprint>.
|
||||
type WantsByHeldModuleFingerprintValue struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Node string `json:"node"`
|
||||
V int64 `json:"v,omitempty"`
|
||||
Words string `json:"words,omitempty"`
|
||||
@@ -1436,6 +1410,8 @@ type AsksByAssignmentsProposalValue = Ask
|
||||
|
||||
// DifferencesByNodeModuleValue is one value of the state differences under the key <node>.<module>.
|
||||
type DifferencesByNodeModuleValue struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Rule int64 `json:"rule,omitempty"`
|
||||
Sent string `json:"sent,omitempty"`
|
||||
SentBuild string `json:"sent-build,omitempty"`
|
||||
@@ -1448,6 +1424,8 @@ type DifferencesByNodeModuleValue struct {
|
||||
|
||||
// CompositionsByGroupHeadsValue is one value of the state compositions under the key <group>.<heads>.
|
||||
type CompositionsByGroupHeadsValue struct {
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Group string `json:"group"`
|
||||
// 12 lowercase hex digits
|
||||
Heads string `json:"heads"`
|
||||
@@ -1471,3 +1449,194 @@ type AssignmentRevisionsByCandidateGroupHeadsValue = AssignmentRevision
|
||||
|
||||
// AssignmentRevisionsByEntryDigestValue is one value of the state assignment-revisions under the key entry.<digest>.
|
||||
type AssignmentRevisionsByEntryDigestValue = AssignmentEntry
|
||||
|
||||
// DecodeUpgradeAnswer reads a UpgradeAnswer 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 DecodeUpgradeAnswer(raw []byte) (UpgradeAnswer, int, error) {
|
||||
var v UpgradeAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeBusAnswer reads a BusAnswer 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 DecodeBusAnswer(raw []byte) (BusAnswer, int, error) {
|
||||
var v BusAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRevisionAnswer reads a RevisionAnswer 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 DecodeRevisionAnswer(raw []byte) (RevisionAnswer, int, error) {
|
||||
var v RevisionAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeEntryAnswer reads a EntryAnswer 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 DecodeEntryAnswer(raw []byte) (EntryAnswer, int, error) {
|
||||
var v EntryAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeDifferenceAnswer reads a DifferenceAnswer 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 DecodeDifferenceAnswer(raw []byte) (DifferenceAnswer, int, error) {
|
||||
var v DifferenceAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeInputAnswer reads a InputAnswer 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 DecodeInputAnswer(raw []byte) (InputAnswer, int, error) {
|
||||
var v InputAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeCompositionsAnswer reads a CompositionsAnswer 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 DecodeCompositionsAnswer(raw []byte) (CompositionsAnswer, int, error) {
|
||||
var v CompositionsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeCompositionsDropAnswer reads a CompositionsDropAnswer 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 DecodeCompositionsDropAnswer(raw []byte) (CompositionsDropAnswer, int, error) {
|
||||
var v CompositionsDropAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePolicyChangedEvent reads a PolicyChangedEvent 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 DecodePolicyChangedEvent(raw []byte) (PolicyChangedEvent, int, error) {
|
||||
var v PolicyChangedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeAssignmentRevisionEvent reads a AssignmentRevisionEvent 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 DecodeAssignmentRevisionEvent(raw []byte) (AssignmentRevisionEvent, int, error) {
|
||||
var v AssignmentRevisionEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeDifferenceEvent reads a DifferenceEvent 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 DecodeDifferenceEvent(raw []byte) (DifferenceEvent, int, error) {
|
||||
var v DifferenceEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWantedEvent reads a WantedEvent 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 DecodeWantedEvent(raw []byte) (WantedEvent, int, error) {
|
||||
var v WantedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePipelineWantedEvent reads a PipelineWantedEvent 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 DecodePipelineWantedEvent(raw []byte) (PipelineWantedEvent, int, error) {
|
||||
var v PipelineWantedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWaitHeldEvent reads a WaitHeldEvent 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 DecodeWaitHeldEvent(raw []byte) (WaitHeldEvent, int, error) {
|
||||
var v WaitHeldEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeWaitEndedEvent reads a WaitEndedEvent 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 DecodeWaitEndedEvent(raw []byte) (WaitEndedEvent, int, error) {
|
||||
var v WaitEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFillingEvent reads a FillingEvent 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 DecodeFillingEvent(raw []byte) (FillingEvent, int, error) {
|
||||
var v FillingEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeFullEvent reads a FullEvent 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 DecodeFullEvent(raw []byte) (FullEvent, int, error) {
|
||||
var v FullEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeRoomEvent reads a RoomEvent 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 DecodeRoomEvent(raw []byte) (RoomEvent, int, error) {
|
||||
var v RoomEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepEndedEvent reads a StepEndedEvent 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 DecodeStepEndedEvent(raw []byte) (StepEndedEvent, int, error) {
|
||||
var v StepEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepProgressEvent reads a StepProgressEvent 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 DecodeStepProgressEvent(raw []byte) (StepProgressEvent, int, error) {
|
||||
var v StepProgressEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package nodebuildgo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,20 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "node-build-go"
|
||||
|
||||
// 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
|
||||
|
||||
// FormBuildStep is the form of what the part build-step adds.
|
||||
const FormBuildStep = 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 build-step:1"
|
||||
generatedFieldsDigest = "218f11fe3450203f7becf249c56ea56aaf441c3d4c8ad46570c29f700d175377"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbCurrent = "current"
|
||||
VerbPause = "pause"
|
||||
@@ -142,18 +154,13 @@ func ParseStepsByAskerNodeIDKey(key string) (string, string, string, bool) {
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>", refusing a field StepsByAskerNodeIDValue does not know and any text after the value.
|
||||
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, error) {
|
||||
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>" as another part wrote it: a field StepsByAskerNodeIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, int, error) {
|
||||
var v StepsByAskerNodeIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// StepsByNodeIDKey is the key of one value of the state steps under the form "<node>.<id>".
|
||||
@@ -178,18 +185,13 @@ func ParseStepsByNodeIDKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>", refusing a field StepsByNodeIDValue does not know and any text after the value.
|
||||
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, error) {
|
||||
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>" as another part wrote it: a field StepsByNodeIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, int, error) {
|
||||
var v StepsByNodeIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByPausedNodeKey is the key of one value of the state pauses under the form "paused.<node>".
|
||||
@@ -213,18 +215,13 @@ func ParsePausesByPausedNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>", refusing a field PausesByPausedNodeValue does not know and any text after the value.
|
||||
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error) {
|
||||
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>" as another part wrote it: a field PausesByPausedNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, int, error) {
|
||||
var v PausesByPausedNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
|
||||
@@ -248,18 +245,13 @@ func ParsePausesByDroppedIDKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
|
||||
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
|
||||
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>" as another part wrote it: a field PausesByDroppedIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, int, error) {
|
||||
var v PausesByDroppedIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
|
||||
@@ -283,18 +275,13 @@ func ParsePausesByCapacityNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>", refusing a field PausesByCapacityNodeValue does not know and any text after the value.
|
||||
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, error) {
|
||||
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>" as another part wrote it: a field PausesByCapacityNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, int, error) {
|
||||
var v PausesByCapacityNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// ToolchainsByNodeLanguageKey is the key of one value of the state toolchains under the form "<node>.<language>".
|
||||
@@ -319,18 +306,13 @@ func ParseToolchainsByNodeLanguageKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>", refusing a field ToolchainsByNodeLanguageValue does not know and any text after the value.
|
||||
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, error) {
|
||||
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>" as another part wrote it: a field ToolchainsByNodeLanguageValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, int, error) {
|
||||
var v ToolchainsByNodeLanguageValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DetectedStepsByModuleArtifactKey is the key of one value of the state detected-steps under the form "<module>.<artifact>".
|
||||
@@ -355,18 +337,13 @@ func ParseDetectedStepsByModuleArtifactKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>", refusing a field DetectedStepsByModuleArtifactValue does not know and any text after the value.
|
||||
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, error) {
|
||||
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>" as another part wrote it: a field DetectedStepsByModuleArtifactValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, int, error) {
|
||||
var v DetectedStepsByModuleArtifactValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AskArtifact is one artifact of a build ask: built from the fetched tree, or copied from an upstream pin.
|
||||
@@ -383,6 +360,8 @@ type AskTaken struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the node that took it, as in the subject
|
||||
Node string `json:"node"`
|
||||
}
|
||||
@@ -425,10 +404,12 @@ type Capacity struct {
|
||||
ConfiguredFrom string `json:"configured-from,omitempty"`
|
||||
CoresPerStep float64 `json:"cores-per-step,omitempty"`
|
||||
Effective int64 `json:"effective"`
|
||||
Ineligible string `json:"ineligible,omitempty"`
|
||||
OutsideHours bool `json:"outside-hours,omitempty"`
|
||||
QuotaCores float64 `json:"quota-cores,omitempty"`
|
||||
QuotaFrom string `json:"quota-from,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Ineligible string `json:"ineligible,omitempty"`
|
||||
OutsideHours bool `json:"outside-hours,omitempty"`
|
||||
QuotaCores float64 `json:"quota-cores,omitempty"`
|
||||
QuotaFrom string `json:"quota-from,omitempty"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
Why string `json:"why"`
|
||||
@@ -464,10 +445,12 @@ const (
|
||||
|
||||
// DetectedSteps is the steps detected for one artifact at its newest build-input fingerprint, replaced when a newer fingerprint is detected and by steps with again (design 47 G section 326).
|
||||
type DetectedSteps struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
Steps []DetectedStep `json:"steps"`
|
||||
V int64 `json:"v"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Steps []DetectedStep `json:"steps"`
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// Drop is an ask a caller no longer waits for.
|
||||
@@ -475,6 +458,8 @@ type Drop struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,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 layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
Why string `json:"why"`
|
||||
@@ -626,9 +611,11 @@ type ModuleTree struct {
|
||||
// Pause is whether the node takes no new ask.
|
||||
type Pause struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
Paused bool `json:"paused"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Paused bool `json:"paused"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
}
|
||||
@@ -699,8 +686,10 @@ type Step struct {
|
||||
AgainAt *time.Time `json:"again-at,omitempty"`
|
||||
// when (RFC 3339 time)
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Node string `json:"node"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Node string `json:"node"`
|
||||
// the name of the object in the build module's outputs store that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290): a check's whole answer, its result then empty; a run's output, its result the run's answer without it. Read through the verb output
|
||||
OutputObject string `json:"output-object,omitempty"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
@@ -801,6 +790,8 @@ type StepEnded struct {
|
||||
Commit string `json:"commit,omitempty"`
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
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 ask's id
|
||||
ID string `json:"id"`
|
||||
// the packages that passed at their digest, for the runner to keep
|
||||
@@ -845,7 +836,9 @@ type StepProgress struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
Phase string `json:"phase"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Phase string `json:"phase"`
|
||||
}
|
||||
|
||||
// The values of StepProgress's phase.
|
||||
@@ -944,6 +937,8 @@ type Toolchain struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// the sha256: digest of the language's toolchain program as the build module runs it: the program of the module that provides that language's toolchain, never the build module's own (design 47 G section 472)
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// go or typescript
|
||||
Language string `json:"language"`
|
||||
Recipe string `json:"recipe"`
|
||||
@@ -955,7 +950,9 @@ type Toolchain struct {
|
||||
// ToolchainReported is a node's toolchain of a language, said at the build module's start and each time its toolchains key of the language changes (design 47 G section 492).
|
||||
type ToolchainReported struct {
|
||||
// the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own
|
||||
Digest string `json:"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"`
|
||||
Language string `json:"language"`
|
||||
Node string `json:"node"`
|
||||
Recipe string `json:"recipe"`
|
||||
@@ -1021,6 +1018,8 @@ type KeptArtifactAnswer struct {
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// why it could not answer
|
||||
Error string `json:"error,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 fingerprint asked
|
||||
Fp string `json:"fp"`
|
||||
// the module asked
|
||||
@@ -1067,6 +1066,8 @@ type StepsAnswer struct {
|
||||
// why a drop deleted nothing, naming the hand-act log when it refused
|
||||
Error string `json:"error,omitempty"`
|
||||
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"`
|
||||
// answered from the kept answer
|
||||
Kept bool `json:"kept,omitempty"`
|
||||
Steps []DetectedStep `json:"steps,omitempty"`
|
||||
@@ -1086,6 +1087,8 @@ type OutputAnswer struct {
|
||||
Ask string `json:"ask"`
|
||||
// how many chunks are sent; 0 when this node keeps no answer of that ask
|
||||
Chunks int64 `json:"chunks"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
}
|
||||
|
||||
// DeliveryAccept is the body of delivery.
|
||||
@@ -1138,3 +1141,113 @@ type ToolchainsByNodeLanguageValue = Toolchain
|
||||
|
||||
// DetectedStepsByModuleArtifactValue is one value of the state detected-steps under the key <module>.<artifact>.
|
||||
type DetectedStepsByModuleArtifactValue = DetectedSteps
|
||||
|
||||
// DecodeCurrentAnswer reads a CurrentAnswer 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 DecodeCurrentAnswer(raw []byte) (CurrentAnswer, int, error) {
|
||||
var v CurrentAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePauseAnswer reads a PauseAnswer 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 DecodePauseAnswer(raw []byte) (PauseAnswer, int, error) {
|
||||
var v PauseAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeResumeAnswer reads a ResumeAnswer 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 DecodeResumeAnswer(raw []byte) (ResumeAnswer, int, error) {
|
||||
var v ResumeAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeDropAnswer reads a DropAnswer 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 DecodeDropAnswer(raw []byte) (DropAnswer, int, error) {
|
||||
var v DropAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeKeptArtifactAnswer reads a KeptArtifactAnswer 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 DecodeKeptArtifactAnswer(raw []byte) (KeptArtifactAnswer, int, error) {
|
||||
var v KeptArtifactAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepsAnswer reads a StepsAnswer 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 DecodeStepsAnswer(raw []byte) (StepsAnswer, int, error) {
|
||||
var v StepsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeOutputAnswer reads a OutputAnswer 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 DecodeOutputAnswer(raw []byte) (OutputAnswer, int, error) {
|
||||
var v OutputAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepEndedEvent reads a StepEndedEvent 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 DecodeStepEndedEvent(raw []byte) (StepEndedEvent, int, error) {
|
||||
var v StepEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeToolchainReportedEvent reads a ToolchainReportedEvent 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 DecodeToolchainReportedEvent(raw []byte) (ToolchainReportedEvent, int, error) {
|
||||
var v ToolchainReportedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepProgressEvent reads a StepProgressEvent 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 DecodeStepProgressEvent(raw []byte) (StepProgressEvent, int, error) {
|
||||
var v StepProgressEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeAskTakenEvent reads a AskTakenEvent 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 DecodeAskTakenEvent(raw []byte) (AskTakenEvent, int, error) {
|
||||
var v AskTakenEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package nodebuildimage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,20 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "node-build-image"
|
||||
|
||||
// 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
|
||||
|
||||
// FormBuildStep is the form of what the part build-step adds.
|
||||
const FormBuildStep = 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 build-step:1"
|
||||
generatedFieldsDigest = "3c8081a3209e1638ad3cd1a0a3abe1ae979347bb22e7f0c35a2cc132df7e21b4"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbCurrent = "current"
|
||||
VerbPause = "pause"
|
||||
@@ -140,18 +152,13 @@ func ParseStepsByAskerNodeIDKey(key string) (string, string, string, bool) {
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>", refusing a field StepsByAskerNodeIDValue does not know and any text after the value.
|
||||
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, error) {
|
||||
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>" as another part wrote it: a field StepsByAskerNodeIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, int, error) {
|
||||
var v StepsByAskerNodeIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// StepsByNodeIDKey is the key of one value of the state steps under the form "<node>.<id>".
|
||||
@@ -176,18 +183,13 @@ func ParseStepsByNodeIDKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>", refusing a field StepsByNodeIDValue does not know and any text after the value.
|
||||
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, error) {
|
||||
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>" as another part wrote it: a field StepsByNodeIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, int, error) {
|
||||
var v StepsByNodeIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByPausedNodeKey is the key of one value of the state pauses under the form "paused.<node>".
|
||||
@@ -211,18 +213,13 @@ func ParsePausesByPausedNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>", refusing a field PausesByPausedNodeValue does not know and any text after the value.
|
||||
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error) {
|
||||
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>" as another part wrote it: a field PausesByPausedNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, int, error) {
|
||||
var v PausesByPausedNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
|
||||
@@ -246,18 +243,13 @@ func ParsePausesByDroppedIDKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
|
||||
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
|
||||
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>" as another part wrote it: a field PausesByDroppedIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, int, error) {
|
||||
var v PausesByDroppedIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
|
||||
@@ -281,18 +273,13 @@ func ParsePausesByCapacityNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>", refusing a field PausesByCapacityNodeValue does not know and any text after the value.
|
||||
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, error) {
|
||||
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>" as another part wrote it: a field PausesByCapacityNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, int, error) {
|
||||
var v PausesByCapacityNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// ToolchainsByNodeLanguageKey is the key of one value of the state toolchains under the form "<node>.<language>".
|
||||
@@ -317,18 +304,13 @@ func ParseToolchainsByNodeLanguageKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>", refusing a field ToolchainsByNodeLanguageValue does not know and any text after the value.
|
||||
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, error) {
|
||||
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>" as another part wrote it: a field ToolchainsByNodeLanguageValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, int, error) {
|
||||
var v ToolchainsByNodeLanguageValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DetectedStepsByModuleArtifactKey is the key of one value of the state detected-steps under the form "<module>.<artifact>".
|
||||
@@ -353,18 +335,13 @@ func ParseDetectedStepsByModuleArtifactKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>", refusing a field DetectedStepsByModuleArtifactValue does not know and any text after the value.
|
||||
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, error) {
|
||||
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>" as another part wrote it: a field DetectedStepsByModuleArtifactValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, int, error) {
|
||||
var v DetectedStepsByModuleArtifactValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AskArtifact is one artifact of a build ask: built from the fetched tree, or copied from an upstream pin.
|
||||
@@ -381,6 +358,8 @@ type AskTaken struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the node that took it, as in the subject
|
||||
Node string `json:"node"`
|
||||
}
|
||||
@@ -423,10 +402,12 @@ type Capacity struct {
|
||||
ConfiguredFrom string `json:"configured-from,omitempty"`
|
||||
CoresPerStep float64 `json:"cores-per-step,omitempty"`
|
||||
Effective int64 `json:"effective"`
|
||||
Ineligible string `json:"ineligible,omitempty"`
|
||||
OutsideHours bool `json:"outside-hours,omitempty"`
|
||||
QuotaCores float64 `json:"quota-cores,omitempty"`
|
||||
QuotaFrom string `json:"quota-from,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Ineligible string `json:"ineligible,omitempty"`
|
||||
OutsideHours bool `json:"outside-hours,omitempty"`
|
||||
QuotaCores float64 `json:"quota-cores,omitempty"`
|
||||
QuotaFrom string `json:"quota-from,omitempty"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
Why string `json:"why"`
|
||||
@@ -462,10 +443,12 @@ const (
|
||||
|
||||
// DetectedSteps is the steps detected for one artifact at its newest build-input fingerprint, replaced when a newer fingerprint is detected and by steps with again (design 47 G section 326).
|
||||
type DetectedSteps struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
Steps []DetectedStep `json:"steps"`
|
||||
V int64 `json:"v"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Steps []DetectedStep `json:"steps"`
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// Drop is an ask a caller no longer waits for.
|
||||
@@ -473,6 +456,8 @@ type Drop struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,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 layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
Why string `json:"why"`
|
||||
@@ -624,9 +609,11 @@ type ModuleTree struct {
|
||||
// Pause is whether the node takes no new ask.
|
||||
type Pause struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
Paused bool `json:"paused"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Paused bool `json:"paused"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
}
|
||||
@@ -697,8 +684,10 @@ type Step struct {
|
||||
AgainAt *time.Time `json:"again-at,omitempty"`
|
||||
// when (RFC 3339 time)
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Node string `json:"node"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Node string `json:"node"`
|
||||
// the name of the object in the build module's outputs store that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290): a check's whole answer, its result then empty; a run's output, its result the run's answer without it. Read through the verb output
|
||||
OutputObject string `json:"output-object,omitempty"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
@@ -799,6 +788,8 @@ type StepEnded struct {
|
||||
Commit string `json:"commit,omitempty"`
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
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 ask's id
|
||||
ID string `json:"id"`
|
||||
// the packages that passed at their digest, for the runner to keep
|
||||
@@ -843,7 +834,9 @@ type StepProgress struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
Phase string `json:"phase"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Phase string `json:"phase"`
|
||||
}
|
||||
|
||||
// The values of StepProgress's phase.
|
||||
@@ -942,6 +935,8 @@ type Toolchain struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// the sha256: digest of the language's toolchain program as the build module runs it: the program of the module that provides that language's toolchain, never the build module's own (design 47 G section 472)
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// go or typescript
|
||||
Language string `json:"language"`
|
||||
Recipe string `json:"recipe"`
|
||||
@@ -953,7 +948,9 @@ type Toolchain struct {
|
||||
// ToolchainReported is a node's toolchain of a language, said at the build module's start and each time its toolchains key of the language changes (design 47 G section 492).
|
||||
type ToolchainReported struct {
|
||||
// the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own
|
||||
Digest string `json:"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"`
|
||||
Language string `json:"language"`
|
||||
Node string `json:"node"`
|
||||
Recipe string `json:"recipe"`
|
||||
@@ -1019,6 +1016,8 @@ type KeptArtifactAnswer struct {
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// why it could not answer
|
||||
Error string `json:"error,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 fingerprint asked
|
||||
Fp string `json:"fp"`
|
||||
// the module asked
|
||||
@@ -1065,6 +1064,8 @@ type StepsAnswer struct {
|
||||
// why a drop deleted nothing, naming the hand-act log when it refused
|
||||
Error string `json:"error,omitempty"`
|
||||
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"`
|
||||
// answered from the kept answer
|
||||
Kept bool `json:"kept,omitempty"`
|
||||
Steps []DetectedStep `json:"steps,omitempty"`
|
||||
@@ -1084,6 +1085,8 @@ type OutputAnswer struct {
|
||||
Ask string `json:"ask"`
|
||||
// how many chunks are sent; 0 when this node keeps no answer of that ask
|
||||
Chunks int64 `json:"chunks"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
}
|
||||
|
||||
// DeliveryAccept is the body of delivery.
|
||||
@@ -1133,3 +1136,113 @@ type ToolchainsByNodeLanguageValue = Toolchain
|
||||
|
||||
// DetectedStepsByModuleArtifactValue is one value of the state detected-steps under the key <module>.<artifact>.
|
||||
type DetectedStepsByModuleArtifactValue = DetectedSteps
|
||||
|
||||
// DecodeCurrentAnswer reads a CurrentAnswer 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 DecodeCurrentAnswer(raw []byte) (CurrentAnswer, int, error) {
|
||||
var v CurrentAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePauseAnswer reads a PauseAnswer 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 DecodePauseAnswer(raw []byte) (PauseAnswer, int, error) {
|
||||
var v PauseAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeResumeAnswer reads a ResumeAnswer 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 DecodeResumeAnswer(raw []byte) (ResumeAnswer, int, error) {
|
||||
var v ResumeAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeDropAnswer reads a DropAnswer 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 DecodeDropAnswer(raw []byte) (DropAnswer, int, error) {
|
||||
var v DropAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeKeptArtifactAnswer reads a KeptArtifactAnswer 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 DecodeKeptArtifactAnswer(raw []byte) (KeptArtifactAnswer, int, error) {
|
||||
var v KeptArtifactAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepsAnswer reads a StepsAnswer 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 DecodeStepsAnswer(raw []byte) (StepsAnswer, int, error) {
|
||||
var v StepsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeOutputAnswer reads a OutputAnswer 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 DecodeOutputAnswer(raw []byte) (OutputAnswer, int, error) {
|
||||
var v OutputAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepEndedEvent reads a StepEndedEvent 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 DecodeStepEndedEvent(raw []byte) (StepEndedEvent, int, error) {
|
||||
var v StepEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeToolchainReportedEvent reads a ToolchainReportedEvent 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 DecodeToolchainReportedEvent(raw []byte) (ToolchainReportedEvent, int, error) {
|
||||
var v ToolchainReportedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepProgressEvent reads a StepProgressEvent 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 DecodeStepProgressEvent(raw []byte) (StepProgressEvent, int, error) {
|
||||
var v StepProgressEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeAskTakenEvent reads a AskTakenEvent 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 DecodeAskTakenEvent(raw []byte) (AskTakenEvent, int, error) {
|
||||
var v AskTakenEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
package nodebuildnode
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -14,6 +12,20 @@ import (
|
||||
// Seat is the seat's name.
|
||||
const Seat = "node-build-node"
|
||||
|
||||
// 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
|
||||
|
||||
// FormBuildStep is the form of what the part build-step adds.
|
||||
const FormBuildStep = 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 build-step:1"
|
||||
generatedFieldsDigest = "3c8081a3209e1638ad3cd1a0a3abe1ae979347bb22e7f0c35a2cc132df7e21b4"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbCurrent = "current"
|
||||
VerbPause = "pause"
|
||||
@@ -140,18 +152,13 @@ func ParseStepsByAskerNodeIDKey(key string) (string, string, string, bool) {
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>", refusing a field StepsByAskerNodeIDValue does not know and any text after the value.
|
||||
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, error) {
|
||||
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>" as another part wrote it: a field StepsByAskerNodeIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, int, error) {
|
||||
var v StepsByAskerNodeIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// StepsByNodeIDKey is the key of one value of the state steps under the form "<node>.<id>".
|
||||
@@ -176,18 +183,13 @@ func ParseStepsByNodeIDKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>", refusing a field StepsByNodeIDValue does not know and any text after the value.
|
||||
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, error) {
|
||||
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>" as another part wrote it: a field StepsByNodeIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, int, error) {
|
||||
var v StepsByNodeIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByPausedNodeKey is the key of one value of the state pauses under the form "paused.<node>".
|
||||
@@ -211,18 +213,13 @@ func ParsePausesByPausedNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>", refusing a field PausesByPausedNodeValue does not know and any text after the value.
|
||||
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error) {
|
||||
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>" as another part wrote it: a field PausesByPausedNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, int, error) {
|
||||
var v PausesByPausedNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
|
||||
@@ -246,18 +243,13 @@ func ParsePausesByDroppedIDKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
|
||||
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
|
||||
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>" as another part wrote it: a field PausesByDroppedIDValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, int, error) {
|
||||
var v PausesByDroppedIDValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
|
||||
@@ -281,18 +273,13 @@ func ParsePausesByCapacityNodeKey(key string) (string, bool) {
|
||||
return v1, true
|
||||
}
|
||||
|
||||
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>", refusing a field PausesByCapacityNodeValue does not know and any text after the value.
|
||||
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, error) {
|
||||
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>" as another part wrote it: a field PausesByCapacityNodeValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, int, error) {
|
||||
var v PausesByCapacityNodeValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// ToolchainsByNodeLanguageKey is the key of one value of the state toolchains under the form "<node>.<language>".
|
||||
@@ -317,18 +304,13 @@ func ParseToolchainsByNodeLanguageKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>", refusing a field ToolchainsByNodeLanguageValue does not know and any text after the value.
|
||||
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, error) {
|
||||
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>" as another part wrote it: a field ToolchainsByNodeLanguageValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, int, error) {
|
||||
var v ToolchainsByNodeLanguageValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DetectedStepsByModuleArtifactKey is the key of one value of the state detected-steps under the form "<module>.<artifact>".
|
||||
@@ -353,18 +335,13 @@ func ParseDetectedStepsByModuleArtifactKey(key string) (string, string, bool) {
|
||||
return v0, v2, true
|
||||
}
|
||||
|
||||
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>", refusing a field DetectedStepsByModuleArtifactValue does not know and any text after the value.
|
||||
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, error) {
|
||||
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>" as another part wrote it: a field DetectedStepsByModuleArtifactValue does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
||||
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, int, error) {
|
||||
var v DetectedStepsByModuleArtifactValue
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// AskArtifact is one artifact of a build ask: built from the fetched tree, or copied from an upstream pin.
|
||||
@@ -381,6 +358,8 @@ type AskTaken struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// the node that took it, as in the subject
|
||||
Node string `json:"node"`
|
||||
}
|
||||
@@ -423,10 +402,12 @@ type Capacity struct {
|
||||
ConfiguredFrom string `json:"configured-from,omitempty"`
|
||||
CoresPerStep float64 `json:"cores-per-step,omitempty"`
|
||||
Effective int64 `json:"effective"`
|
||||
Ineligible string `json:"ineligible,omitempty"`
|
||||
OutsideHours bool `json:"outside-hours,omitempty"`
|
||||
QuotaCores float64 `json:"quota-cores,omitempty"`
|
||||
QuotaFrom string `json:"quota-from,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Ineligible string `json:"ineligible,omitempty"`
|
||||
OutsideHours bool `json:"outside-hours,omitempty"`
|
||||
QuotaCores float64 `json:"quota-cores,omitempty"`
|
||||
QuotaFrom string `json:"quota-from,omitempty"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
Why string `json:"why"`
|
||||
@@ -462,10 +443,12 @@ const (
|
||||
|
||||
// DetectedSteps is the steps detected for one artifact at its newest build-input fingerprint, replaced when a newer fingerprint is detected and by steps with again (design 47 G section 326).
|
||||
type DetectedSteps struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
Steps []DetectedStep `json:"steps"`
|
||||
V int64 `json:"v"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Steps []DetectedStep `json:"steps"`
|
||||
V int64 `json:"v"`
|
||||
}
|
||||
|
||||
// Drop is an ask a caller no longer waits for.
|
||||
@@ -473,6 +456,8 @@ type Drop struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,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 layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
Why string `json:"why"`
|
||||
@@ -624,9 +609,11 @@ type ModuleTree struct {
|
||||
// Pause is whether the node takes no new ask.
|
||||
type Pause struct {
|
||||
// when (RFC 3339 time)
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
Paused bool `json:"paused"`
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
By string `json:"by,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Paused bool `json:"paused"`
|
||||
// the layout version
|
||||
V int64 `json:"v,omitempty"`
|
||||
}
|
||||
@@ -697,8 +684,10 @@ type Step struct {
|
||||
AgainAt *time.Time `json:"again-at,omitempty"`
|
||||
// when (RFC 3339 time)
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Node string `json:"node"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Node string `json:"node"`
|
||||
// the name of the object in the build module's outputs store that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290): a check's whole answer, its result then empty; a run's output, its result the run's answer without it. Read through the verb output
|
||||
OutputObject string `json:"output-object,omitempty"`
|
||||
Owner string `json:"owner,omitempty"`
|
||||
@@ -799,6 +788,8 @@ type StepEnded struct {
|
||||
Commit string `json:"commit,omitempty"`
|
||||
Ended *time.Time `json:"ended,omitempty"`
|
||||
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 ask's id
|
||||
ID string `json:"id"`
|
||||
// the packages that passed at their digest, for the runner to keep
|
||||
@@ -843,7 +834,9 @@ type StepProgress struct {
|
||||
Ask string `json:"ask"`
|
||||
Asker string `json:"asker"`
|
||||
At time.Time `json:"at"`
|
||||
Phase string `json:"phase"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
Phase string `json:"phase"`
|
||||
}
|
||||
|
||||
// The values of StepProgress's phase.
|
||||
@@ -942,6 +935,8 @@ type Toolchain struct {
|
||||
At *time.Time `json:"at,omitempty"`
|
||||
// the sha256: digest of the language's toolchain program as the build module runs it: the program of the module that provides that language's toolchain, never the build module's own (design 47 G section 472)
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
// go or typescript
|
||||
Language string `json:"language"`
|
||||
Recipe string `json:"recipe"`
|
||||
@@ -953,7 +948,9 @@ type Toolchain struct {
|
||||
// ToolchainReported is a node's toolchain of a language, said at the build module's start and each time its toolchains key of the language changes (design 47 G section 492).
|
||||
type ToolchainReported struct {
|
||||
// the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own
|
||||
Digest string `json:"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"`
|
||||
Language string `json:"language"`
|
||||
Node string `json:"node"`
|
||||
Recipe string `json:"recipe"`
|
||||
@@ -1019,6 +1016,8 @@ type KeptArtifactAnswer struct {
|
||||
Digest string `json:"digest,omitempty"`
|
||||
// why it could not answer
|
||||
Error string `json:"error,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 fingerprint asked
|
||||
Fp string `json:"fp"`
|
||||
// the module asked
|
||||
@@ -1065,6 +1064,8 @@ type StepsAnswer struct {
|
||||
// why a drop deleted nothing, naming the hand-act log when it refused
|
||||
Error string `json:"error,omitempty"`
|
||||
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"`
|
||||
// answered from the kept answer
|
||||
Kept bool `json:"kept,omitempty"`
|
||||
Steps []DetectedStep `json:"steps,omitempty"`
|
||||
@@ -1084,6 +1085,8 @@ type OutputAnswer struct {
|
||||
Ask string `json:"ask"`
|
||||
// how many chunks are sent; 0 when this node keeps no answer of that ask
|
||||
Chunks int64 `json:"chunks"`
|
||||
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
||||
Form int64 `json:"form,omitempty"`
|
||||
}
|
||||
|
||||
// DeliveryAccept is the body of delivery.
|
||||
@@ -1133,3 +1136,113 @@ type ToolchainsByNodeLanguageValue = Toolchain
|
||||
|
||||
// DetectedStepsByModuleArtifactValue is one value of the state detected-steps under the key <module>.<artifact>.
|
||||
type DetectedStepsByModuleArtifactValue = DetectedSteps
|
||||
|
||||
// DecodeCurrentAnswer reads a CurrentAnswer 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 DecodeCurrentAnswer(raw []byte) (CurrentAnswer, int, error) {
|
||||
var v CurrentAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodePauseAnswer reads a PauseAnswer 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 DecodePauseAnswer(raw []byte) (PauseAnswer, int, error) {
|
||||
var v PauseAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeResumeAnswer reads a ResumeAnswer 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 DecodeResumeAnswer(raw []byte) (ResumeAnswer, int, error) {
|
||||
var v ResumeAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeDropAnswer reads a DropAnswer 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 DecodeDropAnswer(raw []byte) (DropAnswer, int, error) {
|
||||
var v DropAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeKeptArtifactAnswer reads a KeptArtifactAnswer 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 DecodeKeptArtifactAnswer(raw []byte) (KeptArtifactAnswer, int, error) {
|
||||
var v KeptArtifactAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepsAnswer reads a StepsAnswer 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 DecodeStepsAnswer(raw []byte) (StepsAnswer, int, error) {
|
||||
var v StepsAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeOutputAnswer reads a OutputAnswer 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 DecodeOutputAnswer(raw []byte) (OutputAnswer, int, error) {
|
||||
var v OutputAnswer
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepEndedEvent reads a StepEndedEvent 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 DecodeStepEndedEvent(raw []byte) (StepEndedEvent, int, error) {
|
||||
var v StepEndedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeToolchainReportedEvent reads a ToolchainReportedEvent 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 DecodeToolchainReportedEvent(raw []byte) (ToolchainReportedEvent, int, error) {
|
||||
var v ToolchainReportedEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeStepProgressEvent reads a StepProgressEvent 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 DecodeStepProgressEvent(raw []byte) (StepProgressEvent, int, error) {
|
||||
var v StepProgressEvent
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// DecodeAskTakenEvent reads a AskTakenEvent 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 DecodeAskTakenEvent(raw []byte) (AskTakenEvent, int, error) {
|
||||
var v AskTakenEvent
|
||||
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
|
||||
}
|
||||
|
||||
@@ -3,9 +3,27 @@
|
||||
// Package npmpackageregistry is the contract of the seat "npm-package-registry", defined whole (seats/npm-package-registry/seat.json): The mesh's npm packages: the npm registry protocol's read side, and publishing over the bus.
|
||||
package npmpackageregistry
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// Seat is the seat's name.
|
||||
const Seat = "npm-package-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 = "b80afb127966ec05c9c822eab0ab43488e6ee0a9d0f43cb1334e4fa32f07bb35"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbPublish = "publish"
|
||||
VerbPublishPart = "publish-part"
|
||||
@@ -83,6 +101,8 @@ type Outcome struct {
|
||||
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
|
||||
@@ -155,6 +175,8 @@ const (
|
||||
|
||||
// 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
|
||||
@@ -181,6 +203,8 @@ type PublishPartInput struct {
|
||||
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
|
||||
@@ -199,6 +223,8 @@ type VersionsInput struct {
|
||||
|
||||
// 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
|
||||
@@ -228,6 +254,8 @@ const (
|
||||
// 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
|
||||
@@ -260,3 +288,86 @@ type NpmPackageRegistryForm struct {
|
||||
// the read side's address
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -4,15 +4,27 @@
|
||||
package ociartifactregistry
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Seat is the seat's name.
|
||||
const Seat = "oci-artifact-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 = "8e4c974b178e7cef0139786b22ae88e0a82c036d2283ca621957a769932f9a59"
|
||||
)
|
||||
|
||||
const (
|
||||
VerbPublish = "publish"
|
||||
VerbPublishPart = "publish-part"
|
||||
@@ -100,18 +112,13 @@ func ParseHoldsBySeatNameDigestKey(key string) (string, string, string, bool) {
|
||||
return v0, v2, v4, true
|
||||
}
|
||||
|
||||
// DecodeHoldsBySeatNameDigestValue reads one value of the state holds under the form "<seat>.<name>.<digest>", refusing a field HoldsBySeatNameDigestValue does not know and any text after the value.
|
||||
func DecodeHoldsBySeatNameDigestValue(raw []byte) (HoldsBySeatNameDigestValue, error) {
|
||||
// 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
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// WindowsByCallerKey is the key of one value of the state windows under the form "<caller>".
|
||||
@@ -131,18 +138,13 @@ func ParseWindowsByCallerKey(key string) (string, bool) {
|
||||
return v0, true
|
||||
}
|
||||
|
||||
// DecodeWindowsByCallerValue reads one value of the state windows under the form "<caller>", refusing a field WindowsByCallerValue does not know and any text after the value.
|
||||
func DecodeWindowsByCallerValue(raw []byte) (WindowsByCallerValue, error) {
|
||||
// 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
|
||||
dec := json.NewDecoder(bytes.NewReader(raw))
|
||||
dec.DisallowUnknownFields()
|
||||
if err := dec.Decode(&v); err != nil {
|
||||
return v, err
|
||||
if err := json.Unmarshal(raw, &v); err != nil {
|
||||
return v, 0, err
|
||||
}
|
||||
if dec.More() {
|
||||
return v, errors.New("text after the value")
|
||||
}
|
||||
return v, nil
|
||||
return v, formRead(raw), nil
|
||||
}
|
||||
|
||||
// Artifact is one published thing, as every registry event and answer names it.
|
||||
@@ -180,6 +182,8 @@ type Hold struct {
|
||||
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
|
||||
@@ -214,6 +218,8 @@ type Outcome struct {
|
||||
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
|
||||
@@ -294,6 +300,8 @@ const (
|
||||
|
||||
// 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
|
||||
@@ -320,6 +328,8 @@ type PublishPartInput struct {
|
||||
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
|
||||
@@ -338,6 +348,8 @@ type VersionsInput struct {
|
||||
|
||||
// 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
|
||||
@@ -367,6 +379,8 @@ const (
|
||||
// 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
|
||||
@@ -394,6 +408,8 @@ type HoldInput struct {
|
||||
|
||||
// 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
|
||||
@@ -412,6 +428,8 @@ type ReleaseInput struct {
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -424,6 +442,8 @@ type ListInput struct {
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -450,9 +470,11 @@ type ReleasedEvent = Hold
|
||||
type HoldsBySeatNameDigestValue struct {
|
||||
By string `json:"by"`
|
||||
Digest string `json:"digest"`
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Seat string `json:"seat"`
|
||||
// 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"`
|
||||
@@ -473,6 +495,8 @@ type WindowsByCallerValue struct {
|
||||
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"`
|
||||
@@ -484,3 +508,131 @@ type WindowsByCallerValue struct {
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ export interface Hold {
|
||||
"by"?: string;
|
||||
/** the digest */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module holding the seat */
|
||||
"holder": string;
|
||||
/** the name */
|
||||
@@ -128,6 +130,8 @@ export interface MirrorInput {
|
||||
export interface MirrorAnswer {
|
||||
/** the digest stored */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the reference the seat answers */
|
||||
"reference": string;
|
||||
}
|
||||
@@ -147,6 +151,8 @@ export interface TagsAnswerTagsItem {
|
||||
|
||||
/** is what tags answers. */
|
||||
export interface TagsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the image */
|
||||
"name": string;
|
||||
/** every tag */
|
||||
@@ -165,6 +171,8 @@ export interface HoldInput {
|
||||
|
||||
/** is what hold answers. */
|
||||
export interface HoldAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** it is held */
|
||||
"held": boolean;
|
||||
/** when the hold began, RFC 3339 */
|
||||
@@ -183,6 +191,8 @@ export interface ReleaseInput {
|
||||
|
||||
/** is what release answers. */
|
||||
export interface ReleaseAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a hold was let go; false when there was none */
|
||||
"released": boolean;
|
||||
}
|
||||
@@ -195,6 +205,8 @@ export interface ListInput {
|
||||
|
||||
/** is what list answers. */
|
||||
export interface ListAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** each repository named, in order of its name */
|
||||
"repositories": Repository[];
|
||||
}
|
||||
@@ -209,6 +221,8 @@ export type ReleasedEvent = Hold;
|
||||
export interface HoldsBySeatNameDigestValue {
|
||||
"by": string;
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"kind": string;
|
||||
"name": string;
|
||||
"seat": string;
|
||||
@@ -231,6 +245,8 @@ export interface WindowsByCallerValue {
|
||||
"closed"?: string;
|
||||
/** retired nodes dropped by hand */
|
||||
"dropped"?: WindowsByCallerValueDroppedItem[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the nodes holding it open */
|
||||
"holding"?: string[];
|
||||
"last_holding"?: string[];
|
||||
|
||||
+10
@@ -42,6 +42,8 @@ export interface Outcome {
|
||||
"digest": string;
|
||||
/** the build's fingerprint */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module holding the seat that said it */
|
||||
"holder": string;
|
||||
/** what it is */
|
||||
@@ -96,6 +98,8 @@ export interface PublishInput {
|
||||
|
||||
/** is what publish answers. */
|
||||
export interface PublishAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the digest is held already: nothing to send; the outcome follows as an event */
|
||||
"held"?: boolean;
|
||||
/** the digests of the parts the holder lacks, to send by publish-part */
|
||||
@@ -122,6 +126,8 @@ export interface PublishPartInput {
|
||||
export interface PublishPartAnswer {
|
||||
/** the part is whole and its bytes match its digest */
|
||||
"complete"?: boolean;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the part */
|
||||
"part": string;
|
||||
/** the chunks of the part held so far */
|
||||
@@ -140,6 +146,8 @@ export interface VersionsInput {
|
||||
|
||||
/** is what versions answers. */
|
||||
export interface VersionsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the name */
|
||||
"name": string;
|
||||
/** newest first */
|
||||
@@ -163,6 +171,8 @@ export interface RemoveInput {
|
||||
/** is what remove answers. */
|
||||
export interface RemoveAnswer {
|
||||
"artifact"?: Artifact;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** it stays whole, its tag and its bytes: the store cannot remove the tag alone while another tag names its digest (reason, tags) */
|
||||
"kept"?: boolean;
|
||||
/** why it was kept: shared-digest, another tag names its digest */
|
||||
|
||||
@@ -83,6 +83,8 @@ export interface Call {
|
||||
"at": string;
|
||||
/** the caller as who@node */
|
||||
"by": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"members": CallMember[];
|
||||
/** merge-called was said for it */
|
||||
"said": boolean;
|
||||
@@ -126,6 +128,8 @@ export interface FailedStep {
|
||||
"commits": string[];
|
||||
/** the build-input fingerprint the step failed at */
|
||||
"fingerprint": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"module": string;
|
||||
/** the run that failed it: the runner's pipeline key */
|
||||
"run": string;
|
||||
@@ -237,6 +241,8 @@ export interface MergeCalled {
|
||||
"by": string;
|
||||
/** the merge call, 16 lowercase hex characters made once per call */
|
||||
"call": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** one per landed member */
|
||||
"members": MergeCalledMembersItem[];
|
||||
/** one per member not merged after every member was judged (design 47 H §767) */
|
||||
@@ -258,6 +264,8 @@ export interface PullAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"merging"?: Merging;
|
||||
"pull"?: Pull;
|
||||
}
|
||||
@@ -275,6 +283,8 @@ export interface BranchAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a commit, its full 40-hex sha */
|
||||
"head"?: string;
|
||||
"repository"?: string;
|
||||
@@ -289,6 +299,8 @@ export interface OpenPullsAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** every open pull request; said empty when none is open, so an answer that lacks it is never read as none */
|
||||
"pulls": OpenPull[];
|
||||
}
|
||||
@@ -310,6 +322,8 @@ export interface TagsAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** another page exists */
|
||||
"more"?: boolean;
|
||||
/** the page */
|
||||
@@ -341,6 +355,8 @@ export interface TreesAnswer {
|
||||
"error-kind"?: ErrorKind;
|
||||
/** directory to {path: blob id} */
|
||||
"files"?: Record<string, Record<string, string>>;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** directory to {path: object id} */
|
||||
"paths"?: Record<string, Record<string, string>>;
|
||||
/** the root tree's hash */
|
||||
@@ -370,6 +386,8 @@ export interface FileAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the path */
|
||||
"path"?: string;
|
||||
/** what was read */
|
||||
@@ -399,6 +417,8 @@ export interface ContainsAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the other */
|
||||
"in"?: string;
|
||||
}
|
||||
@@ -420,6 +440,8 @@ export interface StatusesAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the newest of each context */
|
||||
"statuses"?: Status[];
|
||||
}
|
||||
@@ -447,6 +469,8 @@ export interface StatusAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the id was already held on the pull request or the note, so nothing was done again */
|
||||
"held"?: boolean;
|
||||
/** the act's id, as the caller gave it */
|
||||
@@ -472,6 +496,8 @@ export interface CommentAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the id was already held on the pull request or the note, so nothing was done again */
|
||||
"held"?: boolean;
|
||||
/** the act's id, as the caller gave it */
|
||||
@@ -497,6 +523,8 @@ export interface ViewAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the id was already held on the pull request or the note, so nothing was done again */
|
||||
"held"?: boolean;
|
||||
/** the act's id, as the caller gave it */
|
||||
@@ -522,6 +550,8 @@ export interface NoteAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the id was already held on the pull request or the note, so nothing was done again */
|
||||
"held"?: boolean;
|
||||
/** the act's id, as the caller gave it */
|
||||
@@ -554,6 +584,8 @@ export interface MergePullAnswer {
|
||||
/** why the forge could not answer, or refused: set alone with error-kind, and a caller reads it as a failure, never as none */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** each member's outcome, in the order named */
|
||||
"members"?: MemberOutcome[];
|
||||
}
|
||||
@@ -573,6 +605,8 @@ export interface TagAnswer {
|
||||
/** why the forge could not write it: set alone with error-kind */
|
||||
"error"?: string;
|
||||
"error-kind"?: ErrorKind;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the forge holds the tag at that commit now */
|
||||
"performed"?: boolean;
|
||||
/** the tag, as asked */
|
||||
@@ -590,6 +624,8 @@ export interface PullUpdatedEvent {
|
||||
/** its head branch */
|
||||
"branch": string;
|
||||
"change"?: Change;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a commit, its full 40-hex sha */
|
||||
"head": string;
|
||||
/** the pull request's number */
|
||||
@@ -611,6 +647,8 @@ export interface PullMergedEvent {
|
||||
/** its head branch */
|
||||
"branch": string;
|
||||
"change"?: Change;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a commit, its full 40-hex sha */
|
||||
"head": string;
|
||||
/** the head's statuses by context, their states; absent when they could not be read */
|
||||
@@ -637,6 +675,8 @@ export interface PullClosedEvent {
|
||||
"base": string;
|
||||
/** its head branch */
|
||||
"branch": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a commit, its full 40-hex sha */
|
||||
"head": string;
|
||||
/** the pull request's number */
|
||||
@@ -659,6 +699,8 @@ export interface ForgePullEvent {
|
||||
"base"?: string;
|
||||
/** its head branch */
|
||||
"branch"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** its head commit */
|
||||
"head"?: string;
|
||||
/** the merge commit */
|
||||
@@ -681,6 +723,8 @@ export interface ForgeStatusEvent {
|
||||
"context": string;
|
||||
/** what it says */
|
||||
"description"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the repository, <owner>/<name> */
|
||||
"repository": string;
|
||||
/** who set it */
|
||||
@@ -691,6 +735,8 @@ export interface ForgeStatusEvent {
|
||||
|
||||
/** is the body of the event forge-delete. */
|
||||
export interface ForgeDeleteEvent {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the deleted branch or tag */
|
||||
"ref": string;
|
||||
/** branch or tag */
|
||||
@@ -705,6 +751,8 @@ export interface ForgeDeleteEvent {
|
||||
export interface RepoWritableEvent {
|
||||
/** the account that writes it now */
|
||||
"account": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the repository, <owner>/<name> */
|
||||
"repository": string;
|
||||
}
|
||||
@@ -713,6 +761,8 @@ export interface RepoWritableEvent {
|
||||
export interface BranchMovedEvent {
|
||||
"at"?: string;
|
||||
"branch": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the head the webhook said, a commit's full 40-hex sha; read again by branch */
|
||||
"head"?: string;
|
||||
/** the repository, <owner>/<name> */
|
||||
|
||||
+10
@@ -42,6 +42,8 @@ export interface Outcome {
|
||||
"digest": string;
|
||||
/** the build's fingerprint */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module holding the seat that said it */
|
||||
"holder": string;
|
||||
/** what it is */
|
||||
@@ -96,6 +98,8 @@ export interface PublishInput {
|
||||
|
||||
/** is what publish answers. */
|
||||
export interface PublishAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the digest is held already: nothing to send; the outcome follows as an event */
|
||||
"held"?: boolean;
|
||||
/** the digests of the parts the holder lacks, to send by publish-part */
|
||||
@@ -122,6 +126,8 @@ export interface PublishPartInput {
|
||||
export interface PublishPartAnswer {
|
||||
/** the part is whole and its bytes match its digest */
|
||||
"complete"?: boolean;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the part */
|
||||
"part": string;
|
||||
/** the chunks of the part held so far */
|
||||
@@ -140,6 +146,8 @@ export interface VersionsInput {
|
||||
|
||||
/** is what versions answers. */
|
||||
export interface VersionsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the name */
|
||||
"name": string;
|
||||
/** newest first */
|
||||
@@ -163,6 +171,8 @@ export interface RemoveInput {
|
||||
/** is what remove answers. */
|
||||
export interface RemoveAnswer {
|
||||
"artifact"?: Artifact;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** it stays whole, its tag and its bytes: the store cannot remove the tag alone while another tag names its digest (reason, tags) */
|
||||
"kept"?: boolean;
|
||||
/** why it was kept: shared-digest, another tag names its digest */
|
||||
|
||||
@@ -28,6 +28,8 @@ export interface ArtifactsGone {
|
||||
"event": string;
|
||||
/** the key's fingerprint */
|
||||
"fingerprint": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** every reference of the key the store does not hold, sorted */
|
||||
"gone": string[];
|
||||
/** the builder's done key */
|
||||
@@ -55,6 +57,8 @@ export interface HeldInput {
|
||||
|
||||
/** is what held answers. */
|
||||
export interface HeldAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the references the store answered 404 for */
|
||||
"gone": string[];
|
||||
/** the references the store holds */
|
||||
|
||||
@@ -68,6 +68,8 @@ export interface PackagePublished {
|
||||
"dependencies"?: Dependency[];
|
||||
/** the published artifact's digest */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module */
|
||||
"module": string;
|
||||
/** the catalog revision number of that branch the build was made from, the indexer's count (design 47 H-A-218, H-A-220); absent from a reservation made before the field */
|
||||
@@ -86,6 +88,8 @@ export interface StepEnded {
|
||||
"ended"?: string;
|
||||
/** each entry the step built, by module and fingerprint */
|
||||
"entries": BuildEntry[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the ask's id */
|
||||
"id": string;
|
||||
/** the node the builder ran it on, as in the subject */
|
||||
@@ -135,6 +139,8 @@ export interface ToolchainAgreed {
|
||||
"at"?: string;
|
||||
/** each digest the nodes reporting the agreed version report, as it stood when the version was agreed, with those nodes (design 47 G section 472, section 495) */
|
||||
"digests": ToolchainAgreedDigestsItem[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the language whose agreed toolchain changed */
|
||||
"language": string;
|
||||
"v": number;
|
||||
@@ -164,6 +170,8 @@ export interface ReservedAnswer {
|
||||
"artifacts"?: ReservedAnswerArtifactsItem[];
|
||||
/** a name no entry carries, or a version neither reserved nor released, naming which; set alone (design 47 G 582, 679) */
|
||||
"error"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module */
|
||||
"module"?: string;
|
||||
/** true when the version is released: the catalog holds it, and artifacts are the ones its release recorded with their digests; false when it is reserved (design 47 G 582, 679) */
|
||||
@@ -188,6 +196,8 @@ export interface PublishedAnswer {
|
||||
"at"?: string;
|
||||
/** the published artifact's digest, when published; absent for a release kept before the digest was kept (design 47 H-A-331) */
|
||||
"digest"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** true when the artifact built at the fingerprint is published; a number a take-over withdrew is never published (design 47 H-A-331) */
|
||||
"published": boolean;
|
||||
/** the version it is published at, MAJOR.MINOR.PATCH, when published */
|
||||
|
||||
@@ -205,6 +205,8 @@ export interface BuildEdge {
|
||||
/** the newest build's edge entries of a module on a watched branch other than the first, keyed by its fingerprint, which releases no version (design 47 G section 374) */
|
||||
export interface BuildEdges {
|
||||
"edges": VersionEdge[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the build's fingerprint */
|
||||
"fp": string;
|
||||
"source"?: number;
|
||||
@@ -227,6 +229,8 @@ export interface CatalogEntry {
|
||||
"contributes"?: string[];
|
||||
/** the edges into this module's artifacts, each from the artifact that comes first; the build and the delivery order by these alone */
|
||||
"edges"?: Edge[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** its fingerprint (src2: and 64 hex digits); absent when it has none */
|
||||
"fp"?: string;
|
||||
"inputs"?: EntryInputs;
|
||||
@@ -285,6 +289,8 @@ export interface CatalogRevision {
|
||||
"definitions"?: CatalogRevisionDefinitionsItem[];
|
||||
/** one per module, by name */
|
||||
"entries": EntryRef[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a candidate's group */
|
||||
"group"?: string;
|
||||
/** a candidate's heads */
|
||||
@@ -354,6 +360,8 @@ export interface Fill {
|
||||
"bytes": number;
|
||||
/** bytes */
|
||||
"cap": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** what full refuses, such as the next revision and the pending merge it would take in */
|
||||
"refused"?: string;
|
||||
/** the kept data, by its name in the holder's manifest */
|
||||
@@ -418,6 +426,8 @@ export interface Registration {
|
||||
"branches": string[];
|
||||
/** who asked the change */
|
||||
"by"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"module": string;
|
||||
/** its git origin, the repository as <owner>/<name> */
|
||||
"origin": string;
|
||||
@@ -436,6 +446,8 @@ export interface Registration {
|
||||
export interface RegistrationAsked {
|
||||
/** the ask's id */
|
||||
"ask"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** every value the change moves, as the ask names it ("nats:program unit: required -> bypass") */
|
||||
"lines"?: string[];
|
||||
"module": string;
|
||||
@@ -501,6 +513,8 @@ export interface VersionEntry {
|
||||
"artifacts": VersionArtifact[];
|
||||
"at"?: string;
|
||||
"edges"?: VersionEdge[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** released late: lower than the module's highest, recorded and not said */
|
||||
"late"?: boolean;
|
||||
/** the module */
|
||||
@@ -571,6 +585,8 @@ export interface ModulesAnswerModulesItem {
|
||||
|
||||
/** is what modules answers. */
|
||||
export interface ModulesAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"modules": ModulesAnswerModulesItem[];
|
||||
}
|
||||
|
||||
@@ -597,6 +613,8 @@ export interface ModuleAnswerModule {
|
||||
|
||||
/** is what module answers. */
|
||||
export interface ModuleAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"module": ModuleAnswerModule;
|
||||
}
|
||||
|
||||
@@ -645,6 +663,8 @@ export interface SeatDefinitionsAnswerSeatsItem {
|
||||
/** is what seat-definitions answers. */
|
||||
export interface SeatDefinitionsAnswer {
|
||||
"entry"?: SeatDefinitionsAnswerEntry;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"found"?: boolean;
|
||||
"revision"?: number;
|
||||
"seat"?: string;
|
||||
@@ -671,6 +691,8 @@ export interface RevisionInput {
|
||||
export interface RevisionAnswer {
|
||||
/** this page's entries whole, by module name */
|
||||
"entries"?: CatalogEntry[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module to ask after for the next page; absent on the last */
|
||||
"next"?: string;
|
||||
/** true for a watched branch with no revision yet: no revision, no entries and no error follow, and a reader holds the branch's view ready and empty (design 47 G section 530) */
|
||||
@@ -689,6 +711,8 @@ export interface RegistrationsInput {
|
||||
/** is what registrations answers. */
|
||||
export interface RegistrationsAnswer {
|
||||
"fill"?: Fill;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** every version of the one module asked, oldest first */
|
||||
"history"?: Registration[];
|
||||
"registrations": Registration[];
|
||||
@@ -743,6 +767,8 @@ export interface VersionsInput {
|
||||
|
||||
/** is what versions answers. */
|
||||
export interface VersionsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module */
|
||||
"module": string;
|
||||
"versions": VersionEntry[];
|
||||
@@ -759,6 +785,8 @@ export interface OutdatedInput {
|
||||
/** is what outdated answers. */
|
||||
export interface OutdatedAnswer {
|
||||
"behind": Outdated[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is what input takes. */
|
||||
@@ -775,6 +803,8 @@ export interface InputAnswer {
|
||||
"chunks": number;
|
||||
/** the input's sha256 */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is what entry takes. */
|
||||
@@ -786,11 +816,15 @@ export interface EntryInput {
|
||||
/** is what entry answers. */
|
||||
export interface EntryAnswer {
|
||||
"entry": CatalogEntry;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is the body of the event seat-definition-changed. */
|
||||
export interface SeatDefinitionChangedEvent {
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"seat": string;
|
||||
/** trunk */
|
||||
"source": string;
|
||||
@@ -798,6 +832,8 @@ export interface SeatDefinitionChangedEvent {
|
||||
|
||||
/** is the body of the event seat-definition-removed. */
|
||||
export interface SeatDefinitionRemovedEvent {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"seat": string;
|
||||
}
|
||||
|
||||
@@ -814,6 +850,8 @@ export interface CatalogRevisionEvent {
|
||||
"changed"?: string[];
|
||||
/** how many entries it lists */
|
||||
"entries"?: number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"group"?: string;
|
||||
"heads"?: string;
|
||||
/** trunk or candidate: a candidate's moves no running part */
|
||||
@@ -842,6 +880,8 @@ export type RoomEvent = Fill;
|
||||
export interface RegistrationChangedEvent {
|
||||
"at"?: string;
|
||||
"by"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"module": string;
|
||||
/** every value it moved, one line each */
|
||||
"moved": string[];
|
||||
@@ -855,6 +895,8 @@ export interface VersionReleasedEvent {
|
||||
/** each artifact's digest */
|
||||
"artifacts": VersionArtifact[];
|
||||
"at"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module */
|
||||
"module": string;
|
||||
/** the source revision built */
|
||||
@@ -867,6 +909,8 @@ export interface VersionReleasedEvent {
|
||||
/** is the body of the event versions-filled. */
|
||||
export interface VersionsFilledEvent {
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** how many modules were filled */
|
||||
"modules"?: number;
|
||||
"v": number;
|
||||
@@ -874,6 +918,8 @@ export interface VersionsFilledEvent {
|
||||
|
||||
/** is one value of the state manifests under the key <digest>. */
|
||||
export interface ManifestsByDigestValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the manifest, UTF-8 JSON text */
|
||||
"manifest": string;
|
||||
"module": string;
|
||||
@@ -896,6 +942,8 @@ export interface ModulesByModuleValueInputs2 {
|
||||
/** is one value of the state modules under the key <module>. */
|
||||
export interface ModulesByModuleValue {
|
||||
"commit": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the old-form fingerprint */
|
||||
"fp"?: string;
|
||||
/** src2: fingerprint */
|
||||
@@ -941,6 +989,8 @@ export interface CandidatesByGroupValuePullsItem {
|
||||
export interface CandidatesByGroupValue {
|
||||
/** the source revision it is read on */
|
||||
"base": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"fpset"?: string;
|
||||
"group": string;
|
||||
"heads": string;
|
||||
@@ -954,6 +1004,8 @@ export interface PredefinedByListValue {
|
||||
/** when (RFC 3339 time) */
|
||||
"at"?: string;
|
||||
"commit": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the foundation's predefined list as kept */
|
||||
"list": unknown;
|
||||
/** the layout version */
|
||||
@@ -971,6 +1023,8 @@ export interface PackagesByModuleValue {
|
||||
"at"?: string;
|
||||
"commit": string;
|
||||
"dir"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the Go module path */
|
||||
"module": string;
|
||||
"packages": PackagesByModuleValuePackagesItem[];
|
||||
@@ -1041,6 +1095,8 @@ export interface PackagesByPackageSeriesValueNumbered {
|
||||
export interface PackagesByPackageSeriesValue {
|
||||
/** when (RFC 3339 time) */
|
||||
"at"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"go-module"?: string;
|
||||
"name": string;
|
||||
"newest"?: PackagesByPackageSeriesValueNewest;
|
||||
|
||||
@@ -82,6 +82,8 @@ export interface Fill {
|
||||
"bytes": number;
|
||||
/** bytes */
|
||||
"cap": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** what full refuses, such as the next record */
|
||||
"refused"?: string;
|
||||
/** the kept data, by its name in the holder's manifest */
|
||||
@@ -98,6 +100,8 @@ export interface Owed {
|
||||
"context"?: string;
|
||||
/** a status: what it says */
|
||||
"description"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the pull request's head the act is for */
|
||||
"head": string;
|
||||
/** the act's id, the same each time it is said again; a comment and a note line carry it, so the forge holds it once */
|
||||
@@ -168,6 +172,8 @@ export interface SourceAnswer {
|
||||
"call"?: string;
|
||||
/** why it could not be read */
|
||||
"error"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** every repository the source revision names, by name */
|
||||
"repositories"?: SourceHead[];
|
||||
/** the source revision's number on the bus; 0 before the first */
|
||||
@@ -197,6 +203,8 @@ export interface RecoveryAnswer {
|
||||
"by"?: string;
|
||||
/** the merge commit */
|
||||
"commit": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"recovery": boolean;
|
||||
/** the repository */
|
||||
"repository"?: string;
|
||||
@@ -213,6 +221,8 @@ export interface RecordOpenedEvent {
|
||||
"branch": string;
|
||||
/** the merge call */
|
||||
"call": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** its milestone, <branch>.<source> */
|
||||
"milestone": string;
|
||||
/** the record's id */
|
||||
@@ -238,6 +248,8 @@ export interface RecordEndedEvent {
|
||||
"branch": string;
|
||||
/** the merge call */
|
||||
"call": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** its milestone, <branch>.<source> */
|
||||
"milestone": string;
|
||||
/** the record's id */
|
||||
@@ -265,6 +277,8 @@ export interface SourceMovedEvent {
|
||||
"branch": string;
|
||||
/** the merge call that moved it */
|
||||
"call": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the repositories it moved */
|
||||
"heads": SourceMovedEventHeadsItem[];
|
||||
/** the source revision, numbered by the gate alone */
|
||||
@@ -283,6 +297,8 @@ export interface RecoveryMergedEvent {
|
||||
"by"?: string;
|
||||
/** the merge commit */
|
||||
"commit": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module the merge changed, from the delivery record */
|
||||
"module"?: string;
|
||||
/** the repository */
|
||||
@@ -296,6 +312,8 @@ export interface RecoveryMergedEvent {
|
||||
export interface SourceByBranchValue {
|
||||
/** the merge call that moved it; a call the newest revision already carries writes nothing (design 47 H §737, H-A-33) */
|
||||
"call": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** repository to the merged head, a full commit */
|
||||
"heads": Record<string, string>;
|
||||
/** the branch's source revision, one above its newest */
|
||||
@@ -309,6 +327,8 @@ export interface OwedByRepositoryNumberHeadActValue {
|
||||
/** status=<context>, view, note or comment.<seq> */
|
||||
"act": string;
|
||||
"context"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"ref"?: string;
|
||||
"state"?: string;
|
||||
"target"?: string;
|
||||
@@ -319,6 +339,8 @@ export interface OwedByRepositoryNumberHeadActValue {
|
||||
|
||||
/** is one value of the state heads under the key <repository>.<branch>. */
|
||||
export interface HeadsByRepositoryBranchValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the head head-moved said */
|
||||
"head": string;
|
||||
/** when it was first heard */
|
||||
|
||||
@@ -54,6 +54,8 @@ export declare function parseAnswersByAssignmentsProposalViewKey(_key: string):
|
||||
export interface Answer {
|
||||
/** the asking it answers */
|
||||
"asking": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the option the person chose */
|
||||
"option": string;
|
||||
"v"?: number;
|
||||
|
||||
@@ -168,6 +168,8 @@ export interface Fill {
|
||||
"bytes": number;
|
||||
/** bytes */
|
||||
"cap": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the kept data, by its name in the holder's manifest */
|
||||
"store": string;
|
||||
}
|
||||
@@ -176,6 +178,8 @@ export interface Fill {
|
||||
export interface KeptResult {
|
||||
/** sha256:<hex> of what the package's tests read */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** when a carry last read it: the runner ages it 30 days after (design 47 G section 330) */
|
||||
"last-read"?: string;
|
||||
/** unit or integration */
|
||||
@@ -190,6 +194,8 @@ export interface KeptResult {
|
||||
export interface LogEntry {
|
||||
"artifact"?: string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the keys of the kept results the step wrote or carried, <level>.<digest>, which the runner ages by their last-read (design 47 G sections 330, 470) */
|
||||
"kept"?: string[];
|
||||
/** the module of the mover whose step the entry is of (H-A-190) */
|
||||
@@ -256,6 +262,8 @@ export interface Pipeline {
|
||||
/** how often the pipeline has ended: 1 at its first end, one higher at each end again after a passing rerun, so the assigner takes a later end of the same source revision (design 47 G sections 29, 325) */
|
||||
"end-count"?: number;
|
||||
"ended"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** how many movers the pipeline has, set by list alone (H-A-191) */
|
||||
"mover-count"?: number;
|
||||
/** the modules the pipeline moves, its take-in's entries (design 47 H §746) */
|
||||
@@ -297,6 +305,8 @@ export interface PipelineEnded {
|
||||
/** how often the pipeline has ended: 1 at its first end, one higher at each end again after a passing rerun, so the assigner takes a later end of the same source revision (design 47 G sections 29, 325) */
|
||||
"end-count"?: number;
|
||||
"ended"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** per mover its fingerprint, released version, step results and tier, in the delivery order (design 47 H §746, H-A-2) */
|
||||
"movers": MoverEnded[];
|
||||
"outcome": "waiting" | "running" | "passed" | "failed" | "refused" | "superseded" | "cancelled";
|
||||
@@ -320,6 +330,8 @@ export interface PipelineStarted {
|
||||
"branch": string;
|
||||
/** the merge call whose source revision the take-in took in (design 47 H §746) */
|
||||
"call"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the pipeline's movers */
|
||||
"movers": Mover[];
|
||||
/** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
|
||||
@@ -348,6 +360,8 @@ export interface RunStarted {
|
||||
"at"?: string;
|
||||
/** the caller the runtime proved */
|
||||
"by": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"members": Member[];
|
||||
"run": string;
|
||||
"v": number;
|
||||
@@ -382,6 +396,8 @@ export interface StepEvent {
|
||||
"commit": string;
|
||||
/** the module's build-input fingerprint at the commit */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"module": string;
|
||||
/** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
|
||||
"pipeline": string;
|
||||
@@ -501,6 +517,8 @@ export interface Wait {
|
||||
"commit"?: string;
|
||||
/** the module's build-input fingerprint at the commit */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** for its end, how it ended: answered, ran, superseded */
|
||||
"how"?: string;
|
||||
/** for a step's wait, the mover whose step waits (design 47 H-A-72) */
|
||||
@@ -527,6 +545,8 @@ export interface Wait {
|
||||
|
||||
/** a pipeline waiting its turn under pipelines-at-once (design 47 H §748, H-A-72) */
|
||||
export interface Waiting {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the pipeline's key, <branch>.<revision>, or <branch>.<source>.published.<package>.<version> for a pipeline a publish started; a branch escaped as a key's name is (design 47 H §746, §747) */
|
||||
"pipeline": string;
|
||||
}
|
||||
@@ -548,6 +568,8 @@ export interface RunInput {
|
||||
|
||||
/** is what run answers. */
|
||||
export interface RunAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the pipelines' keys */
|
||||
"pipelines"?: string[];
|
||||
"run": string;
|
||||
@@ -563,6 +585,8 @@ export interface StartInput {
|
||||
|
||||
/** is what start answers. */
|
||||
export interface StartAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipeline": string;
|
||||
}
|
||||
|
||||
@@ -577,6 +601,8 @@ export interface ShowInput {
|
||||
/** is what show answers. */
|
||||
export interface ShowAnswer {
|
||||
"fill"?: Fill[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"log"?: LogEntry[];
|
||||
/** the outputs' names in step-outputs */
|
||||
"outputs"?: string[];
|
||||
@@ -595,6 +621,8 @@ export interface ListInput {
|
||||
/** is what list answers. */
|
||||
export interface ListAnswer {
|
||||
"fill"?: Fill;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipelines": Pipeline[];
|
||||
}
|
||||
|
||||
@@ -604,6 +632,8 @@ export interface StandsInput {
|
||||
|
||||
/** is what stands answers. */
|
||||
export interface StandsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"stands": Wait[];
|
||||
}
|
||||
|
||||
@@ -618,6 +648,8 @@ export interface WhyCarriedInput {
|
||||
/** is what why-carried answers. */
|
||||
export interface WhyCarriedAnswer {
|
||||
"carried-from"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"kept"?: KeptResult[];
|
||||
}
|
||||
|
||||
@@ -631,6 +663,8 @@ export interface KeptInput {
|
||||
/** is what kept answers. */
|
||||
export interface KeptAnswer {
|
||||
"fill"?: Fill;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"kept": KeptResult[];
|
||||
}
|
||||
|
||||
@@ -646,6 +680,8 @@ export interface ReviewInput {
|
||||
|
||||
/** is what review answers. */
|
||||
export interface ReviewAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipeline"?: string;
|
||||
"result": StepResult;
|
||||
}
|
||||
@@ -664,6 +700,8 @@ export interface RerunInput {
|
||||
|
||||
/** is what rerun answers. */
|
||||
export interface RerunAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipeline": string;
|
||||
"result"?: StepResult;
|
||||
}
|
||||
@@ -682,6 +720,8 @@ export interface AcceptInput {
|
||||
|
||||
/** is what accept answers. */
|
||||
export interface AcceptAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"result": StepResult;
|
||||
}
|
||||
|
||||
@@ -695,6 +735,8 @@ export interface CancelInput {
|
||||
|
||||
/** is what cancel answers. */
|
||||
export interface CancelAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipeline": Pipeline;
|
||||
}
|
||||
|
||||
@@ -708,6 +750,8 @@ export interface EndAgainInput {
|
||||
|
||||
/** is what end-again answers. */
|
||||
export interface EndAgainAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipeline": Pipeline;
|
||||
}
|
||||
|
||||
@@ -721,6 +765,8 @@ export interface PlaceInput {
|
||||
|
||||
/** is what place answers. */
|
||||
export interface PlaceAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"pipeline": Pipeline;
|
||||
}
|
||||
|
||||
@@ -736,6 +782,8 @@ export interface AskAgainInput {
|
||||
|
||||
/** is what ask-again answers. */
|
||||
export interface AskAgainAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"result": StepResult;
|
||||
}
|
||||
|
||||
@@ -751,6 +799,8 @@ export interface TestRunsInput {
|
||||
/** is what test-runs answers. */
|
||||
export interface TestRunsAnswer {
|
||||
"fill": Fill;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"runs": TestRun[];
|
||||
}
|
||||
|
||||
@@ -766,6 +816,8 @@ export interface TestRunsDropInput {
|
||||
export interface TestRunsDropAnswer {
|
||||
/** the readers it ended */
|
||||
"ended"?: TestRunReader[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the entry deleted */
|
||||
"run": TestRun;
|
||||
}
|
||||
@@ -811,6 +863,8 @@ export type PipelinesByBranchRunRunValue = Pipeline;
|
||||
|
||||
/** is one value of the state pipelines under the key steps.<pipeline>.<mover>. */
|
||||
export interface PipelinesByStepsPipelineMoverValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the mover's steps */
|
||||
"steps": StepResult[];
|
||||
/** the step-log entries of the mover's steps that ended and are not appended to the step log yet, in order (H-A-189) */
|
||||
@@ -825,6 +879,8 @@ export type QueueByWaitingSequenceValue = Waiting;
|
||||
|
||||
/** is one value of the state queue under the key running.<pipeline>. */
|
||||
export interface QueueByRunningPipelineValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the pipeline's key, as the key names it */
|
||||
"pipeline": string;
|
||||
}
|
||||
|
||||
@@ -180,6 +180,8 @@ export interface Ask {
|
||||
"ask": Record<string, unknown>;
|
||||
/** the times the assigner wrote the ask at this key: 0 or 1 for the first, n for the n-th */
|
||||
"asking"?: number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"v"?: number;
|
||||
}
|
||||
|
||||
@@ -190,6 +192,8 @@ export interface AssignmentEntry {
|
||||
/** the digest of its catalog graph entry */
|
||||
"catalog": string;
|
||||
"edges"?: Edge[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the fingerprint it is to run */
|
||||
"fp": string;
|
||||
/** the requirements no step of the order resolves (design 47 G section 357): the entry is held, naming the candidates, and nothing is guessed */
|
||||
@@ -219,6 +223,8 @@ export interface AssignmentRevision {
|
||||
/** what made it: catalog-revision, placement-changed or capabilities-changed */
|
||||
"cause"?: string;
|
||||
"entries": NodeEntryRef[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"group"?: string;
|
||||
"heads"?: string;
|
||||
/** trunk or candidate */
|
||||
@@ -333,6 +339,8 @@ export interface DifferenceRefusedItem {
|
||||
/** two assignment graph revisions compared: a change's delivery, with its order read off the edges and no plan stored (ADR 0656) */
|
||||
export interface Difference {
|
||||
"changes": Change[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the revision compared from */
|
||||
"from": number;
|
||||
"group"?: string;
|
||||
@@ -371,6 +379,8 @@ export interface Fill {
|
||||
"bytes": number;
|
||||
/** bytes */
|
||||
"cap": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** what full refuses */
|
||||
"refused"?: string;
|
||||
/** the kept data, by its name in the holder's manifest */
|
||||
@@ -409,6 +419,8 @@ export interface NotRunning {
|
||||
/** a pipeline's wants written to the end, said once: running when every tier's movers run on every present placing machine, tier-late when a tier passed tier-bound (design 47 H §751, H-A-56, H-A-72, H-A-75) */
|
||||
export interface PipelineWanted {
|
||||
"branch": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** for tier-late, the late tier's movers not running and the machines they do not run on */
|
||||
"not-running"?: NotRunning[];
|
||||
"outcome": "running" | "tier-late";
|
||||
@@ -447,6 +459,8 @@ export interface StepEnded {
|
||||
"commit": string;
|
||||
"ended"?: string;
|
||||
"fingerprint": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the ask's id */
|
||||
"id": string;
|
||||
"module": string;
|
||||
@@ -504,6 +518,8 @@ export interface Wait {
|
||||
"clock-from"?: string;
|
||||
/** a put's wait: the fingerprint of the build put */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"fp"?: string;
|
||||
/** on wait-ended: ran, released or superseded */
|
||||
"how"?: string;
|
||||
@@ -561,6 +577,8 @@ export interface RevisionInput {
|
||||
|
||||
/** is what revision answers. */
|
||||
export interface RevisionAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"revision": AssignmentRevision;
|
||||
}
|
||||
|
||||
@@ -581,6 +599,8 @@ export interface EntryInput {
|
||||
export interface EntryAnswer {
|
||||
"digest": string;
|
||||
"entry": AssignmentEntry;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is what difference takes. */
|
||||
@@ -608,6 +628,8 @@ export interface InputAnswer {
|
||||
"chunks": number;
|
||||
/** the input's sha256 */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is what compositions takes. */
|
||||
@@ -620,6 +642,8 @@ export interface CompositionsInput {
|
||||
/** is what compositions answers. */
|
||||
export interface CompositionsAnswer {
|
||||
"fill": Fill;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"runs": CompositionRun[];
|
||||
}
|
||||
|
||||
@@ -636,6 +660,8 @@ export interface CompositionsDropInput {
|
||||
export interface CompositionsDropAnswer {
|
||||
/** the readers it ended */
|
||||
"ended"?: CompositionReader[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the entry deleted */
|
||||
"run": CompositionRun;
|
||||
}
|
||||
@@ -652,6 +678,8 @@ export interface AssignmentRevisionEvent {
|
||||
/** the catalog graph revision of each watched branch a placement names, which the entries come from */
|
||||
"catalogs": CatalogOf[];
|
||||
"cause"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"group"?: string;
|
||||
"heads"?: string;
|
||||
"kind": string;
|
||||
@@ -663,6 +691,8 @@ export interface AssignmentRevisionEvent {
|
||||
export interface DifferenceEvent {
|
||||
/** how many module versions it changes */
|
||||
"changes"?: number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"from": number;
|
||||
"group"?: string;
|
||||
"heads"?: string;
|
||||
@@ -675,6 +705,8 @@ export interface DifferenceEvent {
|
||||
/** is the body of the event wanted. */
|
||||
export interface WantedEvent {
|
||||
"at"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"fp": string;
|
||||
"module": string;
|
||||
"node": string;
|
||||
@@ -713,6 +745,8 @@ export interface StepProgressEvent {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"phase": "fetch" | "build" | "run" | "report";
|
||||
/** the composition runs the step waits on, by machine, each with its ask (design 47 G §723, §729) */
|
||||
"shared"?: Shared[];
|
||||
@@ -722,6 +756,8 @@ export interface StepProgressEvent {
|
||||
export interface WantsByWantNodeModuleValue {
|
||||
/** again or skip */
|
||||
"backup"?: "again" | "skip";
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"fp"?: string;
|
||||
"hold"?: boolean;
|
||||
/** the pipeline whose passed end released the version, its key <branch>.<source>; absent for a placement's build (design 47 H §750, H-A-37) */
|
||||
@@ -744,6 +780,8 @@ export interface WantsByWantNodeModuleValue {
|
||||
/** is one value of the state wants under the key want.<node>.node. */
|
||||
export interface WantsByWantNodeNodeValue {
|
||||
"composed": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"self"?: boolean;
|
||||
"v"?: number;
|
||||
"words"?: string;
|
||||
@@ -751,6 +789,8 @@ export interface WantsByWantNodeNodeValue {
|
||||
|
||||
/** is one value of the state wants under the key held.<module>.<fingerprint>. */
|
||||
export interface WantsByHeldModuleFingerprintValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"node": string;
|
||||
"v"?: number;
|
||||
"words"?: string;
|
||||
@@ -779,6 +819,8 @@ export type AsksByAssignmentsProposalValue = Ask;
|
||||
|
||||
/** is one value of the state differences under the key <node>.<module>. */
|
||||
export interface DifferencesByNodeModuleValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"rule"?: number;
|
||||
"sent"?: string;
|
||||
"sent-build"?: string;
|
||||
@@ -791,6 +833,8 @@ export interface DifferencesByNodeModuleValue {
|
||||
|
||||
/** is one value of the state compositions under the key <group>.<heads>. */
|
||||
export interface CompositionsByGroupHeadsValue {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"group": string;
|
||||
/** 12 lowercase hex digits */
|
||||
"heads": string;
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface AskTaken {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the node that took it, as in the subject */
|
||||
"node": string;
|
||||
}
|
||||
@@ -429,6 +431,8 @@ export interface StepEnded {
|
||||
"commit"?: string;
|
||||
"ended"?: string;
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the ask's id */
|
||||
"id": string;
|
||||
/** the packages that passed at their digest, for the runner to keep */
|
||||
@@ -458,6 +462,8 @@ export interface StepProgress {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"phase": "fetch" | "build" | "run" | "report";
|
||||
}
|
||||
|
||||
@@ -554,6 +560,8 @@ export interface Toolchain {
|
||||
export interface ToolchainReported {
|
||||
/** the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"language": string;
|
||||
"node": string;
|
||||
"recipe": string;
|
||||
@@ -619,6 +627,8 @@ export interface KeptArtifactAnswer {
|
||||
"digest"?: string;
|
||||
/** why it could not answer */
|
||||
"error"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the fingerprint asked */
|
||||
"fp": string;
|
||||
/** the module asked */
|
||||
@@ -658,6 +668,8 @@ export interface StepsAnswer {
|
||||
/** why a drop deleted nothing, naming the hand-act log when it refused */
|
||||
"error"?: string;
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** answered from the kept answer */
|
||||
"kept"?: boolean;
|
||||
"steps"?: DetectedStep[];
|
||||
@@ -677,6 +689,8 @@ export interface OutputAnswer {
|
||||
"ask": string;
|
||||
/** how many chunks are sent; 0 when this node keeps no answer of that ask */
|
||||
"chunks": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is the body of the event step-ended. */
|
||||
|
||||
+14
@@ -33,6 +33,8 @@ export interface AskTaken {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the node that took it, as in the subject */
|
||||
"node": string;
|
||||
}
|
||||
@@ -429,6 +431,8 @@ export interface StepEnded {
|
||||
"commit"?: string;
|
||||
"ended"?: string;
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the ask's id */
|
||||
"id": string;
|
||||
/** the packages that passed at their digest, for the runner to keep */
|
||||
@@ -458,6 +462,8 @@ export interface StepProgress {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"phase": "fetch" | "build" | "run" | "report";
|
||||
}
|
||||
|
||||
@@ -554,6 +560,8 @@ export interface Toolchain {
|
||||
export interface ToolchainReported {
|
||||
/** the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"language": string;
|
||||
"node": string;
|
||||
"recipe": string;
|
||||
@@ -619,6 +627,8 @@ export interface KeptArtifactAnswer {
|
||||
"digest"?: string;
|
||||
/** why it could not answer */
|
||||
"error"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the fingerprint asked */
|
||||
"fp": string;
|
||||
/** the module asked */
|
||||
@@ -658,6 +668,8 @@ export interface StepsAnswer {
|
||||
/** why a drop deleted nothing, naming the hand-act log when it refused */
|
||||
"error"?: string;
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** answered from the kept answer */
|
||||
"kept"?: boolean;
|
||||
"steps"?: DetectedStep[];
|
||||
@@ -677,6 +689,8 @@ export interface OutputAnswer {
|
||||
"ask": string;
|
||||
/** how many chunks are sent; 0 when this node keeps no answer of that ask */
|
||||
"chunks": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is the body of the event step-ended. */
|
||||
|
||||
@@ -33,6 +33,8 @@ export interface AskTaken {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the node that took it, as in the subject */
|
||||
"node": string;
|
||||
}
|
||||
@@ -429,6 +431,8 @@ export interface StepEnded {
|
||||
"commit"?: string;
|
||||
"ended"?: string;
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the ask's id */
|
||||
"id": string;
|
||||
/** the packages that passed at their digest, for the runner to keep */
|
||||
@@ -458,6 +462,8 @@ export interface StepProgress {
|
||||
"ask": string;
|
||||
"asker": string;
|
||||
"at": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"phase": "fetch" | "build" | "run" | "report";
|
||||
}
|
||||
|
||||
@@ -554,6 +560,8 @@ export interface Toolchain {
|
||||
export interface ToolchainReported {
|
||||
/** the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"language": string;
|
||||
"node": string;
|
||||
"recipe": string;
|
||||
@@ -619,6 +627,8 @@ export interface KeptArtifactAnswer {
|
||||
"digest"?: string;
|
||||
/** why it could not answer */
|
||||
"error"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the fingerprint asked */
|
||||
"fp": string;
|
||||
/** the module asked */
|
||||
@@ -658,6 +668,8 @@ export interface StepsAnswer {
|
||||
/** why a drop deleted nothing, naming the hand-act log when it refused */
|
||||
"error"?: string;
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** answered from the kept answer */
|
||||
"kept"?: boolean;
|
||||
"steps"?: DetectedStep[];
|
||||
@@ -677,6 +689,8 @@ export interface OutputAnswer {
|
||||
"ask": string;
|
||||
/** how many chunks are sent; 0 when this node keeps no answer of that ask */
|
||||
"chunks": number;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
}
|
||||
|
||||
/** is the body of the event step-ended. */
|
||||
|
||||
+10
@@ -42,6 +42,8 @@ export interface Outcome {
|
||||
"digest": string;
|
||||
/** the build's fingerprint */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module holding the seat that said it */
|
||||
"holder": string;
|
||||
/** what it is */
|
||||
@@ -96,6 +98,8 @@ export interface PublishInput {
|
||||
|
||||
/** is what publish answers. */
|
||||
export interface PublishAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the digest is held already: nothing to send; the outcome follows as an event */
|
||||
"held"?: boolean;
|
||||
/** the digests of the parts the holder lacks, to send by publish-part */
|
||||
@@ -122,6 +126,8 @@ export interface PublishPartInput {
|
||||
export interface PublishPartAnswer {
|
||||
/** the part is whole and its bytes match its digest */
|
||||
"complete"?: boolean;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the part */
|
||||
"part": string;
|
||||
/** the chunks of the part held so far */
|
||||
@@ -140,6 +146,8 @@ export interface VersionsInput {
|
||||
|
||||
/** is what versions answers. */
|
||||
export interface VersionsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the name */
|
||||
"name": string;
|
||||
/** newest first */
|
||||
@@ -163,6 +171,8 @@ export interface RemoveInput {
|
||||
/** is what remove answers. */
|
||||
export interface RemoveAnswer {
|
||||
"artifact"?: Artifact;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** it stays whole, its tag and its bytes: the store cannot remove the tag alone while another tag names its digest (reason, tags) */
|
||||
"kept"?: boolean;
|
||||
/** why it was kept: shared-digest, another tag names its digest */
|
||||
|
||||
@@ -80,6 +80,8 @@ export interface Hold {
|
||||
"by"?: string;
|
||||
/** the digest */
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module holding the seat */
|
||||
"holder": string;
|
||||
/** the name */
|
||||
@@ -124,6 +126,8 @@ export interface HoldInput {
|
||||
|
||||
/** is what hold answers. */
|
||||
export interface HoldAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** it is held */
|
||||
"held": boolean;
|
||||
/** when the hold began, RFC 3339 */
|
||||
@@ -142,6 +146,8 @@ export interface ReleaseInput {
|
||||
|
||||
/** is what release answers. */
|
||||
export interface ReleaseAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** a hold was let go; false when there was none */
|
||||
"released": boolean;
|
||||
}
|
||||
@@ -154,6 +160,8 @@ export interface ListInput {
|
||||
|
||||
/** is what list answers. */
|
||||
export interface ListAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** each repository named, in order of its name */
|
||||
"repositories": Repository[];
|
||||
}
|
||||
@@ -168,6 +176,8 @@ export type ReleasedEvent = Hold;
|
||||
export interface HoldsBySeatNameDigestValue {
|
||||
"by": string;
|
||||
"digest": string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
"kind": string;
|
||||
"name": string;
|
||||
"seat": string;
|
||||
@@ -190,6 +200,8 @@ export interface WindowsByCallerValue {
|
||||
"closed"?: string;
|
||||
/** retired nodes dropped by hand */
|
||||
"dropped"?: WindowsByCallerValueDroppedItem[];
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the nodes holding it open */
|
||||
"holding"?: string[];
|
||||
"last_holding"?: string[];
|
||||
|
||||
+10
@@ -42,6 +42,8 @@ export interface Outcome {
|
||||
"digest": string;
|
||||
/** the build's fingerprint */
|
||||
"fingerprint"?: string;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the module holding the seat that said it */
|
||||
"holder": string;
|
||||
/** what it is */
|
||||
@@ -96,6 +98,8 @@ export interface PublishInput {
|
||||
|
||||
/** is what publish answers. */
|
||||
export interface PublishAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the digest is held already: nothing to send; the outcome follows as an event */
|
||||
"held"?: boolean;
|
||||
/** the digests of the parts the holder lacks, to send by publish-part */
|
||||
@@ -122,6 +126,8 @@ export interface PublishPartInput {
|
||||
export interface PublishPartAnswer {
|
||||
/** the part is whole and its bytes match its digest */
|
||||
"complete"?: boolean;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the part */
|
||||
"part": string;
|
||||
/** the chunks of the part held so far */
|
||||
@@ -140,6 +146,8 @@ export interface VersionsInput {
|
||||
|
||||
/** is what versions answers. */
|
||||
export interface VersionsAnswer {
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** the name */
|
||||
"name": string;
|
||||
/** newest first */
|
||||
@@ -163,6 +171,8 @@ export interface RemoveInput {
|
||||
/** is what remove answers. */
|
||||
export interface RemoveAnswer {
|
||||
"artifact"?: Artifact;
|
||||
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
|
||||
"form"?: number;
|
||||
/** it stays whole, its tag and its bytes: the store cannot remove the tag alone while another tag names its digest (reason, tags) */
|
||||
"kept"?: boolean;
|
||||
/** why it was kept: shared-digest, another tag names its digest */
|
||||
|
||||
@@ -120,7 +120,7 @@ func (ix *Indexer) hearBranchBuild(ctx context.Context, p meshbuilds.PackagePubl
|
||||
return write(ctx, ix.BuildEdges, BuildEdgesKey(p.Module, p.Branch), func(raw []byte, found bool) ([]byte, bool, error) {
|
||||
be := meshcatalog.BuildEdges{V: 1, Fp: entry.Fp, Source: p.Source}
|
||||
if found {
|
||||
kept, err := meshcatalog.DecodeBuildEdgesByModuleBranchValue(raw)
|
||||
kept, _, err := meshcatalog.DecodeBuildEdgesByModuleBranchValue(raw)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
@@ -213,7 +213,7 @@ func (ix *Indexer) outdatedBranchBuilds(ctx context.Context, in meshcatalog.Outd
|
||||
if err != nil || !found {
|
||||
continue
|
||||
}
|
||||
be, err := meshcatalog.DecodeBuildEdgesByModuleBranchValue(raw)
|
||||
be, _, err := meshcatalog.DecodeBuildEdgesByModuleBranchValue(raw)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the key %s of the state %s: %w", k, BuildEdgesState, err)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestABuildOfAnotherWatchedBranchKeepsItsEdgesAndIsOutdatedAgainstThatBranch
|
||||
t.Errorf("a build of beta released %v", v)
|
||||
}
|
||||
raw, _, found, _ := ix.BuildEdges.Get(ctx, BuildEdgesKey("app", "beta"))
|
||||
be, err := meshcatalog.DecodeBuildEdgesByModuleBranchValue(raw)
|
||||
be, _, err := meshcatalog.DecodeBuildEdgesByModuleBranchValue(raw)
|
||||
if !found || err != nil || be.Fp != fp("b") || be.Source != 7 || len(be.Edges) != 1 || be.Edges[0].Digest != "d1" {
|
||||
t.Fatalf("build-edges of app on beta: %+v (found %v, %v), want the fingerprint of the entry at source 7 and its kind 1 edge", be, found, err)
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ func InputsReadTool(st Store, objs stateobjects.Objects) stdio.Tool {
|
||||
if ref, isRef := stateobjects.ReadRef(raw); isRef {
|
||||
kept = InputKept{Key: k, Digest: d, Bytes: base64.StdEncoding.DecodedLen(int(ref.Size) - 2)} // the quotes of the JSON string
|
||||
} else {
|
||||
text, _ := meshcatalog.DecodeInputsByTimeDigestValue(raw)
|
||||
text, _, _ := meshcatalog.DecodeInputsByTimeDigestValue(raw)
|
||||
kept = InputKept{Key: k, Digest: d, Bytes: base64.StdEncoding.DecodedLen(len(text))}
|
||||
}
|
||||
if want != "" {
|
||||
|
||||
@@ -70,7 +70,7 @@ func DecodeToolchain(data []byte) (nodebuildgo.Toolchain, error) {
|
||||
if err := keys.CheckVersion(data); err != nil {
|
||||
return nodebuildgo.Toolchain{}, err
|
||||
}
|
||||
t, err := nodebuildgo.DecodeToolchainsByNodeLanguageValue(data)
|
||||
t, _, err := nodebuildgo.DecodeToolchainsByNodeLanguageValue(data)
|
||||
if err != nil {
|
||||
return nodebuildgo.Toolchain{}, fmt.Errorf("index: a toolchain does not fit its shape: %w", err)
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func ModuleVersions(ctx context.Context, st Store, module string) ([]meshcatalog
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
v, err := meshcatalog.DecodeVersionsByModuleVersionValue(raw)
|
||||
v, _, err := meshcatalog.DecodeVersionsByModuleVersionValue(raw)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the key %s of the state %s: %w", k, VersionsState, err)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func waitingOf(queue pipeline.Kept) ([]Waiting, error) {
|
||||
if err != nil || raw == nil {
|
||||
continue
|
||||
}
|
||||
w, err := seat.DecodeQueueByWaitingSequenceValue(raw)
|
||||
w, _, err := seat.DecodeQueueByWaitingSequenceValue(raw)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the queue's %s is no waiting pipeline: %w", k, err)
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ func composeSteps(p *seat.Pipeline, key string, vals map[string][]byte) error {
|
||||
steps := []seat.StepResult{}
|
||||
unlogged := append([]seat.LogEntry(nil), p.Unlogged...)
|
||||
for _, k := range order {
|
||||
v, err := seat.DecodePipelinesByStepsPipelineMoverValue(vals[k])
|
||||
v, _, err := seat.DecodePipelinesByStepsPipelineMoverValue(vals[k])
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s holds no mover's steps: %w", k, err)
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ func TestMoverKeys(t *testing.T) {
|
||||
}
|
||||
var rec seat.Pipeline
|
||||
_ = json.Unmarshal(m.vals[key], &rec)
|
||||
beta, _ := seat.DecodePipelinesByStepsPipelineMoverValue(m.vals["steps.main.7.beta"])
|
||||
beta, _, _ := seat.DecodePipelinesByStepsPipelineMoverValue(m.vals["steps.main.7.beta"])
|
||||
q, _, _ := s.Get(key)
|
||||
var got []string
|
||||
for _, e := range q.Unlogged {
|
||||
|
||||
@@ -85,7 +85,7 @@ func (q *Queue) Waiting() ([]string, []string, error) {
|
||||
} else if err != nil {
|
||||
return nil, nil, fmt.Errorf("the queue's %s is not read: %w", k, err)
|
||||
}
|
||||
w, err := seat.DecodeQueueByWaitingSequenceValue(raw)
|
||||
w, _, err := seat.DecodeQueueByWaitingSequenceValue(raw)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("the queue's %s is no waiting pipeline: %w", k, err)
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func (q *Queue) next() (int64, error) {
|
||||
raw, rev, err := q.Store.Get(seat.QueueByQueueNextKey())
|
||||
var seq int64 = 1
|
||||
if err == nil {
|
||||
if seq, err = seat.DecodeQueueByQueueNextValue(raw); err != nil {
|
||||
if seq, _, err = seat.DecodeQueueByQueueNextValue(raw); err != nil {
|
||||
return 0, fmt.Errorf("the queue's counter is no number: %w", err)
|
||||
}
|
||||
} else if !errors.Is(err, ErrNoKey) {
|
||||
|
||||
@@ -161,7 +161,7 @@ func (r Reads) KeptResults(in seat.KeptInput) (seat.KeptAnswer, error) {
|
||||
if raw == nil {
|
||||
continue
|
||||
}
|
||||
v, err := seat.DecodeKeptByLevelDigestValue(raw)
|
||||
v, _, err := seat.DecodeKeptByLevelDigestValue(raw)
|
||||
if err != nil {
|
||||
return seat.KeptAnswer{}, fmt.Errorf("%s %s: %w", seat.StateKept, k, err)
|
||||
}
|
||||
@@ -210,7 +210,7 @@ func (r Reads) pipelineOf(key string, all []string) (seat.Pipeline, bool, error)
|
||||
if err != nil {
|
||||
return seat.Pipeline{}, false, fmt.Errorf("%s %s: %w", seat.StatePipelines, key, err)
|
||||
}
|
||||
p, err := seat.DecodePipelinesByBranchRevisionValue(raw)
|
||||
p, _, err := seat.DecodePipelinesByBranchRevisionValue(raw)
|
||||
if err != nil {
|
||||
return seat.Pipeline{}, false, fmt.Errorf("%s %s: %w", seat.StatePipelines, key, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
package seatgen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
goregexp "regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/seatdef"
|
||||
)
|
||||
|
||||
// The form of a seat's values, events and answers (design 47 H2 §780; H-A-352): one integer per seat definition, and a
|
||||
// part's own for what it adds, raised at every field added or removed; left out of a definition while it is 1, and an
|
||||
// absent form reads as 1. Every value, event body and verb answer carries it as the wire field `form` (left out while
|
||||
// 1), and its generated decoder keeps going past a field it does not know and answers the form it read. Each
|
||||
// generated contract carries its forms and a digest of its fields, so the compare step fails a definition whose fields
|
||||
// changed while its forms did not.
|
||||
|
||||
// formOf is a form as a definition gives it: absent reads as 1.
|
||||
func formOf(n int) int {
|
||||
if n < 1 {
|
||||
return 1
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// formField is the wire field every value, event and answer carries.
|
||||
const formField = "form"
|
||||
|
||||
// addForms gives each struct type another part reads the field `form`, unless its definition names one already.
|
||||
func (tp *typer) addForms() {
|
||||
byName := map[string]int{}
|
||||
for i, t := range tp.types {
|
||||
byName[t.name] = i
|
||||
}
|
||||
for _, n := range tp.readBy {
|
||||
i, ok := byName[n]
|
||||
if ok && tp.types[i].t.kind == "ref" {
|
||||
// An answer or event that is one of the definition's own types: that type is what travels.
|
||||
i, ok = byName[tp.types[i].t.ref]
|
||||
}
|
||||
if !ok || tp.types[i].t.kind != "struct" {
|
||||
continue
|
||||
}
|
||||
t := tp.types[i].t
|
||||
if hasField(t, formField) {
|
||||
continue
|
||||
}
|
||||
f := field{json: formField, desc: "is the form of what this value carries, left out while it is 1 (design 47 H2 §780).",
|
||||
t: &typ{kind: "integer"}}
|
||||
at := sort.Search(len(t.fields), func(j int) bool { return t.fields[j].json >= formField })
|
||||
t.fields = append(t.fields[:at], append([]field{f}, t.fields[at:]...)...)
|
||||
}
|
||||
}
|
||||
|
||||
func hasField(t *typ, name string) bool {
|
||||
for _, f := range t.fields {
|
||||
if f.json == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// formsOf is the seat's form and each included part's, in one line: `<seat form>` and ` <part>:<form>` per part in
|
||||
// the order included.
|
||||
func formsOf(m *Module, d seatdef.Definition) string {
|
||||
out := fmt.Sprint(formOf(d.Form))
|
||||
for _, p := range m.Raw[d.Seat].Includes {
|
||||
out += fmt.Sprintf(" %s:%d", p, formOf(m.Parts[p].Form))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// fieldsDigest is the digest of the names and types of every value, event, accept and answer of the seat and of every
|
||||
// type they reach; the field `form` itself is not counted.
|
||||
func fieldsDigest(tp *typer) string {
|
||||
kinds := map[string]*typ{}
|
||||
for _, t := range tp.types {
|
||||
kinds[t.name] = t.t
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
var lines []string
|
||||
var walk func(t *typ)
|
||||
var visit func(name string)
|
||||
walk = func(t *typ) {
|
||||
if t == nil {
|
||||
return
|
||||
}
|
||||
if t.kind == "ref" {
|
||||
visit(t.ref)
|
||||
}
|
||||
walk(t.elem)
|
||||
for _, f := range t.fields {
|
||||
walk(f.t)
|
||||
}
|
||||
}
|
||||
visit = func(name string) {
|
||||
if seen[name] {
|
||||
return
|
||||
}
|
||||
seen[name] = true
|
||||
t, ok := kinds[name]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if t.kind != "struct" {
|
||||
lines = append(lines, name+" = "+goType(t, kinds, true)+" "+strings.Join(t.enum, "|"))
|
||||
} else {
|
||||
for _, f := range t.fields {
|
||||
if f.json == formField {
|
||||
continue
|
||||
}
|
||||
lines = append(lines, fmt.Sprintf("%s.%s %s %v %s", name, f.json, goType(f.t, kinds, f.required), f.required, strings.Join(f.t.enum, "|")))
|
||||
}
|
||||
}
|
||||
walk(t)
|
||||
}
|
||||
for _, n := range append(append([]string{}, tp.readBy...), tp.accepts...) {
|
||||
visit(n)
|
||||
}
|
||||
sort.Strings(lines)
|
||||
sum := sha256.Sum256([]byte(strings.Join(lines, "\n")))
|
||||
return hex.EncodeToString(sum[:])
|
||||
}
|
||||
|
||||
// writeForms writes the seat's forms and the digest of its fields.
|
||||
func writeForms(b *bytes.Buffer, m *Module, d seatdef.Definition, tp *typer) {
|
||||
fmt.Fprintf(b, "// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780):\n"+
|
||||
"// a reader of a value of another form says \"form N, this reader knows M\".\nconst Form = %d\n\n", formOf(d.Form))
|
||||
for _, p := range m.Raw[d.Seat].Includes {
|
||||
fmt.Fprintf(b, "// Form%s is the form of what the part %s adds.\nconst Form%s = %d\n\n", ident(p), p, ident(p), formOf(m.Parts[p].Form))
|
||||
}
|
||||
fmt.Fprintf(b, "// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition\n"+
|
||||
"// whose fields changed while its forms did not (design 47 H2 §780).\nconst (\n\tgeneratedForms = %q\n\tgeneratedFieldsDigest = %q\n)\n\n",
|
||||
formsOf(m, d), fieldsDigest(tp))
|
||||
}
|
||||
|
||||
// goDecoders writes the tolerant decoder of every event and answer type (a state's values have theirs with its keys),
|
||||
// and the reader of the form on the wire.
|
||||
func goDecoders(b *bytes.Buffer, tp *typer) {
|
||||
if len(tp.readBy) == 0 {
|
||||
return
|
||||
}
|
||||
for _, n := range tp.readBy {
|
||||
if tp.values[n] {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(b, "// Decode%s reads a %s 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).\n"+
|
||||
"func Decode%s(raw []byte) (%s, int, error) {\n\tvar v %s\n\tif err := json.Unmarshal(raw, &v); err != nil {\n\t\treturn v, 0, err\n\t}\n\treturn v, formRead(raw), nil\n}\n\n",
|
||||
n, n, n, n, n)
|
||||
}
|
||||
b.WriteString("// formRead is the form a value says on the wire: 1 when it says none, or is no object.\nfunc formRead(raw []byte) int {\n" +
|
||||
"\tvar f struct {\n\t\tForm int `json:\"form\"`\n\t}\n\tif json.Unmarshal(raw, &f) != nil || f.Form < 1 {\n\t\treturn 1\n\t}\n\treturn f.Form\n}\n\n")
|
||||
}
|
||||
|
||||
var (
|
||||
formsLine = goregexp.MustCompile(`generatedForms\s*=\s*"([^"]*)"`)
|
||||
digestLine = goregexp.MustCompile(`generatedFieldsDigest\s*=\s*"([^"]*)"`)
|
||||
)
|
||||
|
||||
// formUnraised says whether a contract the tree holds was generated from other fields at the same forms as the one
|
||||
// written now: a definition whose fields changed with its form unchanged (design 47 H2 §780). A contract in the tree
|
||||
// that carries no digest yet (generated before forms) is not judged.
|
||||
func formUnraised(dir, p string, want []byte) (bool, error) {
|
||||
got, err := os.ReadFile(filepath.Join(dir, p))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
of, od := formsLine.FindSubmatch(got), digestLine.FindSubmatch(got)
|
||||
nf, nd := formsLine.FindSubmatch(want), digestLine.FindSubmatch(want)
|
||||
if of == nil || od == nil || nf == nil || nd == nil {
|
||||
return false, nil
|
||||
}
|
||||
return string(od[1]) != string(nd[1]) && string(of[1]) == string(nf[1]), nil
|
||||
}
|
||||
@@ -92,21 +92,33 @@ func declareAll(d seatdef.Definition, fromPart map[string]string) (*typer, error
|
||||
if err := decl(ident(v.Name)+"Answer", "is what "+v.Name+" answers.", v.Answer); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if v.Answer != nil {
|
||||
tp.readBy = append(tp.readBy, ident(v.Name)+"Answer")
|
||||
}
|
||||
}
|
||||
for _, a := range d.Accepts {
|
||||
if err := decl(ident(acceptName(a))+"Accept", "is the body of "+acceptName(a)+".", a.Body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if a.Body != nil {
|
||||
tp.accepts = append(tp.accepts, ident(acceptName(a))+"Accept")
|
||||
}
|
||||
}
|
||||
for _, e := range d.Events {
|
||||
if err := decl(ident(e.Name)+"Event", "is the body of the event "+e.Name+".", e.Body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if e.Body != nil {
|
||||
tp.readBy = append(tp.readBy, ident(e.Name)+"Event")
|
||||
}
|
||||
}
|
||||
for _, e := range d.HolderEvents {
|
||||
if err := decl(ident(e.Name)+"HolderEvent", "is the body of the holder's event "+e.Name+".", e.Body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if e.Body != nil {
|
||||
tp.readBy = append(tp.readBy, ident(e.Name)+"HolderEvent")
|
||||
}
|
||||
}
|
||||
for _, st := range d.States {
|
||||
for _, kf := range st.KeyForms {
|
||||
@@ -117,6 +129,10 @@ func declareAll(d seatdef.Definition, fromPart map[string]string) (*typer, error
|
||||
if err := decl(vn, "is one value of the state "+st.Name+" under the key "+kf.Key+".", kf.Value); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if kf.Value != nil {
|
||||
tp.readBy = append(tp.readBy, vn)
|
||||
tp.values[vn] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, p := range d.Provisions {
|
||||
@@ -124,6 +140,7 @@ func declareAll(d seatdef.Definition, fromPart map[string]string) (*typer, error
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
tp.addForms()
|
||||
return tp, nil
|
||||
}
|
||||
|
||||
@@ -172,10 +189,11 @@ func goWhole(m *Module, d seatdef.Definition) ([]byte, []byte, error) {
|
||||
b.WriteString(header)
|
||||
fmt.Fprintf(&b, "// Package %s is the contract of the seat %q, defined whole (seats/%s/seat.json): %s\npackage %s\n\n",
|
||||
pkg, d.Seat, d.Seat, oneLine(d.Description), pkg)
|
||||
if len(d.States) > 0 {
|
||||
if len(tp.readBy) > 0 {
|
||||
b.WriteString(goStatesImports(d.States))
|
||||
}
|
||||
fmt.Fprintf(&b, "// Seat is the seat's name.\nconst Seat = %q\n\n", d.Seat)
|
||||
writeForms(&b, m, d, tp)
|
||||
writeNames(&b, "Verb", seatdef.VerbNames(d.Verbs))
|
||||
writeNames(&b, "Accept", acceptNames(d.Accepts))
|
||||
writeNames(&b, "Event", seatdef.MessageNames(d.Events))
|
||||
@@ -232,6 +250,7 @@ func goWhole(m *Module, d seatdef.Definition) ([]byte, []byte, error) {
|
||||
if err := goTypes(&b, tp, map[string]*typ{}); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
goDecoders(&b, tp)
|
||||
if bytes.Contains(b.Bytes(), []byte("time.Time")) {
|
||||
// A moment is the standard library's time (the only import a contract may have besides its states' readers).
|
||||
raw := b.Bytes()
|
||||
|
||||
@@ -133,7 +133,8 @@ func Generate(m *Module) (map[string][]byte, error) {
|
||||
var GeneratedRoots = []string{"go", "ts"}
|
||||
|
||||
// Compare is every path out of step between what the generator writes and the tree in dir: a file that differs, one
|
||||
// missing, or one under a generated root the generator did not write, each named once, sorted.
|
||||
// missing, or one under a generated root the generator did not write, each named once, sorted; and a contract whose
|
||||
// definition's fields changed while its forms did not (design 47 H2 §780).
|
||||
func Compare(dir string, files map[string][]byte) ([]string, error) {
|
||||
var out []string
|
||||
for p, want := range files {
|
||||
@@ -145,6 +146,11 @@ func Compare(dir string, files map[string][]byte) ([]string, error) {
|
||||
return nil, err
|
||||
case string(got) != string(want):
|
||||
out = append(out, p+": differs")
|
||||
if unraised, err := formUnraised(dir, p, want); err != nil {
|
||||
return nil, err
|
||||
} else if unraised {
|
||||
out = append(out, p+": its fields changed and its form did not: raise the definition's form (design 47 H2 §780)")
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, root := range GeneratedRoots {
|
||||
|
||||
@@ -108,7 +108,7 @@ func stateFormFor(d seatdef.Definition, name string) (string, bool) {
|
||||
}
|
||||
|
||||
// goStates writes a seat's states: a constant for each local name, and for each key form its builder, its parser and
|
||||
// the strict reader of a value (a field the type does not know is refused).
|
||||
// the tolerant reader of a value (design 47 H2 §780).
|
||||
func goStates(b *bytes.Buffer, states []seatdef.State) error {
|
||||
names := make([]string, len(states))
|
||||
for i, s := range states {
|
||||
@@ -173,16 +173,18 @@ func goStates(b *bytes.Buffer, states []seatdef.State) error {
|
||||
b.WriteString("\tif rest != \"\" {\n\t\t" + fail + "\n\t}\n")
|
||||
fmt.Fprintf(b, "\treturn %s\n}\n\n", strings.Join(append(got, "true"), ", "))
|
||||
vn := fi + "Value"
|
||||
fmt.Fprintf(b, "// Decode%s reads one value of the state %s under the form %q, refusing a field %s does not know and any text after the value.\n"+
|
||||
"func Decode%s(raw []byte) (%s, error) {\n\tvar v %s\n\tdec := json.NewDecoder(bytes.NewReader(raw))\n\tdec.DisallowUnknownFields()\n"+
|
||||
"\tif err := dec.Decode(&v); err != nil {\n\t\treturn v, err\n\t}\n\tif dec.More() {\n\t\treturn v, errors.New(\"text after the value\")\n\t}\n\treturn v, nil\n}\n\n",
|
||||
if kf.Value == nil {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(b, "// Decode%s reads one value of the state %s under the form %q as another part wrote it: a field %s does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).\n"+
|
||||
"func Decode%s(raw []byte) (%s, int, error) {\n\tvar v %s\n\tif err := json.Unmarshal(raw, &v); err != nil {\n\t\treturn v, 0, err\n\t}\n\treturn v, formRead(raw), nil\n}\n\n",
|
||||
vn, s.Name, kf.Key, vn, vn, vn, vn)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// goStatesImports is the import block a seat's states need: the strict reader always, the parser's string functions
|
||||
// goStatesImports is the import block a seat's readers need: the JSON decoder always, the parser's string functions
|
||||
// where a key form has a literal or a part that is not last.
|
||||
func goStatesImports(states []seatdef.State) string {
|
||||
needStrings := false
|
||||
@@ -196,7 +198,7 @@ func goStatesImports(states []seatdef.State) string {
|
||||
}
|
||||
}
|
||||
}
|
||||
out := "import (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n"
|
||||
out := "import (\n\t\"encoding/json\"\n"
|
||||
if needStrings {
|
||||
out += "\t\"strings\"\n"
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestAStateHasItsNamesKeyFormsAndStrictValues is ADR 0634 §6's generator check for `states`: a seat's states give a
|
||||
// constant per local name, per key form a builder, a parser and a strict reader of the value, and the fixtures of
|
||||
// `state:` decode into those types. The generated seat package is written out and run with `go vet` and `go test`, so
|
||||
// TestAStateHasItsNamesKeyFormsAndTolerantValues is ADR 0634 §6's generator check for `states`: a seat's states give a
|
||||
// constant per local name, per key form a builder, a parser and a tolerant reader of the value that answers its form
|
||||
// (design 47 H2 §780), an event and an answer have such a reader too, and the fixtures of `state:` decode into those
|
||||
// types. The generated seat package is written out and run with `go vet` and `go test`, so
|
||||
// what the generator writes is compiled, not only read.
|
||||
func TestAStateHasItsNamesKeyFormsAndStrictValues(t *testing.T) {
|
||||
func TestAStateHasItsNamesKeyFormsAndTolerantValues(t *testing.T) {
|
||||
m, err := Load("testdata/contracts", "example.org/contracts/go", "@example/contracts")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -99,14 +100,22 @@ func TestKeysAndValues(t *testing.T) {
|
||||
if !ParseAsksByDefaultsKey("defaults") || ParseAsksByDefaultsKey("defaultsx") {
|
||||
t.Error("a literal key")
|
||||
}
|
||||
if _, err := DecodeAsksByAskerIDValue([]byte(` + "`" + `{"state":"open","extra":1}` + "`" + `)); err == nil {
|
||||
t.Error("a field the type does not know was taken")
|
||||
// design 47 H2 §780: a value, an event and an answer with a field the reader does not know decode and answer their
|
||||
// form; an absent form reads as 1.
|
||||
if v, form, err := DecodeAsksByAskerIDValue([]byte(` + "`" + `{"state":"open","extra":1}` + "`" + `)); err != nil || v.State != "open" || form != 1 {
|
||||
t.Error("a value with a field the type does not know:", v, form, err)
|
||||
}
|
||||
if _, err := DecodeAsksByAskerIDValue([]byte(` + "`" + `{"state":"open"} {}` + "`" + `)); err == nil {
|
||||
t.Error("text after the value was taken")
|
||||
if v, form, err := DecodeAsksByAskerIDValue([]byte(` + "`" + `{"state":"open","since":3,"form":2}` + "`" + `)); err != nil || v.State != "open" || form != 2 || v.Form != 2 {
|
||||
t.Error(v, form, err)
|
||||
}
|
||||
if v, err := DecodeAsksByAskerIDValue([]byte(` + "`" + `{"state":"open","since":3}` + "`" + `)); err != nil || v.State != "open" {
|
||||
t.Error(v, err)
|
||||
if v, form, err := DecodePeekAnswer([]byte(` + "`" + `{"id":"f1","new":true,"form":3}` + "`" + `)); err != nil || v.ID != "f1" || form != 3 {
|
||||
t.Error("an answer:", v, form, err)
|
||||
}
|
||||
if v, form, err := DecodeOwedEvent([]byte(` + "`" + `{"any":"thing","new":1}` + "`" + `)); err != nil || v["any"] != "thing" || form != 1 {
|
||||
t.Error("an event:", v, form, err)
|
||||
}
|
||||
if Form != 1 || FormRegistry != 1 {
|
||||
t.Error("forms", Form, FormRegistry)
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -121,4 +130,38 @@ func TestKeysAndValues(t *testing.T) {
|
||||
t.Fatalf("go %s on the generated package: %v\n%s", strings.Join(args, " "), err, out)
|
||||
}
|
||||
}
|
||||
|
||||
// design 47 H2 §780: the generator's check fails a definition whose fields changed with its form unchanged.
|
||||
tree := t.TempDir()
|
||||
for p, b := range files {
|
||||
if err := os.MkdirAll(filepath.Dir(filepath.Join(tree, p)), 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(tree, p), b, 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
d := m.Seats["a-registry"]
|
||||
d.States[0].KeyForms[0].Value["properties"].(map[string]any)["added"] = map[string]any{"type": "string"}
|
||||
m.Seats["a-registry"] = d
|
||||
unraised := func() bool {
|
||||
t.Helper()
|
||||
again, err := Generate(m)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out, err := Compare(tree, again)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return strings.Contains(strings.Join(out, "\n"), "contract.go: its fields changed and its form did not")
|
||||
}
|
||||
if !unraised() {
|
||||
t.Error("a field added with the form unchanged passed the compare")
|
||||
}
|
||||
d.Form = 2
|
||||
m.Seats["a-registry"] = d
|
||||
if unraised() {
|
||||
t.Error("a field added with the form raised failed the compare")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,15 @@ type named struct {
|
||||
type typer struct {
|
||||
types []named
|
||||
taken map[string]bool
|
||||
// read are the types another part reads (each value, event and answer), in declaration order: each carries `form`
|
||||
// and has a tolerant decoder (design 47 H2 §780); values are a state's, read by its own decoder.
|
||||
readBy []string
|
||||
values map[string]bool
|
||||
// accepts are the accepted kinds' types, which the fields digest covers beside read.
|
||||
accepts []string
|
||||
}
|
||||
|
||||
func newTyper() *typer { return &typer{taken: map[string]bool{}} }
|
||||
func newTyper() *typer { return &typer{taken: map[string]bool{}, values: map[string]bool{}} }
|
||||
|
||||
// declare reads schema s as the type called name and declares it.
|
||||
func (tp *typer) declare(name, desc string, s map[string]any) error {
|
||||
|
||||
@@ -577,7 +577,7 @@ func (m *Model) apply(e Entry) {
|
||||
delete(m.groups, e.Key)
|
||||
return
|
||||
}
|
||||
c, err := meshcatalog.DecodeCandidatesByGroupValue(e.Value)
|
||||
c, _, err := meshcatalog.DecodeCandidatesByGroupValue(e.Value)
|
||||
m.groups[e.Key] = groupEntry{value: c, err: errText(err)}
|
||||
case ModulesBucket:
|
||||
if e.Deleted {
|
||||
|
||||
Reference in New Issue
Block a user