diff --git a/go/parts/registry/contract.go b/go/parts/registry/contract.go deleted file mode 100644 index e155910..0000000 --- a/go/parts/registry/contract.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by seatgen from the seat definitions; DO NOT EDIT. - -// Package registry is the part "registry" several seats include whole: The verbs and events every registry seat shares, written once so the four cannot drift (design 51, design 26). Who may call each verb is the holder's trusted config value listing its callers (ADR 0363's form), checked against the caller the tool runner proved. -package registry - -const ( - VerbPublish = "publish" - VerbPublishPart = "publish-part" - VerbVersions = "versions" - VerbRemove = "remove" -) - -const ( - EventPublished = "published" - EventRefused = "refused" - EventRemoved = "removed" -) - -// Artifact is one published thing, as every registry event and answer names it. -type Artifact struct { - // the source commit it was built from - Commit string `json:"commit,omitempty"` - // its digest, sha256: (a Go package's h1: hash beside it in the version's record) - Digest string `json:"digest"` - // the build's fingerprint - Fingerprint string `json:"fingerprint,omitempty"` - // what it is - Kind string `json:"kind"` - // the package's, image's, bundle's or archive's name - Name string `json:"name"` - // the tag it carries, for a tagged version - Tag string `json:"tag,omitempty"` - // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone - Version string `json:"version,omitempty"` -} - -// Outcome is the body of published, refused and removed. -type Outcome struct { - // the source commit it was built from - Commit string `json:"commit,omitempty"` - // its digest, sha256: (a Go package's h1: hash beside it in the version's record) - Digest string `json:"digest"` - // the build's fingerprint - Fingerprint string `json:"fingerprint,omitempty"` - // the module holding the seat that said it - Holder string `json:"holder"` - // what it is - Kind string `json:"kind"` - // the package's, image's, bundle's or archive's name - Name string `json:"name"` - // why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) - Reason string `json:"reason,omitempty"` - // the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) - Reference string `json:"reference,omitempty"` - // the tag it carries, for a tagged version - Tag string `json:"tag,omitempty"` - // the transfer it ends, when it ended one - Transfer string `json:"transfer,omitempty"` - // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone - Version string `json:"version,omitempty"` -} - -// Part is one part of a transfer. -type Part struct { - // the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob - Digest string `json:"digest"` - // its size in bytes - Size int64 `json:"size"` -} - -// PublishInput is what publish takes. -type PublishInput struct { - // the source commit it was built from - Commit string `json:"commit,omitempty"` - // its digest, sha256: (a Go package's h1: hash beside it in the version's record) - Digest string `json:"digest"` - // the build's fingerprint - Fingerprint string `json:"fingerprint,omitempty"` - // what it is - Kind string `json:"kind"` - // the package's, image's, bundle's or archive's name - Name string `json:"name"` - // every part's digest and size; none when the digest is already held - Parts []Part `json:"parts,omitempty"` - // the tag it carries, for a tagged version - Tag string `json:"tag,omitempty"` - // the transfer's name, the caller's own; the same name opens the same transfer again - Transfer string `json:"transfer"` - // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone - Version string `json:"version,omitempty"` -} - -// PublishAnswer is what publish answers. -type PublishAnswer struct { - // the digest is held already: nothing to send; the outcome follows as an event - Held bool `json:"held,omitempty"` - // the digests of the parts the holder lacks, to send by publish-part - Lacks []string `json:"lacks,omitempty"` - // the transfer - Transfer string `json:"transfer"` -} - -// PublishPartInput is what publish-part takes. -type PublishPartInput struct { - // the chunk's bytes, base64 (at most 760 KiB before encoding) - Data string `json:"data"` - // this chunk is the part's last - Last bool `json:"last"` - // the part's digest - Part string `json:"part"` - // the chunk's place in its part, from 0 - Sequence int64 `json:"sequence"` - // the transfer - Transfer string `json:"transfer"` -} - -// PublishPartAnswer is what publish-part answers. -type PublishPartAnswer struct { - // the part is whole and its bytes match its digest - Complete bool `json:"complete,omitempty"` - // the part - Part string `json:"part"` - // the chunks of the part held so far - Received int64 `json:"received,omitempty"` - // the transfer - Transfer string `json:"transfer"` -} - -// VersionsInput is what versions takes. -type VersionsInput struct { - // narrowed to one kind (optional) - Kind string `json:"kind,omitempty"` - // the name - Name string `json:"name"` -} - -// VersionsAnswer is what versions answers. -type VersionsAnswer struct { - // the name - Name string `json:"name"` - // newest first - Versions []Artifact `json:"versions"` -} - -// RemoveInput is what remove takes. -type RemoveInput struct { - // the digest (for a bundle, archive or copied base) - Digest string `json:"digest,omitempty"` - // the name - Name string `json:"name"` - // why it goes - Reason string `json:"reason"` - // the tag (for a tagged version) - Tag string `json:"tag,omitempty"` - // the version - Version string `json:"version,omitempty"` -} - -// RemoveAnswer is what remove answers. -type RemoveAnswer struct { - Artifact *Artifact `json:"artifact,omitempty"` - // it is gone - Removed bool `json:"removed"` -} - -// PublishedEvent is the body of the event published. -type PublishedEvent = Outcome - -// RefusedEvent is the body of the event refused. -type RefusedEvent = Outcome - -// RemovedEvent is the body of the event removed. -type RemovedEvent = Outcome diff --git a/go/seats/containerimageregistry/contract.go b/go/seats/containerimageregistry/contract.go index c18b82c..4037d21 100644 --- a/go/seats/containerimageregistry/contract.go +++ b/go/seats/containerimageregistry/contract.go @@ -3,10 +3,6 @@ // Package containerimageregistry is the contract of the seat "container-image-registry", defined whole (seats/container-image-registry/seat.json): The mesh's container images, in the one artifact store: the OCI distribution protocol's read side, an image's tags and mirroring an outside image. package containerimageregistry -import ( - "git.novox.be/novox/mesh-contracts/go/parts/registry" -) - // Seat is the seat's name. const Seat = "container-image-registry" @@ -60,47 +56,23 @@ const SubjectHeld = "mesh.seat.container-image-registry.event.held" // SubjectReleased is where released is published. const SubjectReleased = "mesh.seat.container-image-registry.event.released" -// Artifact is the part registry's. -type Artifact = registry.Artifact - -// Outcome is the part registry's. -type Outcome = registry.Outcome - -// Part is the part registry's. -type Part = registry.Part - -// PublishAnswer is the part registry's. -type PublishAnswer = registry.PublishAnswer - -// PublishInput is the part registry's. -type PublishInput = registry.PublishInput - -// PublishPartAnswer is the part registry's. -type PublishPartAnswer = registry.PublishPartAnswer - -// PublishPartInput is the part registry's. -type PublishPartInput = registry.PublishPartInput - -// PublishedEvent is the part registry's. -type PublishedEvent = registry.PublishedEvent - -// RefusedEvent is the part registry's. -type RefusedEvent = registry.RefusedEvent - -// RemoveAnswer is the part registry's. -type RemoveAnswer = registry.RemoveAnswer - -// RemoveInput is the part registry's. -type RemoveInput = registry.RemoveInput - -// RemovedEvent is the part registry's. -type RemovedEvent = registry.RemovedEvent - -// VersionsAnswer is the part registry's. -type VersionsAnswer = registry.VersionsAnswer - -// VersionsInput is the part registry's. -type VersionsInput = registry.VersionsInput +// Artifact is one published thing, as every registry event and answer names it. +type Artifact struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} // Hold is the body of held and released. type Hold struct { @@ -118,6 +90,135 @@ type Hold struct { Reason string `json:"reason,omitempty"` } +// Outcome is the body of published, refused and removed. +type Outcome struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // the module holding the seat that said it + Holder string `json:"holder"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) + Reason string `json:"reason,omitempty"` + // the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) + Reference string `json:"reference,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer it ends, when it ended one + Transfer string `json:"transfer,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} + +// Part is one part of a transfer. +type Part struct { + // the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob + Digest string `json:"digest"` + // its size in bytes + Size int64 `json:"size"` +} + +// PublishInput is what publish takes. +type PublishInput struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // every part's digest and size; none when the digest is already held + Parts []Part `json:"parts,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer's name, the caller's own; the same name opens the same transfer again + Transfer string `json:"transfer"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} + +// PublishAnswer is what publish answers. +type PublishAnswer struct { + // the digest is held already: nothing to send; the outcome follows as an event + Held bool `json:"held,omitempty"` + // the digests of the parts the holder lacks, to send by publish-part + Lacks []string `json:"lacks,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} + +// PublishPartInput is what publish-part takes. +type PublishPartInput struct { + // the chunk's bytes, base64 (at most 760 KiB before encoding) + Data string `json:"data"` + // this chunk is the part's last + Last bool `json:"last"` + // the part's digest + Part string `json:"part"` + // the chunk's place in its part, from 0 + Sequence int64 `json:"sequence"` + // the transfer + Transfer string `json:"transfer"` +} + +// PublishPartAnswer is what publish-part answers. +type PublishPartAnswer struct { + // the part is whole and its bytes match its digest + Complete bool `json:"complete,omitempty"` + // the part + Part string `json:"part"` + // the chunks of the part held so far + Received int64 `json:"received,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} + +// VersionsInput is what versions takes. +type VersionsInput struct { + // narrowed to one kind (optional) + Kind string `json:"kind,omitempty"` + // the name + Name string `json:"name"` +} + +// VersionsAnswer is what versions answers. +type VersionsAnswer struct { + // the name + Name string `json:"name"` + // newest first + Versions []Artifact `json:"versions"` +} + +// RemoveInput is what remove takes. +type RemoveInput struct { + // the digest (for a bundle, archive or copied base) + Digest string `json:"digest,omitempty"` + // the name + Name string `json:"name"` + // why it goes + Reason string `json:"reason"` + // the tag (for a tagged version) + Tag string `json:"tag,omitempty"` + // the version + Version string `json:"version,omitempty"` +} + +// RemoveAnswer is what remove answers. +type RemoveAnswer struct { + Artifact *Artifact `json:"artifact,omitempty"` + // it is gone + Removed bool `json:"removed"` +} + // MirrorInput is what mirror takes. type MirrorInput struct { // its pinned digest, sha256: @@ -192,6 +293,15 @@ type ReleaseAnswer struct { Released bool `json:"released"` } +// PublishedEvent is the body of the event published. +type PublishedEvent = Outcome + +// RefusedEvent is the body of the event refused. +type RefusedEvent = Outcome + +// RemovedEvent is the body of the event removed. +type RemovedEvent = Outcome + // HeldEvent is the body of the event held. type HeldEvent = Hold diff --git a/go/seats/containerimageregistry/go.mod b/go/seats/containerimageregistry/go.mod new file mode 100644 index 0000000..3ee2145 --- /dev/null +++ b/go/seats/containerimageregistry/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/containerimageregistry + +go 1.26.0 diff --git a/go/seats/gopackageregistry/contract.go b/go/seats/gopackageregistry/contract.go index 5b3fb87..d63ad9b 100644 --- a/go/seats/gopackageregistry/contract.go +++ b/go/seats/gopackageregistry/contract.go @@ -3,10 +3,6 @@ // 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 ( - "git.novox.be/novox/mesh-contracts/go/parts/registry" -) - // Seat is the seat's name. const Seat = "go-package-registry" @@ -48,47 +44,161 @@ const SubjectRefused = "mesh.seat.go-package-registry.event.refused" // SubjectRemoved is where removed is published. const SubjectRemoved = "mesh.seat.go-package-registry.event.removed" -// Artifact is the part registry's. -type Artifact = registry.Artifact +// Artifact is one published thing, as every registry event and answer names it. +type Artifact struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} -// Outcome is the part registry's. -type Outcome = registry.Outcome +// Outcome is the body of published, refused and removed. +type Outcome struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // the module holding the seat that said it + Holder string `json:"holder"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) + Reason string `json:"reason,omitempty"` + // the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) + Reference string `json:"reference,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer it ends, when it ended one + Transfer string `json:"transfer,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} -// Part is the part registry's. -type Part = registry.Part +// Part is one part of a transfer. +type Part struct { + // the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob + Digest string `json:"digest"` + // its size in bytes + Size int64 `json:"size"` +} -// PublishAnswer is the part registry's. -type PublishAnswer = registry.PublishAnswer +// PublishInput is what publish takes. +type PublishInput struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // every part's digest and size; none when the digest is already held + Parts []Part `json:"parts,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer's name, the caller's own; the same name opens the same transfer again + Transfer string `json:"transfer"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} -// PublishInput is the part registry's. -type PublishInput = registry.PublishInput +// PublishAnswer is what publish answers. +type PublishAnswer struct { + // the digest is held already: nothing to send; the outcome follows as an event + Held bool `json:"held,omitempty"` + // the digests of the parts the holder lacks, to send by publish-part + Lacks []string `json:"lacks,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} -// PublishPartAnswer is the part registry's. -type PublishPartAnswer = registry.PublishPartAnswer +// PublishPartInput is what publish-part takes. +type PublishPartInput struct { + // the chunk's bytes, base64 (at most 760 KiB before encoding) + Data string `json:"data"` + // this chunk is the part's last + Last bool `json:"last"` + // the part's digest + Part string `json:"part"` + // the chunk's place in its part, from 0 + Sequence int64 `json:"sequence"` + // the transfer + Transfer string `json:"transfer"` +} -// PublishPartInput is the part registry's. -type PublishPartInput = registry.PublishPartInput +// PublishPartAnswer is what publish-part answers. +type PublishPartAnswer struct { + // the part is whole and its bytes match its digest + Complete bool `json:"complete,omitempty"` + // the part + Part string `json:"part"` + // the chunks of the part held so far + Received int64 `json:"received,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} -// PublishedEvent is the part registry's. -type PublishedEvent = registry.PublishedEvent +// VersionsInput is what versions takes. +type VersionsInput struct { + // narrowed to one kind (optional) + Kind string `json:"kind,omitempty"` + // the name + Name string `json:"name"` +} -// RefusedEvent is the part registry's. -type RefusedEvent = registry.RefusedEvent +// VersionsAnswer is what versions answers. +type VersionsAnswer struct { + // the name + Name string `json:"name"` + // newest first + Versions []Artifact `json:"versions"` +} -// RemoveAnswer is the part registry's. -type RemoveAnswer = registry.RemoveAnswer +// RemoveInput is what remove takes. +type RemoveInput struct { + // the digest (for a bundle, archive or copied base) + Digest string `json:"digest,omitempty"` + // the name + Name string `json:"name"` + // why it goes + Reason string `json:"reason"` + // the tag (for a tagged version) + Tag string `json:"tag,omitempty"` + // the version + Version string `json:"version,omitempty"` +} -// RemoveInput is the part registry's. -type RemoveInput = registry.RemoveInput +// RemoveAnswer is what remove answers. +type RemoveAnswer struct { + Artifact *Artifact `json:"artifact,omitempty"` + // it is gone + Removed bool `json:"removed"` +} -// RemovedEvent is the part registry's. -type RemovedEvent = registry.RemovedEvent +// PublishedEvent is the body of the event published. +type PublishedEvent = Outcome -// VersionsAnswer is the part registry's. -type VersionsAnswer = registry.VersionsAnswer +// RefusedEvent is the body of the event refused. +type RefusedEvent = Outcome -// VersionsInput is the part registry's. -type VersionsInput = registry.VersionsInput +// RemovedEvent is the body of the event removed. +type RemovedEvent = Outcome // GoPackageRegistryForm is the form of the provision go-package-registry. type GoPackageRegistryForm struct { diff --git a/go/seats/gopackageregistry/go.mod b/go/seats/gopackageregistry/go.mod new file mode 100644 index 0000000..da0340e --- /dev/null +++ b/go/seats/gopackageregistry/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/gopackageregistry + +go 1.26.0 diff --git a/go/seats/meshbroker/go.mod b/go/seats/meshbroker/go.mod new file mode 100644 index 0000000..b84250f --- /dev/null +++ b/go/seats/meshbroker/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/meshbroker + +go 1.26.0 diff --git a/go/seats/meshconfig/go.mod b/go/seats/meshconfig/go.mod new file mode 100644 index 0000000..7f014f1 --- /dev/null +++ b/go/seats/meshconfig/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/meshconfig + +go 1.26.0 diff --git a/go/seats/meshdeliverychecker/go.mod b/go/seats/meshdeliverychecker/go.mod new file mode 100644 index 0000000..c0318ae --- /dev/null +++ b/go/seats/meshdeliverychecker/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/meshdeliverychecker + +go 1.26.0 diff --git a/go/seats/meshvault/go.mod b/go/seats/meshvault/go.mod new file mode 100644 index 0000000..10f7a40 --- /dev/null +++ b/go/seats/meshvault/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/meshvault + +go 1.26.0 diff --git a/go/seats/npmpackageregistry/contract.go b/go/seats/npmpackageregistry/contract.go index 5489417..0f60980 100644 --- a/go/seats/npmpackageregistry/contract.go +++ b/go/seats/npmpackageregistry/contract.go @@ -3,10 +3,6 @@ // 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 ( - "git.novox.be/novox/mesh-contracts/go/parts/registry" -) - // Seat is the seat's name. const Seat = "npm-package-registry" @@ -48,47 +44,161 @@ const SubjectRefused = "mesh.seat.npm-package-registry.event.refused" // SubjectRemoved is where removed is published. const SubjectRemoved = "mesh.seat.npm-package-registry.event.removed" -// Artifact is the part registry's. -type Artifact = registry.Artifact +// Artifact is one published thing, as every registry event and answer names it. +type Artifact struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} -// Outcome is the part registry's. -type Outcome = registry.Outcome +// Outcome is the body of published, refused and removed. +type Outcome struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // the module holding the seat that said it + Holder string `json:"holder"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) + Reason string `json:"reason,omitempty"` + // the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) + Reference string `json:"reference,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer it ends, when it ended one + Transfer string `json:"transfer,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} -// Part is the part registry's. -type Part = registry.Part +// Part is one part of a transfer. +type Part struct { + // the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob + Digest string `json:"digest"` + // its size in bytes + Size int64 `json:"size"` +} -// PublishAnswer is the part registry's. -type PublishAnswer = registry.PublishAnswer +// PublishInput is what publish takes. +type PublishInput struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // every part's digest and size; none when the digest is already held + Parts []Part `json:"parts,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer's name, the caller's own; the same name opens the same transfer again + Transfer string `json:"transfer"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} -// PublishInput is the part registry's. -type PublishInput = registry.PublishInput +// PublishAnswer is what publish answers. +type PublishAnswer struct { + // the digest is held already: nothing to send; the outcome follows as an event + Held bool `json:"held,omitempty"` + // the digests of the parts the holder lacks, to send by publish-part + Lacks []string `json:"lacks,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} -// PublishPartAnswer is the part registry's. -type PublishPartAnswer = registry.PublishPartAnswer +// PublishPartInput is what publish-part takes. +type PublishPartInput struct { + // the chunk's bytes, base64 (at most 760 KiB before encoding) + Data string `json:"data"` + // this chunk is the part's last + Last bool `json:"last"` + // the part's digest + Part string `json:"part"` + // the chunk's place in its part, from 0 + Sequence int64 `json:"sequence"` + // the transfer + Transfer string `json:"transfer"` +} -// PublishPartInput is the part registry's. -type PublishPartInput = registry.PublishPartInput +// PublishPartAnswer is what publish-part answers. +type PublishPartAnswer struct { + // the part is whole and its bytes match its digest + Complete bool `json:"complete,omitempty"` + // the part + Part string `json:"part"` + // the chunks of the part held so far + Received int64 `json:"received,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} -// PublishedEvent is the part registry's. -type PublishedEvent = registry.PublishedEvent +// VersionsInput is what versions takes. +type VersionsInput struct { + // narrowed to one kind (optional) + Kind string `json:"kind,omitempty"` + // the name + Name string `json:"name"` +} -// RefusedEvent is the part registry's. -type RefusedEvent = registry.RefusedEvent +// VersionsAnswer is what versions answers. +type VersionsAnswer struct { + // the name + Name string `json:"name"` + // newest first + Versions []Artifact `json:"versions"` +} -// RemoveAnswer is the part registry's. -type RemoveAnswer = registry.RemoveAnswer +// RemoveInput is what remove takes. +type RemoveInput struct { + // the digest (for a bundle, archive or copied base) + Digest string `json:"digest,omitempty"` + // the name + Name string `json:"name"` + // why it goes + Reason string `json:"reason"` + // the tag (for a tagged version) + Tag string `json:"tag,omitempty"` + // the version + Version string `json:"version,omitempty"` +} -// RemoveInput is the part registry's. -type RemoveInput = registry.RemoveInput +// RemoveAnswer is what remove answers. +type RemoveAnswer struct { + Artifact *Artifact `json:"artifact,omitempty"` + // it is gone + Removed bool `json:"removed"` +} -// RemovedEvent is the part registry's. -type RemovedEvent = registry.RemovedEvent +// PublishedEvent is the body of the event published. +type PublishedEvent = Outcome -// VersionsAnswer is the part registry's. -type VersionsAnswer = registry.VersionsAnswer +// RefusedEvent is the body of the event refused. +type RefusedEvent = Outcome -// VersionsInput is the part registry's. -type VersionsInput = registry.VersionsInput +// RemovedEvent is the body of the event removed. +type RemovedEvent = Outcome // NpmPackageRegistryForm is the form of the provision npm-package-registry. type NpmPackageRegistryForm struct { diff --git a/go/seats/npmpackageregistry/go.mod b/go/seats/npmpackageregistry/go.mod new file mode 100644 index 0000000..208b96c --- /dev/null +++ b/go/seats/npmpackageregistry/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/npmpackageregistry + +go 1.26.0 diff --git a/go/seats/ociartifactregistry/contract.go b/go/seats/ociartifactregistry/contract.go index 9042e7e..be4ab7d 100644 --- a/go/seats/ociartifactregistry/contract.go +++ b/go/seats/ociartifactregistry/contract.go @@ -3,10 +3,6 @@ // Package ociartifactregistry is the contract of the seat "oci-artifact-registry", defined whole (seats/oci-artifact-registry/seat.json): The mesh's bundles and archives, by digest, in the one artifact store: the OCI distribution protocol's read side. package ociartifactregistry -import ( - "git.novox.be/novox/mesh-contracts/go/parts/registry" -) - // Seat is the seat's name. const Seat = "oci-artifact-registry" @@ -58,47 +54,23 @@ const SubjectHeld = "mesh.seat.oci-artifact-registry.event.held" // SubjectReleased is where released is published. const SubjectReleased = "mesh.seat.oci-artifact-registry.event.released" -// Artifact is the part registry's. -type Artifact = registry.Artifact - -// Outcome is the part registry's. -type Outcome = registry.Outcome - -// Part is the part registry's. -type Part = registry.Part - -// PublishAnswer is the part registry's. -type PublishAnswer = registry.PublishAnswer - -// PublishInput is the part registry's. -type PublishInput = registry.PublishInput - -// PublishPartAnswer is the part registry's. -type PublishPartAnswer = registry.PublishPartAnswer - -// PublishPartInput is the part registry's. -type PublishPartInput = registry.PublishPartInput - -// PublishedEvent is the part registry's. -type PublishedEvent = registry.PublishedEvent - -// RefusedEvent is the part registry's. -type RefusedEvent = registry.RefusedEvent - -// RemoveAnswer is the part registry's. -type RemoveAnswer = registry.RemoveAnswer - -// RemoveInput is the part registry's. -type RemoveInput = registry.RemoveInput - -// RemovedEvent is the part registry's. -type RemovedEvent = registry.RemovedEvent - -// VersionsAnswer is the part registry's. -type VersionsAnswer = registry.VersionsAnswer - -// VersionsInput is the part registry's. -type VersionsInput = registry.VersionsInput +// Artifact is one published thing, as every registry event and answer names it. +type Artifact struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} // Hold is the body of held and released. type Hold struct { @@ -116,6 +88,135 @@ type Hold struct { Reason string `json:"reason,omitempty"` } +// Outcome is the body of published, refused and removed. +type Outcome struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // the module holding the seat that said it + Holder string `json:"holder"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // why: a refusal's cause, or a removal's (retention, tag-gone, by-hand) + Reason string `json:"reason,omitempty"` + // the reference the seat answers: //@sha256:, or @ for a package (ADR 0605 §9) + Reference string `json:"reference,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer it ends, when it ended one + Transfer string `json:"transfer,omitempty"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} + +// Part is one part of a transfer. +type Part struct { + // the part's digest, sha256:: an image's layer or config, a package's file, a bundle's blob + Digest string `json:"digest"` + // its size in bytes + Size int64 `json:"size"` +} + +// PublishInput is what publish takes. +type PublishInput struct { + // the source commit it was built from + Commit string `json:"commit,omitempty"` + // its digest, sha256: (a Go package's h1: hash beside it in the version's record) + Digest string `json:"digest"` + // the build's fingerprint + Fingerprint string `json:"fingerprint,omitempty"` + // what it is + Kind string `json:"kind"` + // the package's, image's, bundle's or archive's name + Name string `json:"name"` + // every part's digest and size; none when the digest is already held + Parts []Part `json:"parts,omitempty"` + // the tag it carries, for a tagged version + Tag string `json:"tag,omitempty"` + // the transfer's name, the caller's own; the same name opens the same transfer again + Transfer string `json:"transfer"` + // the version the builder gave it (design 51 *The versions*); empty for a bundle or archive published by its digest alone + Version string `json:"version,omitempty"` +} + +// PublishAnswer is what publish answers. +type PublishAnswer struct { + // the digest is held already: nothing to send; the outcome follows as an event + Held bool `json:"held,omitempty"` + // the digests of the parts the holder lacks, to send by publish-part + Lacks []string `json:"lacks,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} + +// PublishPartInput is what publish-part takes. +type PublishPartInput struct { + // the chunk's bytes, base64 (at most 760 KiB before encoding) + Data string `json:"data"` + // this chunk is the part's last + Last bool `json:"last"` + // the part's digest + Part string `json:"part"` + // the chunk's place in its part, from 0 + Sequence int64 `json:"sequence"` + // the transfer + Transfer string `json:"transfer"` +} + +// PublishPartAnswer is what publish-part answers. +type PublishPartAnswer struct { + // the part is whole and its bytes match its digest + Complete bool `json:"complete,omitempty"` + // the part + Part string `json:"part"` + // the chunks of the part held so far + Received int64 `json:"received,omitempty"` + // the transfer + Transfer string `json:"transfer"` +} + +// VersionsInput is what versions takes. +type VersionsInput struct { + // narrowed to one kind (optional) + Kind string `json:"kind,omitempty"` + // the name + Name string `json:"name"` +} + +// VersionsAnswer is what versions answers. +type VersionsAnswer struct { + // the name + Name string `json:"name"` + // newest first + Versions []Artifact `json:"versions"` +} + +// RemoveInput is what remove takes. +type RemoveInput struct { + // the digest (for a bundle, archive or copied base) + Digest string `json:"digest,omitempty"` + // the name + Name string `json:"name"` + // why it goes + Reason string `json:"reason"` + // the tag (for a tagged version) + Tag string `json:"tag,omitempty"` + // the version + Version string `json:"version,omitempty"` +} + +// RemoveAnswer is what remove answers. +type RemoveAnswer struct { + Artifact *Artifact `json:"artifact,omitempty"` + // it is gone + Removed bool `json:"removed"` +} + // HoldInput is what hold takes. type HoldInput struct { // the digest @@ -150,6 +251,15 @@ type ReleaseAnswer struct { Released bool `json:"released"` } +// PublishedEvent is the body of the event published. +type PublishedEvent = Outcome + +// RefusedEvent is the body of the event refused. +type RefusedEvent = Outcome + +// RemovedEvent is the body of the event removed. +type RemovedEvent = Outcome + // HeldEvent is the body of the event held. type HeldEvent = Hold diff --git a/go/seats/ociartifactregistry/go.mod b/go/seats/ociartifactregistry/go.mod new file mode 100644 index 0000000..993f3bc --- /dev/null +++ b/go/seats/ociartifactregistry/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/ociartifactregistry + +go 1.26.0 diff --git a/go/seats/operatorchannel/go.mod b/go/seats/operatorchannel/go.mod new file mode 100644 index 0000000..894ee5e --- /dev/null +++ b/go/seats/operatorchannel/go.mod @@ -0,0 +1,3 @@ +module git.novox.be/novox/mesh-contracts/go/seats/operatorchannel + +go 1.26.0 diff --git a/module.json b/module.json index b67dc32..118627c 100644 --- a/module.json +++ b/module.json @@ -5,6 +5,15 @@ "build": { "artifacts": [ { "name": "go", "kind": "package", "language": "go", "paths": ["go"], "series": "0.1", "generated-from": "." }, + { "name": "go-containerimageregistry", "kind": "package", "language": "go", "paths": ["go/seats/containerimageregistry"], "series": "0.1", "generated-from": "." }, + { "name": "go-gopackageregistry", "kind": "package", "language": "go", "paths": ["go/seats/gopackageregistry"], "series": "0.1", "generated-from": "." }, + { "name": "go-meshbroker", "kind": "package", "language": "go", "paths": ["go/seats/meshbroker"], "series": "0.1", "generated-from": "." }, + { "name": "go-meshconfig", "kind": "package", "language": "go", "paths": ["go/seats/meshconfig"], "series": "0.1", "generated-from": "." }, + { "name": "go-meshdeliverychecker", "kind": "package", "language": "go", "paths": ["go/seats/meshdeliverychecker"], "series": "0.1", "generated-from": "." }, + { "name": "go-meshvault", "kind": "package", "language": "go", "paths": ["go/seats/meshvault"], "series": "0.1", "generated-from": "." }, + { "name": "go-npmpackageregistry", "kind": "package", "language": "go", "paths": ["go/seats/npmpackageregistry"], "series": "0.1", "generated-from": "." }, + { "name": "go-ociartifactregistry", "kind": "package", "language": "go", "paths": ["go/seats/ociartifactregistry"], "series": "0.1", "generated-from": "." }, + { "name": "go-operatorchannel", "kind": "package", "language": "go", "paths": ["go/seats/operatorchannel"], "series": "0.1", "generated-from": "." }, { "name": "lib", "kind": "package", "language": "typescript", "paths": ["ts"], "series": "0.1", "generated-from": "." } ] },