seatgen writes a string's enum as Go constants, so the sweep names RemoveInputReasonRetention instead of the literal. release of what is not held is no error. The package seats' fixtures name a package as design 32 does (git.novox.be/novox/mesh-sdk/go, @novox/mesh-sdk), name says so, and module equals name for a Go package. Generated with mesh-catalog's seatgen (wip/registry-a3); seatgen -check passes. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
367 lines
11 KiB
Go
367 lines
11 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// Package meshbroker is the contract of the seat "mesh-broker", defined whole (seats/mesh-broker/seat.json): The mesh's bus, and the bus state modules ask of it in requires (design 25 § 12). create, apply, recreate and drop are granted to the bus module's own credential alone.
|
|
package meshbroker
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "mesh-broker"
|
|
|
|
const (
|
|
VerbList = "list"
|
|
VerbShow = "show"
|
|
VerbCheck = "check"
|
|
VerbOrphans = "orphans"
|
|
VerbCreate = "create"
|
|
VerbApply = "apply"
|
|
VerbRecreate = "recreate"
|
|
VerbDrop = "drop"
|
|
)
|
|
|
|
const (
|
|
EventCreated = "created"
|
|
EventRefused = "refused"
|
|
EventDrifted = "drifted"
|
|
EventDriftCleared = "drift-cleared"
|
|
EventFull = "full"
|
|
EventFullCleared = "full-cleared"
|
|
EventOrphaned = "orphaned"
|
|
EventRecreated = "recreated"
|
|
EventDropped = "dropped"
|
|
)
|
|
|
|
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
|
func Verbs() []string {
|
|
return []string{VerbList, VerbShow, VerbCheck, VerbOrphans, VerbCreate, VerbApply, VerbRecreate, VerbDrop}
|
|
}
|
|
|
|
// Events is every event published on the seat's subject: a new copy each call.
|
|
func Events() []string {
|
|
return []string{EventCreated, EventRefused, EventDrifted, EventDriftCleared, EventFull, EventFullCleared, EventOrphaned, EventRecreated, EventDropped}
|
|
}
|
|
|
|
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
|
|
const (
|
|
Family = "mesh-broker.events"
|
|
FamilyMaxAgeDays = 7
|
|
)
|
|
|
|
// SubjectCreated is where created is published.
|
|
const SubjectCreated = "mesh.seat.mesh-broker.event.created"
|
|
|
|
// SubjectRefused is where refused is published.
|
|
const SubjectRefused = "mesh.seat.mesh-broker.event.refused"
|
|
|
|
// SubjectDrifted is where drifted is published.
|
|
const SubjectDrifted = "mesh.seat.mesh-broker.event.drifted"
|
|
|
|
// SubjectDriftCleared is where drift-cleared is published.
|
|
const SubjectDriftCleared = "mesh.seat.mesh-broker.event.drift-cleared"
|
|
|
|
// SubjectFull is where full is published.
|
|
const SubjectFull = "mesh.seat.mesh-broker.event.full"
|
|
|
|
// SubjectFullCleared is where full-cleared is published.
|
|
const SubjectFullCleared = "mesh.seat.mesh-broker.event.full-cleared"
|
|
|
|
// SubjectOrphaned is where orphaned is published.
|
|
const SubjectOrphaned = "mesh.seat.mesh-broker.event.orphaned"
|
|
|
|
// SubjectRecreated is where recreated is published.
|
|
const SubjectRecreated = "mesh.seat.mesh-broker.event.recreated"
|
|
|
|
// SubjectDropped is where dropped is published.
|
|
const SubjectDropped = "mesh.seat.mesh-broker.event.dropped"
|
|
|
|
// Binding is the binding a module receives in its membership for one entry (ADR 0595 §1, §7).
|
|
type Binding struct {
|
|
// the entry's name on the bus
|
|
BusName string `json:"bus-name"`
|
|
// how the bus keeps it
|
|
StorageType string `json:"storage-type"`
|
|
// its subjects, for a stream
|
|
Subjects []string `json:"subjects,omitempty"`
|
|
// its template
|
|
Template string `json:"template,omitempty"`
|
|
}
|
|
|
|
// Entry is one piece of bus state as a manifest asks it.
|
|
type Entry struct {
|
|
// its own configuration, where no template fits
|
|
Configuration map[string]any `json:"configuration,omitempty"`
|
|
// its local name in the module's manifest
|
|
LocalName string `json:"local-name"`
|
|
// the module asking it
|
|
Module string `json:"module"`
|
|
// the template's options the module set, within their bounds
|
|
Options map[string]any `json:"options,omitempty"`
|
|
// how the bus keeps it
|
|
StorageType string `json:"storage-type"`
|
|
// its template; empty for a configuration of its own
|
|
Template string `json:"template,omitempty"`
|
|
}
|
|
|
|
// The values of Entry's storage-type.
|
|
const (
|
|
EntryStorageTypeStream = "stream"
|
|
EntryStorageTypeKeyValue = "key-value"
|
|
EntryStorageTypeObjectStore = "object-store"
|
|
EntryStorageTypeLedger = "ledger"
|
|
)
|
|
|
|
// The values of Entry's template.
|
|
const (
|
|
EntryTemplateState = "state"
|
|
EntryTemplateEvents = "events"
|
|
EntryTemplateWorkQueue = "work-queue"
|
|
EntryTemplateLog = "log"
|
|
EntryTemplateObjects = "objects"
|
|
EntryTemplateLedger = "ledger"
|
|
EntryTemplate = ""
|
|
)
|
|
|
|
// Fill is a type of the contract.
|
|
type Fill struct {
|
|
// bytes held
|
|
Bytes int64 `json:"bytes"`
|
|
// its cap in bytes
|
|
Cap int64 `json:"cap"`
|
|
// messages, keys or objects held
|
|
Count int64 `json:"count"`
|
|
}
|
|
|
|
// Held is one entry as the bus holds it.
|
|
type Held struct {
|
|
// its name on the bus, <module>_<local name>
|
|
BusName string `json:"bus-name"`
|
|
// its own configuration, where no template fits
|
|
Configuration map[string]any `json:"configuration,omitempty"`
|
|
Fill *Fill `json:"fill,omitempty"`
|
|
// its local name in the module's manifest
|
|
LocalName string `json:"local-name"`
|
|
// the module asking it
|
|
Module string `json:"module"`
|
|
// the template's options the module set, within their bounds
|
|
Options map[string]any `json:"options,omitempty"`
|
|
// the settings the bus holds
|
|
Settings map[string]any `json:"settings,omitempty"`
|
|
// the entry's state: held as asked, refused, waiting to be made, drifted from what is asked, full, or orphaned (no manifest asks it)
|
|
State string `json:"state,omitempty"`
|
|
// how the bus keeps it
|
|
StorageType string `json:"storage-type"`
|
|
// its template; empty for a configuration of its own
|
|
Template string `json:"template,omitempty"`
|
|
// why it is in its state, in plain words; empty when held as asked
|
|
Why string `json:"why,omitempty"`
|
|
}
|
|
|
|
// The values of Held's state.
|
|
const (
|
|
HeldStateHeld = "held"
|
|
HeldStateRefused = "refused"
|
|
HeldStateWaiting = "waiting"
|
|
HeldStateDrifted = "drifted"
|
|
HeldStateFull = "full"
|
|
HeldStateOrphaned = "orphaned"
|
|
)
|
|
|
|
// The values of Held's storage-type.
|
|
const (
|
|
HeldStorageTypeStream = "stream"
|
|
HeldStorageTypeKeyValue = "key-value"
|
|
HeldStorageTypeObjectStore = "object-store"
|
|
HeldStorageTypeLedger = "ledger"
|
|
)
|
|
|
|
// The values of Held's template.
|
|
const (
|
|
HeldTemplateState = "state"
|
|
HeldTemplateEvents = "events"
|
|
HeldTemplateWorkQueue = "work-queue"
|
|
HeldTemplateLog = "log"
|
|
HeldTemplateObjects = "objects"
|
|
HeldTemplateLedger = "ledger"
|
|
HeldTemplate = ""
|
|
)
|
|
|
|
// Named is a type of the contract.
|
|
type Named struct {
|
|
// the entry's local name
|
|
LocalName string `json:"local-name"`
|
|
// the module
|
|
Module string `json:"module"`
|
|
}
|
|
|
|
// Said is the body of every event of the seat.
|
|
type Said struct {
|
|
// the settings asked
|
|
Asked map[string]any `json:"asked,omitempty"`
|
|
Binding *Binding `json:"binding,omitempty"`
|
|
// its name on the bus
|
|
BusName string `json:"bus-name"`
|
|
// its own configuration, where no template fits
|
|
Configuration map[string]any `json:"configuration,omitempty"`
|
|
Fill *Fill `json:"fill,omitempty"`
|
|
// the settings held
|
|
Held map[string]any `json:"held,omitempty"`
|
|
// its local name in the module's manifest
|
|
LocalName string `json:"local-name"`
|
|
// the module asking it
|
|
Module string `json:"module"`
|
|
// the template's options the module set, within their bounds
|
|
Options map[string]any `json:"options,omitempty"`
|
|
// the indexer's revision of the verdict the bus module acted on (ADR 0622 §2), so a reader orders what it hears
|
|
Revision int64 `json:"revision,omitempty"`
|
|
// the stream snapshot taken before a recreate or drop
|
|
Snapshot string `json:"snapshot,omitempty"`
|
|
// how the bus keeps it
|
|
StorageType string `json:"storage-type,omitempty"`
|
|
// its template; empty for a configuration of its own
|
|
Template string `json:"template,omitempty"`
|
|
// why: a refusal's cause, a drift's difference, a drop's or recreate's reason
|
|
Why string `json:"why,omitempty"`
|
|
}
|
|
|
|
// The values of Said's storage-type.
|
|
const (
|
|
SaidStorageTypeStream = "stream"
|
|
SaidStorageTypeKeyValue = "key-value"
|
|
SaidStorageTypeObjectStore = "object-store"
|
|
SaidStorageTypeLedger = "ledger"
|
|
)
|
|
|
|
// The values of Said's template.
|
|
const (
|
|
SaidTemplateState = "state"
|
|
SaidTemplateEvents = "events"
|
|
SaidTemplateWorkQueue = "work-queue"
|
|
SaidTemplateLog = "log"
|
|
SaidTemplateObjects = "objects"
|
|
SaidTemplateLedger = "ledger"
|
|
SaidTemplate = ""
|
|
)
|
|
|
|
// Warranted is a type of the contract.
|
|
type Warranted struct {
|
|
// the entry's local name
|
|
LocalName string `json:"local-name"`
|
|
// the module
|
|
Module string `json:"module"`
|
|
// the operator's warrant, as the operator channel decided it (ADR 0259 §6)
|
|
Warrant string `json:"warrant"`
|
|
// why, kept in the record
|
|
Why string `json:"why"`
|
|
}
|
|
|
|
// ListInput is what list takes.
|
|
type ListInput struct {
|
|
// one module (optional)
|
|
Module string `json:"module,omitempty"`
|
|
}
|
|
|
|
// ListAnswer is what list answers.
|
|
type ListAnswer struct {
|
|
// every entry
|
|
Entries []Held `json:"entries"`
|
|
}
|
|
|
|
// ShowInput is what show takes.
|
|
type ShowInput = Named
|
|
|
|
// ShowAnswer is what show answers.
|
|
type ShowAnswer = Held
|
|
|
|
// CheckInput is what check takes.
|
|
type CheckInput struct {
|
|
// one module (optional)
|
|
Module string `json:"module,omitempty"`
|
|
}
|
|
|
|
// CheckAnswerDifferencesItem is a type of the contract.
|
|
type CheckAnswerDifferencesItem struct {
|
|
// asked
|
|
Asked map[string]any `json:"asked,omitempty"`
|
|
// the difference only grows: apply may act on it
|
|
Grows bool `json:"grows,omitempty"`
|
|
// held
|
|
Held map[string]any `json:"held,omitempty"`
|
|
// the entry
|
|
LocalName string `json:"local-name"`
|
|
// the module
|
|
Module string `json:"module"`
|
|
}
|
|
|
|
// CheckAnswer is what check answers.
|
|
type CheckAnswer struct {
|
|
// every difference
|
|
Differences []CheckAnswerDifferencesItem `json:"differences"`
|
|
}
|
|
|
|
// OrphansInput is what orphans takes.
|
|
type OrphansInput struct {
|
|
}
|
|
|
|
// OrphansAnswer is what orphans answers.
|
|
type OrphansAnswer struct {
|
|
// every orphan
|
|
Entries []Held `json:"entries"`
|
|
}
|
|
|
|
// CreateInput is what create takes.
|
|
type CreateInput = Entry
|
|
|
|
// CreateAnswer is what create answers.
|
|
type CreateAnswer = Held
|
|
|
|
// ApplyInput is what apply takes.
|
|
type ApplyInput = Named
|
|
|
|
// ApplyAnswer is what apply answers.
|
|
type ApplyAnswer = Held
|
|
|
|
// RecreateInput is what recreate takes.
|
|
type RecreateInput = Warranted
|
|
|
|
// RecreateAnswer is what recreate answers.
|
|
type RecreateAnswer = Held
|
|
|
|
// DropInput is what drop takes.
|
|
type DropInput = Warranted
|
|
|
|
// DropAnswer is what drop answers.
|
|
type DropAnswer struct {
|
|
// it is gone
|
|
Dropped bool `json:"dropped"`
|
|
// the snapshot taken first
|
|
Snapshot string `json:"snapshot,omitempty"`
|
|
}
|
|
|
|
// CreatedEvent is the body of the event created.
|
|
type CreatedEvent = Said
|
|
|
|
// RefusedEvent is the body of the event refused.
|
|
type RefusedEvent = Said
|
|
|
|
// DriftedEvent is the body of the event drifted.
|
|
type DriftedEvent = Said
|
|
|
|
// DriftClearedEvent is the body of the event drift-cleared.
|
|
type DriftClearedEvent = Said
|
|
|
|
// FullEvent is the body of the event full.
|
|
type FullEvent = Said
|
|
|
|
// FullClearedEvent is the body of the event full-cleared.
|
|
type FullClearedEvent = Said
|
|
|
|
// OrphanedEvent is the body of the event orphaned.
|
|
type OrphanedEvent = Said
|
|
|
|
// RecreatedEvent is the body of the event recreated.
|
|
type RecreatedEvent = Said
|
|
|
|
// DroppedEvent is the body of the event dropped.
|
|
type DroppedEvent = Said
|
|
|
|
// BusStateForm is the form of the provision bus-state.
|
|
type BusStateForm = Binding
|