A tools program that serves a seat's verbs as tools reads a verb's description from the generated contract, one copy taken from seat.json, instead of writing it again. Generated again in all five folders by mesh-delivery's seatgen (feat/47-H2 b65b6173), which now writes VerbDescription; seatgen -check clean, every package's vet and tests green. Builds: design 47 H2 H-A-449
791 lines
31 KiB
Go
791 lines
31 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
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "mesh-broker"
|
|
|
|
// Form is the form of the seat's values, events and answers this contract was generated at (design 47 H2 §780):
|
|
// a reader of a value of another form says "form N, this reader knows M".
|
|
const Form = 1
|
|
|
|
// The forms and the digest of the fields this contract was generated from: the generator's compare fails a definition
|
|
// whose fields changed while its forms did not (design 47 H2 §780).
|
|
const (
|
|
generatedForms = "1"
|
|
generatedFieldsDigest = "ApplyAnswer=8dffab3194de Binding=cd356ee9a962 CheckAnswer=519b8ee727a7 CheckAnswerDifferencesItem=f1214fe7f583 CreateAnswer=8dffab3194de CreatedEvent=f590024f1e91 DriftClearedEvent=f590024f1e91 DriftedEvent=f590024f1e91 DropAnswer=11b840cfab23 DroppedEvent=f590024f1e91 Fill=936e8f87f007 FullClearedEvent=f590024f1e91 FullEvent=f590024f1e91 Held=aa3cc3256a35 ListAnswer=55c8f4280f36 ListAnswerCaps=3336d759c697 OrphanedEvent=f590024f1e91 OrphansAnswer=e07d84f80b9b RecreateAnswer=8dffab3194de RecreatedEvent=f590024f1e91 RefusedEvent=f590024f1e91 Said=36d398a25c4b ShowAnswer=8dffab3194de SnapshotGetAnswer=26aa379b4d18 SnapshotRemoveAnswer=535c7bf01ae7 SnapshotRestoreAnswer=535c7bf01ae7 SnapshotRestoreCancelAnswer=535c7bf01ae7 SnapshotRestoredEvent=36e3aab90c82"
|
|
)
|
|
|
|
const (
|
|
VerbList = "list"
|
|
VerbShow = "show"
|
|
VerbCheck = "check"
|
|
VerbOrphans = "orphans"
|
|
VerbCreate = "create"
|
|
VerbApply = "apply"
|
|
VerbRecreate = "recreate"
|
|
VerbDrop = "drop"
|
|
VerbSnapshotGet = "snapshot-get"
|
|
VerbSnapshotRestore = "snapshot-restore"
|
|
VerbSnapshotRestoreCancel = "snapshot-restore-cancel"
|
|
VerbSnapshotRemove = "snapshot-remove"
|
|
)
|
|
|
|
const (
|
|
EventCreated = "created"
|
|
EventRefused = "refused"
|
|
EventDrifted = "drifted"
|
|
EventDriftCleared = "drift-cleared"
|
|
EventFull = "full"
|
|
EventFullCleared = "full-cleared"
|
|
EventOrphaned = "orphaned"
|
|
EventRecreated = "recreated"
|
|
EventDropped = "dropped"
|
|
EventSnapshotRestored = "snapshot-restored"
|
|
)
|
|
|
|
// 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, VerbSnapshotGet, VerbSnapshotRestore, VerbSnapshotRestoreCancel, VerbSnapshotRemove}
|
|
}
|
|
|
|
// VerbDescription is a verb's description as the seat's definition says it, "" for a verb the seat does not serve or
|
|
// does not describe (design 47 H2 H-A-449).
|
|
func VerbDescription(verb string) string {
|
|
switch verb {
|
|
case VerbList:
|
|
return "Every entry the bus module created, its template, its settings and its fill against its cap."
|
|
case VerbShow:
|
|
return "One entry, its template, settings and fill."
|
|
case VerbCheck:
|
|
return "Compare what the bus holds with what was asked, entry by entry; a difference that only grows is said as such."
|
|
case VerbOrphans:
|
|
return "Entries the bus holds that no manifest asks for; never one whose manifest the judge refused or outgrew, nor one of the foundation's old sections."
|
|
case VerbCreate:
|
|
return "Create one entry now."
|
|
case VerbApply:
|
|
return "Apply a difference that only grows: a larger cap, a longer age."
|
|
case VerbRecreate:
|
|
return "Rebuild an entry whose settings differ in a way that cannot grow, from its data where the storage type allows, after a stream snapshot."
|
|
case VerbDrop:
|
|
return "Remove one orphan, after a stream snapshot."
|
|
case VerbSnapshotGet:
|
|
return "Send the stream snapshot the bus module took before a drop or recreate: its fields, then the file in chunks of at most 512 KiB on the chunk subject of the call, each acknowledged by the caller on the ack subject within 30 seconds. A caller granted no chunk subjects is answered the fields alone, with chunks 0. Refuses snapshot damaged, snapshot missing, snapshot protected and snapshot taken before milestone G (design 47 G 681)."
|
|
case VerbSnapshotRestore:
|
|
return "Restore in place the snapshot of a protected stream the bus module took before a drop or recreate, under the stream's own name: with verify true it only checks the file against its recorded digest and restores nothing; it refuses names live while a live object of the stream's name exists. Answers accepted, busy or error at once; the outcome comes on the event snapshot-restored (design 47 G 681)."
|
|
case VerbSnapshotRestoreCancel:
|
|
return "Cancel a running restore: it removes the keeper's own partial stream, says snapshot-restored with outcome failed under that act and answers accepted, or answers error when that act has ended (design 47 G 681)."
|
|
case VerbSnapshotRemove:
|
|
return "Remove one snapshot and its record now, or every expired one, written in the hand-act log first; a snapshot of before milestone G only by request. Answers accepted, busy or error (design 47 G 681), A-44."
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// 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, EventSnapshotRestored}
|
|
}
|
|
|
|
// 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"
|
|
|
|
// StreamSnapshotRestored is the stream snapshot-restored is kept in.
|
|
const StreamSnapshotRestored = "SEAT_mesh-broker_snapshot-restored"
|
|
|
|
// SubjectSnapshotRestored is where snapshot-restored is published, on mesh.seat.mesh-broker.event.snapshot-restored.<request>.<act>.
|
|
func SubjectSnapshotRestored(request, act string) string {
|
|
return "mesh.seat.mesh-broker.event.snapshot-restored." + request + "." + act
|
|
}
|
|
|
|
// SubjectSnapshotRestoredAll hears every snapshot-restored.
|
|
const SubjectSnapshotRestoredAll = "mesh.seat.mesh-broker.event.snapshot-restored.*.*"
|
|
|
|
// Binding is the binding a module receives in its membership for one entry (ADR 0595 §1, §7): the names on the bus of the entry's objects, one form in the events, in list, show and orphans, and in the membership.
|
|
type Binding struct {
|
|
// a key-value bucket's name
|
|
Bucket string `json:"bucket,omitempty"`
|
|
// a ledger's history stream
|
|
History string `json:"history,omitempty"`
|
|
// a ledger's index buckets, by index name
|
|
Indexes map[string]string `json:"indexes,omitempty"`
|
|
// the entry's local name in the module's manifest
|
|
Local string `json:"local"`
|
|
// an object store's name
|
|
ObjectStore string `json:"object-store,omitempty"`
|
|
// the bus name of the state's <state>-objects, where its large values go (design 47 G 58, 399)
|
|
Objects string `json:"objects,omitempty"`
|
|
// the subject of a ledger's instances' snapshots
|
|
Snapshot string `json:"snapshot,omitempty"`
|
|
// a ledger's state bucket
|
|
State string `json:"state,omitempty"`
|
|
// how the bus keeps it: the entry's storage type
|
|
Storage string `json:"storage"`
|
|
// a stream's name on the bus
|
|
Stream string `json:"stream,omitempty"`
|
|
// the subject a stream's messages are on; also a ledger's history's
|
|
Subject string `json:"subject,omitempty"`
|
|
// its template
|
|
Template string `json:"template,omitempty"`
|
|
// a ledger's types, as its manifest declares them
|
|
Types []map[string]any `json:"types,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 {
|
|
// the binding a module receives for the entry, as created and recreated carry it; present on an entry whose objects the bus holds, absent on one it does not (design 25 bindings-first-view §2)
|
|
Binding *Binding `json:"binding,omitempty"`
|
|
// 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"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,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"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,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"`
|
|
}
|
|
|
|
// ListAnswerCaps is the sum of the bus's caps against its limits, in MiB; an absent limit is unlimited (design 47 G 547, 661).
|
|
type ListAnswerCaps struct {
|
|
AccountLimitMiB int64 `json:"account-limit-mib,omitempty"`
|
|
ServerLimitMiB int64 `json:"server-limit-mib,omitempty"`
|
|
SumMiB int64 `json:"sum-mib"`
|
|
}
|
|
|
|
// ListAnswer is what list answers.
|
|
type ListAnswer struct {
|
|
// the sum of the bus's caps against its limits, in MiB; an absent limit is unlimited (design 47 G 547, 661)
|
|
Caps *ListAnswerCaps `json:"caps,omitempty"`
|
|
// every entry
|
|
Entries []Held `json:"entries"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
}
|
|
|
|
// 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"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
}
|
|
|
|
// OrphansInput is what orphans takes.
|
|
type OrphansInput struct {
|
|
}
|
|
|
|
// OrphansAnswer is what orphans answers.
|
|
type OrphansAnswer struct {
|
|
// every orphan
|
|
Entries []Held `json:"entries"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
}
|
|
|
|
// 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"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the snapshot taken first
|
|
Snapshot string `json:"snapshot,omitempty"`
|
|
}
|
|
|
|
// SnapshotGetInput is what snapshot-get takes.
|
|
type SnapshotGetInput struct {
|
|
// 128 random bits the caller chooses: the subject token of this send's chunks and acknowledgements
|
|
Call string `json:"call"`
|
|
// the snapshot's request: the id of the request the keeper took it for, in its state requests
|
|
Request string `json:"request"`
|
|
}
|
|
|
|
// SnapshotGetAnswer is what snapshot-get answers.
|
|
type SnapshotGetAnswer struct {
|
|
// when the snapshot was taken, RFC 3339
|
|
At *time.Time `json:"at,omitempty"`
|
|
// how many chunks are sent; 0 when the caller is granted no chunk subjects
|
|
Chunks int64 `json:"chunks,omitempty"`
|
|
// sha256: of the file's bytes
|
|
Digest string `json:"digest,omitempty"`
|
|
// why not: snapshot damaged, snapshot missing, snapshot protected or snapshot taken before milestone G; set alone
|
|
Error string `json:"error,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
// the entry's local name
|
|
Local string `json:"local,omitempty"`
|
|
Module string `json:"module,omitempty"`
|
|
Request string `json:"request,omitempty"`
|
|
Size int64 `json:"size,omitempty"`
|
|
// the stream's name on the bus
|
|
Stream string `json:"stream,omitempty"`
|
|
}
|
|
|
|
// SnapshotRestoreInput is what snapshot-restore takes.
|
|
type SnapshotRestoreInput struct {
|
|
// the snapshot's request: the id of the request the keeper took it for, in its state requests
|
|
Request string `json:"request"`
|
|
// check the file against its digest and restore nothing
|
|
Verify bool `json:"verify,omitempty"`
|
|
// why, which the hand-act log keeps
|
|
Why string `json:"why"`
|
|
}
|
|
|
|
// SnapshotRestoreAnswer is what snapshot-restore answers.
|
|
type SnapshotRestoreAnswer struct {
|
|
// accepted: the act's id
|
|
Accepted string `json:"accepted,omitempty"`
|
|
// busy: the id of the act that runs; it keeps no queue
|
|
Busy string `json:"busy,omitempty"`
|
|
// why not; set alone
|
|
Error string `json:"error,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
}
|
|
|
|
// SnapshotRestoreCancelInput is what snapshot-restore-cancel takes.
|
|
type SnapshotRestoreCancelInput struct {
|
|
// the restore's act id
|
|
Act string `json:"act"`
|
|
// why, which the hand-act log keeps
|
|
Why string `json:"why"`
|
|
}
|
|
|
|
// SnapshotRestoreCancelAnswer is what snapshot-restore-cancel answers.
|
|
type SnapshotRestoreCancelAnswer struct {
|
|
// accepted: the act's id
|
|
Accepted string `json:"accepted,omitempty"`
|
|
// busy: the id of the act that runs; it keeps no queue
|
|
Busy string `json:"busy,omitempty"`
|
|
// why not; set alone
|
|
Error string `json:"error,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
}
|
|
|
|
// SnapshotRemoveInput is what snapshot-remove takes.
|
|
type SnapshotRemoveInput struct {
|
|
// true: every snapshot past snapshot-keep-days
|
|
Expired bool `json:"expired,omitempty"`
|
|
// the snapshot's request; or expired true, not both
|
|
Request string `json:"request,omitempty"`
|
|
// why, which the hand-act log keeps
|
|
Why string `json:"why"`
|
|
}
|
|
|
|
// SnapshotRemoveAnswer is what snapshot-remove answers.
|
|
type SnapshotRemoveAnswer struct {
|
|
// accepted: the act's id
|
|
Accepted string `json:"accepted,omitempty"`
|
|
// busy: the id of the act that runs; it keeps no queue
|
|
Busy string `json:"busy,omitempty"`
|
|
// why not; set alone
|
|
Error string `json:"error,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,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
|
|
|
|
// SnapshotRestoredEvent is the body of the event snapshot-restored.
|
|
type SnapshotRestoredEvent struct {
|
|
Act string `json:"act"`
|
|
// when failed
|
|
Error string `json:"error,omitempty"`
|
|
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
|
|
Form int64 `json:"form,omitempty"`
|
|
Outcome string `json:"outcome"`
|
|
Request string `json:"request"`
|
|
}
|
|
|
|
// The values of SnapshotRestoredEvent's outcome.
|
|
const (
|
|
SnapshotRestoredEventOutcomeDone = "done"
|
|
SnapshotRestoredEventOutcomeFailed = "failed"
|
|
)
|
|
|
|
// BusStateForm is the form of the provision bus-state.
|
|
type BusStateForm = Binding
|
|
|
|
// DecodeListAnswer reads a ListAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeListAnswer(raw []byte) (ListAnswer, int, error) {
|
|
var v ListAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeShowAnswer reads a ShowAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeShowAnswer(raw []byte) (ShowAnswer, int, error) {
|
|
var v ShowAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeCheckAnswer reads a CheckAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeCheckAnswer(raw []byte) (CheckAnswer, int, error) {
|
|
var v CheckAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeOrphansAnswer reads a OrphansAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeOrphansAnswer(raw []byte) (OrphansAnswer, int, error) {
|
|
var v OrphansAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeCreateAnswer reads a CreateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeCreateAnswer(raw []byte) (CreateAnswer, int, error) {
|
|
var v CreateAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeApplyAnswer reads a ApplyAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeApplyAnswer(raw []byte) (ApplyAnswer, int, error) {
|
|
var v ApplyAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeRecreateAnswer reads a RecreateAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeRecreateAnswer(raw []byte) (RecreateAnswer, int, error) {
|
|
var v RecreateAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeDropAnswer reads a DropAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeDropAnswer(raw []byte) (DropAnswer, int, error) {
|
|
var v DropAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeSnapshotGetAnswer reads a SnapshotGetAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeSnapshotGetAnswer(raw []byte) (SnapshotGetAnswer, int, error) {
|
|
var v SnapshotGetAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeSnapshotRestoreAnswer reads a SnapshotRestoreAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeSnapshotRestoreAnswer(raw []byte) (SnapshotRestoreAnswer, int, error) {
|
|
var v SnapshotRestoreAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeSnapshotRestoreCancelAnswer reads a SnapshotRestoreCancelAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeSnapshotRestoreCancelAnswer(raw []byte) (SnapshotRestoreCancelAnswer, int, error) {
|
|
var v SnapshotRestoreCancelAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeSnapshotRemoveAnswer reads a SnapshotRemoveAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeSnapshotRemoveAnswer(raw []byte) (SnapshotRemoveAnswer, int, error) {
|
|
var v SnapshotRemoveAnswer
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeCreatedEvent reads a CreatedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeCreatedEvent(raw []byte) (CreatedEvent, int, error) {
|
|
var v CreatedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeRefusedEvent reads a RefusedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeRefusedEvent(raw []byte) (RefusedEvent, int, error) {
|
|
var v RefusedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeDriftedEvent reads a DriftedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeDriftedEvent(raw []byte) (DriftedEvent, int, error) {
|
|
var v DriftedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeDriftClearedEvent reads a DriftClearedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeDriftClearedEvent(raw []byte) (DriftClearedEvent, int, error) {
|
|
var v DriftClearedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeFullEvent reads a FullEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeFullEvent(raw []byte) (FullEvent, int, error) {
|
|
var v FullEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeFullClearedEvent reads a FullClearedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeFullClearedEvent(raw []byte) (FullClearedEvent, int, error) {
|
|
var v FullClearedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeOrphanedEvent reads a OrphanedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeOrphanedEvent(raw []byte) (OrphanedEvent, int, error) {
|
|
var v OrphanedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeRecreatedEvent reads a RecreatedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeRecreatedEvent(raw []byte) (RecreatedEvent, int, error) {
|
|
var v RecreatedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeDroppedEvent reads a DroppedEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeDroppedEvent(raw []byte) (DroppedEvent, int, error) {
|
|
var v DroppedEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// DecodeSnapshotRestoredEvent reads a SnapshotRestoredEvent as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
|
|
func DecodeSnapshotRestoredEvent(raw []byte) (SnapshotRestoredEvent, int, error) {
|
|
var v SnapshotRestoredEvent
|
|
if err := json.Unmarshal(raw, &v); err != nil {
|
|
return v, 0, err
|
|
}
|
|
return v, formRead(raw), nil
|
|
}
|
|
|
|
// formRead is the form a value says on the wire: 1 when it says none, or is no object.
|
|
func formRead(raw []byte) int {
|
|
var f struct {
|
|
Form int `json:"form"`
|
|
}
|
|
if json.Unmarshal(raw, &f) != nil || f.Form < 1 {
|
|
return 1
|
|
}
|
|
return f.Form
|
|
}
|