291 lines
8.6 KiB
Go
291 lines
8.6 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.
|
|
const (
|
|
Family = "mesh-broker.events"
|
|
FamilyMaxAgeDays = 30
|
|
FamilyMaxMiB = 256
|
|
)
|
|
|
|
// 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"
|
|
|
|
// 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"`
|
|
}
|
|
|
|
// 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"`
|
|
// how the bus keeps it
|
|
StorageType string `json:"storage-type"`
|
|
// its template; empty for a configuration of its own
|
|
Template string `json:"template,omitempty"`
|
|
}
|
|
|
|
// 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"`
|
|
// 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 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"`
|
|
}
|
|
|
|
// 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 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"`
|
|
}
|