Files
mesh-contracts/go/seats/meshconfig/contract.go
T

126 lines
3.9 KiB
Go

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// Package meshconfig is the contract of the seat "mesh-config", defined whole (seats/mesh-config/seat.json): The mesh's config values: read and set one, and the renames still open. mesh-config's own events stay under its own subjects (ADR 0620 §2).
package meshconfig
// Seat is the seat's name.
const Seat = "mesh-config"
const (
VerbConfig = "config"
VerbRenames = "renames"
)
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbConfig, VerbRenames}
}
// The holder's own events, listed beside the seat and published under the holder's subjects (ADR 0620 §2).
const (
HolderEventConfigChanged = "config-changed"
HolderEventRenamed = "renamed"
HolderEventRetiring = "retiring"
HolderEventRetired = "retired"
)
// HolderSubjectConfigChanged is where the holder publishes config-changed.
func HolderSubjectConfigChanged(holder string) string {
return "mesh.mod." + holder + ".event.config-changed"
}
// HolderSubjectRenamed is where the holder publishes renamed, kept in config.events.
func HolderSubjectRenamed(holder string) string { return "mesh.mod." + holder + ".event.renamed" }
// HolderSubjectRetiring is where the holder publishes retiring, kept in config.events.
func HolderSubjectRetiring(holder string) string { return "mesh.mod." + holder + ".event.retiring" }
// HolderSubjectRetired is where the holder publishes retired, kept in config.events.
func HolderSubjectRetired(holder string) string { return "mesh.mod." + holder + ".event.retired" }
// ConfigInput is what config takes.
type ConfigInput struct {
// list (when not given), set, clear or history
Action string `json:"action,omitempty"`
// who gave the value at the controller's terminal
By string `json:"by,omitempty"`
// the config key
Key string `json:"key,omitempty"`
// for history: at most this many, newest
Limit float64 `json:"limit,omitempty"`
// a module: its own value, with node
Module string `json:"module,omitempty"`
// a node
Node string `json:"node,omitempty"`
// for set: the value, of the key's type: a number, a string, a boolean, or for a trusted key an object or a list
Value any `json:"value,omitempty"`
// for set and clear: why
Why string `json:"why,omitempty"`
}
// ConfigAnswer is what config answers.
type ConfigAnswer = map[string]any
// RenamesInput is what renames takes.
type RenamesInput struct {
// one module (optional)
Module string `json:"module,omitempty"`
}
// RenamesAnswerRenamesItem is a type of the contract.
type RenamesAnswerRenamesItem struct {
// when it moved, RFC 3339
At string `json:"at,omitempty"`
// the old name
From string `json:"from"`
// the module
Module string `json:"module"`
// the nodes still holding the old name open
Open []string `json:"open,omitempty"`
// the new name
To string `json:"to"`
}
// RenamesAnswer is what renames answers.
type RenamesAnswer struct {
// every open rename
Renames []RenamesAnswerRenamesItem `json:"renames"`
}
// RenamedHolderEvent is the body of the holder's event renamed.
type RenamedHolderEvent struct {
// when, RFC 3339
At string `json:"at"`
// the old name
From string `json:"from"`
// the module
Module string `json:"module"`
// the new name
To string `json:"to"`
}
// RetiringHolderEvent is the body of the holder's event retiring.
type RetiringHolderEvent struct {
// the ask's id
Ask string `json:"ask,omitempty"`
// the value's or secret's name
Key string `json:"key"`
Kind string `json:"kind"`
// the module
Module string `json:"module"`
// since when, RFC 3339
Since string `json:"since"`
}
// RetiredHolderEvent is the body of the holder's event retired.
type RetiredHolderEvent struct {
// the ask's id
Ask string `json:"ask,omitempty"`
// the module
Module string `json:"module"`
// the name
Name string `json:"name"`
// the node
Node string `json:"node,omitempty"`
}