The lead's ruling of 13:0x replaces 12:5x's said-subject: mesh-broker's events follow every seat, on mesh.seat.mesh-broker.event.<event> in the shared events stream, 7 days; the bus module keeps a longer history on a stream of its own module. So every seat family is that stream filtered to the seat's subjects: a definition says 7 days and no cap of its own, and the reader refuses anything else. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
208 lines
6.9 KiB
Go
208 lines
6.9 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// 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
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "npm-package-registry"
|
|
|
|
const (
|
|
VerbPublish = "publish"
|
|
VerbPublishPart = "publish-part"
|
|
VerbVersions = "versions"
|
|
VerbRemove = "remove"
|
|
)
|
|
|
|
const (
|
|
EventPublished = "published"
|
|
EventRefused = "refused"
|
|
EventRemoved = "removed"
|
|
)
|
|
|
|
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
|
func Verbs() []string {
|
|
return []string{VerbPublish, VerbPublishPart, VerbVersions, VerbRemove}
|
|
}
|
|
|
|
// Events is every event published on the seat's subject: a new copy each call.
|
|
func Events() []string {
|
|
return []string{EventPublished, EventRefused, EventRemoved}
|
|
}
|
|
|
|
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
|
|
const (
|
|
Family = "npm-package-registry.events"
|
|
FamilyMaxAgeDays = 7
|
|
)
|
|
|
|
// SubjectPublished is where published is published.
|
|
const SubjectPublished = "mesh.seat.npm-package-registry.event.published"
|
|
|
|
// SubjectRefused is where refused is published.
|
|
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 one published thing, as every registry event and answer names it.
|
|
type Artifact struct {
|
|
// the source commit it was built from
|
|
Commit string `json:"commit,omitempty"`
|
|
// its digest, sha256:<hex> (a Go package's h1: hash beside it in the version's record)
|
|
Digest string `json:"digest"`
|
|
// the build's fingerprint
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
// what it is
|
|
Kind string `json:"kind"`
|
|
// the package's, image's, bundle's or archive's name
|
|
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:<hex> (a Go package's h1: hash beside it in the version's record)
|
|
Digest string `json:"digest"`
|
|
// the build's fingerprint
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
// 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: <registry>/<module>/<artifact>@sha256:<digest>, or <name>@<version> for a package (ADR 0605 §9)
|
|
Reference string `json:"reference,omitempty"`
|
|
// the tag it carries, for a tagged version
|
|
Tag string `json:"tag,omitempty"`
|
|
// 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:<hex>: an image's layer or config, a package's file, a bundle's blob
|
|
Digest string `json:"digest"`
|
|
// its size in bytes
|
|
Size int64 `json:"size"`
|
|
}
|
|
|
|
// PublishInput is what publish takes.
|
|
type PublishInput struct {
|
|
// the source commit it was built from
|
|
Commit string `json:"commit,omitempty"`
|
|
// its digest, sha256:<hex> (a Go package's h1: hash beside it in the version's record)
|
|
Digest string `json:"digest"`
|
|
// the build's fingerprint
|
|
Fingerprint string `json:"fingerprint,omitempty"`
|
|
// what it is
|
|
Kind string `json:"kind"`
|
|
// the package's, image's, bundle's or archive's name
|
|
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
|
|
|
|
// NpmPackageRegistryForm is the form of the provision npm-package-registry.
|
|
type NpmPackageRegistryForm struct {
|
|
// the read side's address
|
|
URL string `json:"url"`
|
|
}
|