Files
mesh-contracts/go/seats/meshrecovery/contract.go
T
jschoubben 2dfdcc3316 H2: every seat contract says each verb's description
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
2026-11-22 02:36:36 +01:00

797 lines
35 KiB
Go

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// Package meshrecovery is the contract of the seat "mesh-recovery", defined whole (seats/mesh-recovery/seat.json): Takes, sets aside and restores a module's kept data on the live bus, each act in the hand-act log (design 47 G 554). Its verbs answer at once and the result is the event.
package meshrecovery
import (
"encoding/json"
"time"
)
// Seat is the seat's name.
const Seat = "mesh-recovery"
// 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 = "Aside=eb9c3fd78fc5 AsideAnswer=535c7bf01ae7 AsideDiscardedEvent=5871c0d7b2cb CancelAnswer=535c7bf01ae7 CatchUp=8b9ebde56157 Consumer=0058e0ee3ac1 Digest=51e1c2d4fe38 DiscardAsideAnswer=535c7bf01ae7 EndedEvent=28018dc26cb2 ExpirePointsAnswer=535c7bf01ae7 ExpiryEndedEvent=22741c962c8b KeptPointsAnswer=17156623b320 Point=a365daf3118a PointRemovedEvent=233e3030a016 RestoreAnswer=535c7bf01ae7 RestoreAsideAnswer=535c7bf01ae7 RestoreKeptAnswer=535c7bf01ae7 RestoreStartedEvent=233e3030a016 RestoredEvent=b7b5e65d4597 RetryAnswer=535c7bf01ae7 Running=6392cdf4bf77 SetAsideEvent=5871c0d7b2cb SnapshotKeptAnswer=535c7bf01ae7 TakeAnswer=535c7bf01ae7"
)
const (
VerbSnapshotKept = "snapshot-kept"
VerbRestoreKept = "restore-kept"
VerbKeptPoints = "kept-points"
VerbRestoreAside = "restore-aside"
VerbCancel = "cancel"
VerbTake = "take"
VerbRestore = "restore"
VerbRetry = "retry"
VerbAside = "aside"
VerbDiscardAside = "discard-aside"
VerbExpirePoints = "expire-points"
)
const (
EventEnded = "ended"
EventRestoreStarted = "restore-started"
EventRestored = "restored"
EventSetAside = "set-aside"
EventAsideDiscarded = "aside-discarded"
EventPointRemoved = "point-removed"
EventExpiryEnded = "expiry-ended"
)
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbSnapshotKept, VerbRestoreKept, VerbKeptPoints, VerbRestoreAside, VerbCancel, VerbTake, VerbRestore, VerbRetry, VerbAside, VerbDiscardAside, VerbExpirePoints}
}
// 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 VerbSnapshotKept:
return "Take the restore point of one module's kept data on the bus before it moves across a form change: the data whole and the position of each durable consumer. Answers accepted, busy or error at once; the point comes on the event ended (design 47 G 516, 554, 560)."
case VerbRestoreKept:
return "Restore one module's kept data from its restore point, the live data set aside first and never over it. Answers accepted, busy or error at once; the result comes on the event restored. It refuses aside-only and discard-aside: those are hand acts alone (design 47 G 516, 554, 560)."
case VerbKeptPoints:
return "Every restore point and aside the recovery module holds, with its module, kept data, form, fingerprint, size and when, and the act that runs, with since when and what it waits on (design 47 G 517, 554)."
case VerbRestoreAside:
return "Restore an aside under the live names it was taken from, for an aside whose record ends at removed that no running act holds; it refuses while live objects of those names exist. Ends with restored (design 47 G 566)."
case VerbCancel:
return "End an accepted act that has not begun its work, with its ending event, outcome failed and error cancelled; it refuses an act that has begun, naming its step (design 47 G 566)."
case VerbTake:
return "Hand act: take a point of one module's kept data at that fingerprint's form, as snapshot-kept does with no catch-up. Answers accepted, busy or error at once; the point comes on the event ended (design 47 G 682, 554)."
case VerbRestore:
return "Hand act: restore one module's kept data as restore-kept does, from a point by its name or from a keeper's snapshot by its request; exactly one of snapshot and request, and from-backup only with snapshot (design 47 G 682, 681). Answers accepted, busy or error at once; the result comes on the event restored."
case VerbRetry:
return "Hand act: ask again the last failed act of that module and kept data, with its fields; the error nothing to retry when its last act did not fail. The result comes on that act's ending event (design 47 G 682)."
case VerbAside:
return "Hand act: set the live kept data aside without restoring (design 47 G 516, 682). Answers accepted, busy or error at once; the result comes on the event set-aside."
case VerbDiscardAside:
return "Hand act: remove one aside's directory (design 47 G 682). Answers accepted, busy or error at once; the result comes on the event aside-discarded."
case VerbExpirePoints:
return "Hand act: remove the points past their 90 days now, as the module does by itself (design 47 G 551, 682). Answers accepted, busy or error at once; the result comes on the event expiry-ended."
}
return ""
}
// Events is every event published on the seat's subject: a new copy each call.
func Events() []string {
return []string{EventEnded, EventRestoreStarted, EventRestored, EventSetAside, EventAsideDiscarded, EventPointRemoved, EventExpiryEnded}
}
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
const (
Family = "mesh-recovery.events"
FamilyMaxAgeDays = 7
)
// StreamEnded is the stream ended is kept in.
const StreamEnded = "SEAT_mesh-recovery_ended"
// SubjectEnded is where ended is published, on mesh.seat.mesh-recovery.event.ended.<module>.<kept>.
func SubjectEnded(module, kept string) string {
return "mesh.seat.mesh-recovery.event.ended." + module + "." + kept
}
// SubjectEndedAll hears every ended.
const SubjectEndedAll = "mesh.seat.mesh-recovery.event.ended.*.*"
// StreamRestoreStarted is the stream restore-started is kept in.
const StreamRestoreStarted = "SEAT_mesh-recovery_restore-started"
// SubjectRestoreStarted is where restore-started is published, on mesh.seat.mesh-recovery.event.restore-started.<module>.<kept>.
func SubjectRestoreStarted(module, kept string) string {
return "mesh.seat.mesh-recovery.event.restore-started." + module + "." + kept
}
// SubjectRestoreStartedAll hears every restore-started.
const SubjectRestoreStartedAll = "mesh.seat.mesh-recovery.event.restore-started.*.*"
// StreamRestored is the stream restored is kept in.
const StreamRestored = "SEAT_mesh-recovery_restored"
// SubjectRestored is where restored is published, on mesh.seat.mesh-recovery.event.restored.<module>.<kept>.
func SubjectRestored(module, kept string) string {
return "mesh.seat.mesh-recovery.event.restored." + module + "." + kept
}
// SubjectRestoredAll hears every restored.
const SubjectRestoredAll = "mesh.seat.mesh-recovery.event.restored.*.*"
// StreamSetAside is the stream set-aside is kept in.
const StreamSetAside = "SEAT_mesh-recovery_set-aside"
// SubjectSetAside is where set-aside is published, on mesh.seat.mesh-recovery.event.set-aside.<module>.<kept>.
func SubjectSetAside(module, kept string) string {
return "mesh.seat.mesh-recovery.event.set-aside." + module + "." + kept
}
// SubjectSetAsideAll hears every set-aside.
const SubjectSetAsideAll = "mesh.seat.mesh-recovery.event.set-aside.*.*"
// StreamAsideDiscarded is the stream aside-discarded is kept in.
const StreamAsideDiscarded = "SEAT_mesh-recovery_aside-discarded"
// SubjectAsideDiscarded is where aside-discarded is published, on mesh.seat.mesh-recovery.event.aside-discarded.<module>.<kept>.
func SubjectAsideDiscarded(module, kept string) string {
return "mesh.seat.mesh-recovery.event.aside-discarded." + module + "." + kept
}
// SubjectAsideDiscardedAll hears every aside-discarded.
const SubjectAsideDiscardedAll = "mesh.seat.mesh-recovery.event.aside-discarded.*.*"
// StreamPointRemoved is the stream point-removed is kept in.
const StreamPointRemoved = "SEAT_mesh-recovery_point-removed"
// SubjectPointRemoved is where point-removed is published, on mesh.seat.mesh-recovery.event.point-removed.<module>.<kept>.
func SubjectPointRemoved(module, kept string) string {
return "mesh.seat.mesh-recovery.event.point-removed." + module + "." + kept
}
// SubjectPointRemovedAll hears every point-removed.
const SubjectPointRemovedAll = "mesh.seat.mesh-recovery.event.point-removed.*.*"
// StreamExpiryEnded is the stream expiry-ended is kept in.
const StreamExpiryEnded = "SEAT_mesh-recovery_expiry-ended"
// SubjectExpiryEnded is where expiry-ended is published.
const SubjectExpiryEnded = "mesh.seat.mesh-recovery.event.expiry-ended"
// Aside is the live data set aside before a restore: a directory under aside/ in the recovery module's directory, nothing of it on the bus (design 47 G 516).
type Aside struct {
// the directory's name
ID string `json:"id"`
// the bus names it was live under, one per bus object
Names []string `json:"names"`
// its bytes on disk
Size int64 `json:"size"`
}
// CatchUp is the catch-up of the newer manifest: a tool and its arguments, never text (design 47 G 451, 516, 631).
type CatchUp struct {
Arguments map[string]any `json:"arguments,omitempty"`
Tool string `json:"tool"`
}
// Consumer is one durable consumer of the kept data and the sequence it had acknowledged.
type Consumer struct {
Name string `json:"name"`
Sequence int64 `json:"sequence"`
Stream string `json:"stream"`
}
// Digest is the digest of one object of a point's bytes.
type Digest struct {
Digest string `json:"digest"`
Name string `json:"name"`
}
// Point is a restore point: the kept data whole and its consumers' positions, in the recovery module's points directory (design 47 G 516, 560).
type Point struct {
// when it was taken, RFC 3339
At time.Time `json:"at"`
CatchUp *CatchUp `json:"catch-up,omitempty"`
Consumers []Consumer `json:"consumers,omitempty"`
// the digest of each object's bytes, checked before a restore (design 47 G 567)
Digests []Digest `json:"digests,omitempty"`
// the fingerprint it was taken before
Fingerprint string `json:"fingerprint"`
// its form, the number the holder raises when it changes how it writes it (0 when undeclared)
Form int64 `json:"form"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// the bus names it took, one per bus object (design 47 G A-230)
Names []string `json:"names"`
// its bytes
Size int64 `json:"size"`
// the point's name, also its directory's
Snapshot string `json:"snapshot"`
}
// Running is the act that runs, since when and what it waits on (design 47 G 517, 554).
type Running struct {
Act string `json:"act"`
Since time.Time `json:"since"`
Step string `json:"step,omitempty"`
// what it waits on, when it waits
WaitsOn string `json:"waits-on,omitempty"`
}
// SnapshotKeptInput is what snapshot-kept takes.
type SnapshotKeptInput struct {
CatchUp *CatchUp `json:"catch-up,omitempty"`
// the fingerprint the restore point is taken before, or reverted from
Fingerprint string `json:"fingerprint"`
// its form, the number the holder raises when it changes how it writes it (0 when undeclared)
Form int64 `json:"form"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// SnapshotKeptAnswer is what snapshot-kept answers.
type SnapshotKeptAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// RestoreKeptInput is what restore-kept takes.
type RestoreKeptInput struct {
// the fingerprint the restore point is taken before, or reverted from
Fingerprint string `json:"fingerprint"`
// its form, the number the holder raises when it changes how it writes it (0 when undeclared)
Form int64 `json:"form"`
// ask the backup holder for the points directory when the point is missing there (design 47 G 516)
FromBackup bool `json:"from-backup,omitempty"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// the restore point's name
Snapshot string `json:"snapshot,omitempty"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// RestoreKeptAnswer is what restore-kept answers.
type RestoreKeptAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// KeptPointsInput is what kept-points takes.
type KeptPointsInput struct {
// one kept data (optional)
Kept string `json:"kept,omitempty"`
// one module (optional)
Module string `json:"module,omitempty"`
}
// KeptPointsAnswer is what kept-points answers.
type KeptPointsAnswer struct {
Asides []Aside `json:"asides"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
Points []Point `json:"points"`
Running *Running `json:"running,omitempty"`
// the asides whose record ended at removed that no running act holds: the live data of those names is gone and only the aside holds it; the module's health check fails while one is listed (design 47 G 554, 657, A-129)
Unrestored []Aside `json:"unrestored"`
}
// RestoreAsideInput is what restore-aside takes.
type RestoreAsideInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// the aside's id
ID string `json:"id"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// RestoreAsideAnswer is what restore-aside answers.
type RestoreAsideAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// CancelInput is what cancel takes.
type CancelInput struct {
// the act's id
Act string `json:"act"`
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// CancelAnswer is what cancel answers.
type CancelAnswer struct {
// accepted: the id of the act it cancelled, whose ending event follows under that id
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why not, naming the step an act has begun; 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"`
}
// TakeInput is what take takes.
type TakeInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// the fingerprint whose form the point is taken at
Fingerprint string `json:"fingerprint"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// TakeAnswer is what take answers.
type TakeAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// RestoreInput is what restore takes.
type RestoreInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// ask the backup holder for the points directory when the point is missing there; only with snapshot
FromBackup bool `json:"from-backup,omitempty"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// a keeper's snapshot by its request (design 47 G 681)
Request string `json:"request,omitempty"`
// a restore point's name
Snapshot string `json:"snapshot,omitempty"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// RestoreAnswer is what restore answers.
type RestoreAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// RetryInput is what retry takes.
type RetryInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// RetryAnswer is what retry answers.
type RetryAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// AsideInput is what aside takes.
type AsideInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// AsideAnswer is what aside answers.
type AsideAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// DiscardAsideInput is what discard-aside takes.
type DiscardAsideInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// the aside's id
ID string `json:"id"`
// the kept data, its local name in the module's manifest
Kept string `json:"kept"`
// the module
Module string `json:"module"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// DiscardAsideAnswer is what discard-aside answers.
type DiscardAsideAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// ExpirePointsInput is what expire-points takes.
type ExpirePointsInput struct {
// who asked: the caller the tool runner proved and recorded for the call (who@node, or operator), which the tools bundle's recovery tool passes and a module's process leaves out; the hand-act log names it beside the account the bus proved (design 47 G 682)
Asker string `json:"asker,omitempty"`
// why, which the hand-act log keeps
Why string `json:"why"`
}
// ExpirePointsAnswer is what expire-points answers.
type ExpirePointsAnswer struct {
// accepted: the act's id, which the ending event carries
Accepted string `json:"accepted,omitempty"`
// busy: the id of the act that runs; it keeps no queue, so the caller asks again on that act's ending event
Busy string `json:"busy,omitempty"`
// why it was not taken; 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"`
}
// EndedEvent is the body of the event ended.
type EndedEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
// when it was said, RFC 3339
At time.Time `json:"at"`
CatchUp *CatchUp `json:"catch-up,omitempty"`
Consumers []Consumer `json:"consumers,omitempty"`
Digests []Digest `json:"digests,omitempty"`
// when failed
Error string `json:"error,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Form int64 `json:"form,omitempty"`
Kept string `json:"kept"`
Module string `json:"module"`
// how the act ended
Outcome string `json:"outcome"`
Size int64 `json:"size,omitempty"`
Snapshot string `json:"snapshot,omitempty"`
// the words of the hand act that ended it, for a cancel (design 47 G A-117, 560)
Why string `json:"why,omitempty"`
}
// The values of EndedEvent's outcome.
const (
EndedEventOutcomeDone = "done"
EndedEventOutcomeFailed = "failed"
)
// RestoreStartedEvent is the body of the event restore-started.
type RestoreStartedEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
// when it was said, RFC 3339
At time.Time `json:"at"`
Fingerprint string `json:"fingerprint,omitempty"`
Form int64 `json:"form,omitempty"`
Kept string `json:"kept"`
Module string `json:"module"`
Snapshot string `json:"snapshot,omitempty"`
}
// RestoredEvent is the body of the event restored.
type RestoredEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
Aside *Aside `json:"aside,omitempty"`
// when it was said, RFC 3339
At time.Time `json:"at"`
Error string `json:"error,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Form int64 `json:"form,omitempty"`
Kept string `json:"kept"`
// the point is not in the recovery module's directory
Missing bool `json:"missing,omitempty"`
Module string `json:"module"`
// how the act ended
Outcome string `json:"outcome"`
Snapshot string `json:"snapshot,omitempty"`
// the words of the hand act that ended it, for a cancel (design 47 G A-117, 560)
Why string `json:"why,omitempty"`
}
// The values of RestoredEvent's outcome.
const (
RestoredEventOutcomeDone = "done"
RestoredEventOutcomeFailed = "failed"
)
// SetAsideEvent is the body of the event set-aside.
type SetAsideEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
// when it was said, RFC 3339
At time.Time `json:"at"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
ID string `json:"id"`
// the bus names it was live under, one per bus object
Names []string `json:"names"`
Size int64 `json:"size"`
}
// AsideDiscardedEvent is the body of the event aside-discarded.
type AsideDiscardedEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
// when it was said, RFC 3339
At time.Time `json:"at"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
ID string `json:"id"`
// the bus names it was live under, one per bus object
Names []string `json:"names"`
Size int64 `json:"size"`
}
// PointRemovedEvent is the body of the event point-removed.
type PointRemovedEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
// when it was said, RFC 3339
At time.Time `json:"at"`
Fingerprint string `json:"fingerprint,omitempty"`
Form int64 `json:"form,omitempty"`
Kept string `json:"kept"`
Module string `json:"module"`
Snapshot string `json:"snapshot,omitempty"`
}
// ExpiryEndedEvent is the body of the event expiry-ended.
type ExpiryEndedEvent struct {
// the id the act was answered accepted with, or a hand act's own id (design 47 G 560)
Act string `json:"act"`
// when it was said, RFC 3339
At time.Time `json:"at"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
// the number of points the run removed, 0 included
Removed int64 `json:"removed"`
}
// DecodeSnapshotKeptAnswer reads a SnapshotKeptAnswer 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 DecodeSnapshotKeptAnswer(raw []byte) (SnapshotKeptAnswer, int, error) {
var v SnapshotKeptAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRestoreKeptAnswer reads a RestoreKeptAnswer 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 DecodeRestoreKeptAnswer(raw []byte) (RestoreKeptAnswer, int, error) {
var v RestoreKeptAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeKeptPointsAnswer reads a KeptPointsAnswer 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 DecodeKeptPointsAnswer(raw []byte) (KeptPointsAnswer, int, error) {
var v KeptPointsAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRestoreAsideAnswer reads a RestoreAsideAnswer 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 DecodeRestoreAsideAnswer(raw []byte) (RestoreAsideAnswer, int, error) {
var v RestoreAsideAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeCancelAnswer reads a CancelAnswer 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 DecodeCancelAnswer(raw []byte) (CancelAnswer, int, error) {
var v CancelAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeTakeAnswer reads a TakeAnswer 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 DecodeTakeAnswer(raw []byte) (TakeAnswer, int, error) {
var v TakeAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRestoreAnswer reads a RestoreAnswer 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 DecodeRestoreAnswer(raw []byte) (RestoreAnswer, int, error) {
var v RestoreAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRetryAnswer reads a RetryAnswer 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 DecodeRetryAnswer(raw []byte) (RetryAnswer, int, error) {
var v RetryAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeAsideAnswer reads a AsideAnswer 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 DecodeAsideAnswer(raw []byte) (AsideAnswer, int, error) {
var v AsideAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeDiscardAsideAnswer reads a DiscardAsideAnswer 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 DecodeDiscardAsideAnswer(raw []byte) (DiscardAsideAnswer, int, error) {
var v DiscardAsideAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeExpirePointsAnswer reads a ExpirePointsAnswer 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 DecodeExpirePointsAnswer(raw []byte) (ExpirePointsAnswer, int, error) {
var v ExpirePointsAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeEndedEvent reads a EndedEvent 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 DecodeEndedEvent(raw []byte) (EndedEvent, int, error) {
var v EndedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRestoreStartedEvent reads a RestoreStartedEvent 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 DecodeRestoreStartedEvent(raw []byte) (RestoreStartedEvent, int, error) {
var v RestoreStartedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeRestoredEvent reads a RestoredEvent 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 DecodeRestoredEvent(raw []byte) (RestoredEvent, int, error) {
var v RestoredEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeSetAsideEvent reads a SetAsideEvent 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 DecodeSetAsideEvent(raw []byte) (SetAsideEvent, int, error) {
var v SetAsideEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeAsideDiscardedEvent reads a AsideDiscardedEvent 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 DecodeAsideDiscardedEvent(raw []byte) (AsideDiscardedEvent, int, error) {
var v AsideDiscardedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodePointRemovedEvent reads a PointRemovedEvent 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 DecodePointRemovedEvent(raw []byte) (PointRemovedEvent, int, error) {
var v PointRemovedEvent
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeExpiryEndedEvent reads a ExpiryEndedEvent 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 DecodeExpiryEndedEvent(raw []byte) (ExpiryEndedEvent, int, error) {
var v ExpiryEndedEvent
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
}