mirror of
https://github.com/luxfi/api.git
synced 2026-09-24 00:24:53 +00:00
A ZAP field is an offset. Eight of these replies held a map, which has no order to give one, so the reply could not cross between two processes at all. Two more held values whose fields are every one unexported — netip.AddrPort, time.Time — and those are worse: they are not refused, they derive an EMPTY layout, so the reply crossed, reported no error and carried nothing. GetNodeIPReply has one field, so its whole answer was blank. And a health check says what it likes, so its details were an `any`, which has no shape until it holds something. Each map is now a list of a stated element type, ordered by the key it was an object of. An address is the text netip already wrote for it, an instant is three numbers, and a check details are the bytes of their own JSON — the one shape an object, a string and a list all share. The JSON does not move. Every list marshals to the object it replaced and reads one back, and wire_test.go holds that against the old shape spelled out as a literal rather than against itself. The order is new where there was none: a map answered the same question two ways. APIReply also states the status it carries, so the 503 a probe reads and the healthy a person reads are one fact computed once.
1115 lines
28 KiB
Go
1115 lines
28 KiB
Go
// Code generated by zip; DO NOT EDIT.
|
|
|
|
package admin
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"fmt"
|
|
"strings"
|
|
|
|
zap "github.com/zap-proto/go"
|
|
)
|
|
|
|
// ---- AliasArgs ---------------------------------------------------------
|
|
|
|
const (
|
|
aliasArgsEndpointAt = 0
|
|
aliasArgsAliasAt = 8
|
|
aliasArgsSize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*AliasArgs)(nil)
|
|
|
|
// MarshalZAP writes AliasArgs from constant offsets.
|
|
func (x *AliasArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(aliasArgsSize + 256)
|
|
ob := b.StartObject(aliasArgsSize)
|
|
ob.SetText(aliasArgsEndpointAt, string(x.Endpoint))
|
|
ob.SetText(aliasArgsAliasAt, string(x.Alias))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads AliasArgs out of the buffer that arrived.
|
|
func (x *AliasArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("AliasArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Endpoint = string(strings.Clone(o.Text(aliasArgsEndpointAt)))
|
|
x.Alias = string(strings.Clone(o.Text(aliasArgsAliasAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- AliasChainArgs ----------------------------------------------------
|
|
|
|
const (
|
|
aliasChainArgsChainAt = 0
|
|
aliasChainArgsAliasAt = 8
|
|
aliasChainArgsSize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*AliasChainArgs)(nil)
|
|
|
|
// MarshalZAP writes AliasChainArgs from constant offsets.
|
|
func (x *AliasChainArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(aliasChainArgsSize + 256)
|
|
ob := b.StartObject(aliasChainArgsSize)
|
|
ob.SetText(aliasChainArgsChainAt, string(x.Chain))
|
|
ob.SetText(aliasChainArgsAliasAt, string(x.Alias))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads AliasChainArgs out of the buffer that arrived.
|
|
func (x *AliasChainArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("AliasChainArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Chain = string(strings.Clone(o.Text(aliasChainArgsChainAt)))
|
|
x.Alias = string(strings.Clone(o.Text(aliasChainArgsAliasAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- DBGetArgs ---------------------------------------------------------
|
|
|
|
const (
|
|
dBGetArgsKeyAt = 0
|
|
dBGetArgsSize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*DBGetArgs)(nil)
|
|
|
|
// MarshalZAP writes DBGetArgs from constant offsets.
|
|
func (x *DBGetArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(dBGetArgsSize + 256)
|
|
ob := b.StartObject(dBGetArgsSize)
|
|
ob.SetText(dBGetArgsKeyAt, string(x.Key))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads DBGetArgs out of the buffer that arrived.
|
|
func (x *DBGetArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("DBGetArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Key = string(strings.Clone(o.Text(dBGetArgsKeyAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- DBGetReply --------------------------------------------------------
|
|
|
|
const (
|
|
dBGetReplyValueAt = 0
|
|
dBGetReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*DBGetReply)(nil)
|
|
|
|
// MarshalZAP writes DBGetReply from constant offsets.
|
|
func (x *DBGetReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(dBGetReplySize + 256)
|
|
ob := b.StartObject(dBGetReplySize)
|
|
ob.SetText(dBGetReplyValueAt, string(x.Value))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads DBGetReply out of the buffer that arrived.
|
|
func (x *DBGetReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("DBGetReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Value = string(strings.Clone(o.Text(dBGetReplyValueAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- FailedVM ----------------------------------------------------------
|
|
|
|
const (
|
|
failedVMVMAt = 0
|
|
failedVMErrorAt = 32
|
|
failedVMSize = 40
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*FailedVM)(nil)
|
|
|
|
// MarshalZAP writes FailedVM from constant offsets.
|
|
func (x *FailedVM) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(failedVMSize + 256)
|
|
ob := b.StartObject(failedVMSize)
|
|
ob.SetBytesFixed(failedVMVMAt, x.VM[:])
|
|
ob.SetText(failedVMErrorAt, string(x.Error))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads FailedVM out of the buffer that arrived.
|
|
func (x *FailedVM) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("FailedVM: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.VM[:], o.BytesFixed(failedVMVMAt, 32))
|
|
x.Error = string(strings.Clone(o.Text(failedVMErrorAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- GetChainAliasesArgs -----------------------------------------------
|
|
|
|
const (
|
|
getChainAliasesArgsChainAt = 0
|
|
getChainAliasesArgsSize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*GetChainAliasesArgs)(nil)
|
|
|
|
// MarshalZAP writes GetChainAliasesArgs from constant offsets.
|
|
func (x *GetChainAliasesArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(getChainAliasesArgsSize + 256)
|
|
ob := b.StartObject(getChainAliasesArgsSize)
|
|
ob.SetText(getChainAliasesArgsChainAt, string(x.Chain))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads GetChainAliasesArgs out of the buffer that arrived.
|
|
func (x *GetChainAliasesArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("GetChainAliasesArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Chain = string(strings.Clone(o.Text(getChainAliasesArgsChainAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- GetChainAliasesReply ----------------------------------------------
|
|
|
|
const (
|
|
getChainAliasesReplyAliasesAt = 0
|
|
getChainAliasesReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*GetChainAliasesReply)(nil)
|
|
|
|
// MarshalZAP writes GetChainAliasesReply from constant offsets.
|
|
func (x *GetChainAliasesReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(getChainAliasesReplySize + 256)
|
|
aliasesAt, aliasesN := 0, len(x.Aliases)
|
|
if aliasesN > 0 {
|
|
var blob []byte
|
|
for i := range x.Aliases {
|
|
enc := []byte(x.Aliases[i])
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
aliasesAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(getChainAliasesReplySize)
|
|
if aliasesN > 0 {
|
|
ob.SetList(getChainAliasesReplyAliasesAt, aliasesAt, aliasesN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads GetChainAliasesReply out of the buffer that arrived.
|
|
func (x *GetChainAliasesReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("GetChainAliasesReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(getChainAliasesReplyAliasesAt); l.Len() > 0 {
|
|
rows := make([]string, l.Len())
|
|
for i := range rows {
|
|
rows[i] = string(l.BytesAt(i))
|
|
}
|
|
x.Aliases = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- GetLoggerLevelArgs ------------------------------------------------
|
|
|
|
const (
|
|
getLoggerLevelArgsLoggerNameAt = 0
|
|
getLoggerLevelArgsSize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*GetLoggerLevelArgs)(nil)
|
|
|
|
// MarshalZAP writes GetLoggerLevelArgs from constant offsets.
|
|
func (x *GetLoggerLevelArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(getLoggerLevelArgsSize + 256)
|
|
ob := b.StartObject(getLoggerLevelArgsSize)
|
|
ob.SetText(getLoggerLevelArgsLoggerNameAt, string(x.LoggerName))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads GetLoggerLevelArgs out of the buffer that arrived.
|
|
func (x *GetLoggerLevelArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("GetLoggerLevelArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.LoggerName = string(strings.Clone(o.Text(getLoggerLevelArgsLoggerNameAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- GetTrackedChainsReply ---------------------------------------------
|
|
|
|
const (
|
|
getTrackedChainsReplyTrackedChainsAt = 0
|
|
getTrackedChainsReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*GetTrackedChainsReply)(nil)
|
|
|
|
// MarshalZAP writes GetTrackedChainsReply from constant offsets.
|
|
func (x *GetTrackedChainsReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(getTrackedChainsReplySize + 256)
|
|
trackedChainsAt, trackedChainsN := 0, len(x.TrackedChains)
|
|
if trackedChainsN > 0 {
|
|
var blob []byte
|
|
for i := range x.TrackedChains {
|
|
enc := []byte(x.TrackedChains[i])
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
trackedChainsAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(getTrackedChainsReplySize)
|
|
if trackedChainsN > 0 {
|
|
ob.SetList(getTrackedChainsReplyTrackedChainsAt, trackedChainsAt, trackedChainsN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads GetTrackedChainsReply out of the buffer that arrived.
|
|
func (x *GetTrackedChainsReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("GetTrackedChainsReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(getTrackedChainsReplyTrackedChainsAt); l.Len() > 0 {
|
|
rows := make([]string, l.Len())
|
|
for i := range rows {
|
|
rows[i] = string(l.BytesAt(i))
|
|
}
|
|
x.TrackedChains = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- ListVMsReply ------------------------------------------------------
|
|
|
|
const (
|
|
listVMsReplyVMsAt = 0
|
|
listVMsReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*ListVMsReply)(nil)
|
|
|
|
// MarshalZAP writes ListVMsReply from constant offsets.
|
|
func (x *ListVMsReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(listVMsReplySize + 256)
|
|
vMsAt, vMsN := 0, len(x.VMs)
|
|
if vMsN > 0 {
|
|
var blob []byte
|
|
for i := range x.VMs {
|
|
enc, err := x.VMs[i].MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
vMsAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(listVMsReplySize)
|
|
if vMsN > 0 {
|
|
ob.SetList(listVMsReplyVMsAt, vMsAt, vMsN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads ListVMsReply out of the buffer that arrived.
|
|
func (x *ListVMsReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("ListVMsReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(listVMsReplyVMsAt); l.Len() > 0 {
|
|
rows := make(InstalledVMs, l.Len())
|
|
for i := range rows {
|
|
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
x.VMs = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- LoadArgs ----------------------------------------------------------
|
|
|
|
const (
|
|
loadArgsPathAt = 0
|
|
loadArgsSize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoadArgs)(nil)
|
|
|
|
// MarshalZAP writes LoadArgs from constant offsets.
|
|
func (x *LoadArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loadArgsSize + 256)
|
|
ob := b.StartObject(loadArgsSize)
|
|
ob.SetText(loadArgsPathAt, string(x.Path))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoadArgs out of the buffer that arrived.
|
|
func (x *LoadArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoadArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Path = string(strings.Clone(o.Text(loadArgsPathAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- LoadVMsReply ------------------------------------------------------
|
|
|
|
const (
|
|
loadVMsReplyNewVMsAt = 0
|
|
loadVMsReplyFailedVMsAt = 8
|
|
loadVMsReplyChainsRetriedAt = 16
|
|
loadVMsReplySize = 24
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoadVMsReply)(nil)
|
|
|
|
// MarshalZAP writes LoadVMsReply from constant offsets.
|
|
func (x *LoadVMsReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loadVMsReplySize + 256)
|
|
newVMsAt, newVMsN := 0, len(x.NewVMs)
|
|
if newVMsN > 0 {
|
|
var blob []byte
|
|
for i := range x.NewVMs {
|
|
enc, err := x.NewVMs[i].MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
newVMsAt = b.WriteBytes(blob)
|
|
}
|
|
failedVMsAt, failedVMsN := 0, len(x.FailedVMs)
|
|
if failedVMsN > 0 {
|
|
var blob []byte
|
|
for i := range x.FailedVMs {
|
|
enc, err := x.FailedVMs[i].MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
failedVMsAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(loadVMsReplySize)
|
|
ob.SetInt64(loadVMsReplyChainsRetriedAt, int64(x.ChainsRetried))
|
|
if newVMsN > 0 {
|
|
ob.SetList(loadVMsReplyNewVMsAt, newVMsAt, newVMsN)
|
|
}
|
|
if failedVMsN > 0 {
|
|
ob.SetList(loadVMsReplyFailedVMsAt, failedVMsAt, failedVMsN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoadVMsReply out of the buffer that arrived.
|
|
func (x *LoadVMsReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoadVMsReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(loadVMsReplyNewVMsAt); l.Len() > 0 {
|
|
rows := make(LoadedVMs, l.Len())
|
|
for i := range rows {
|
|
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
x.NewVMs = rows
|
|
}
|
|
if l := o.List(loadVMsReplyFailedVMsAt); l.Len() > 0 {
|
|
rows := make(FailedVMs, l.Len())
|
|
for i := range rows {
|
|
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
x.FailedVMs = rows
|
|
}
|
|
x.ChainsRetried = int(o.Int64(loadVMsReplyChainsRetriedAt))
|
|
return nil
|
|
}
|
|
|
|
// ---- LoadedVM ----------------------------------------------------------
|
|
|
|
const (
|
|
loadedVMVMAt = 0
|
|
loadedVMAliasesAt = 32
|
|
loadedVMSize = 40
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoadedVM)(nil)
|
|
|
|
// MarshalZAP writes LoadedVM from constant offsets.
|
|
func (x *LoadedVM) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loadedVMSize + 256)
|
|
aliasesAt, aliasesN := 0, len(x.Aliases)
|
|
if aliasesN > 0 {
|
|
var blob []byte
|
|
for i := range x.Aliases {
|
|
enc := []byte(x.Aliases[i])
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
aliasesAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(loadedVMSize)
|
|
ob.SetBytesFixed(loadedVMVMAt, x.VM[:])
|
|
if aliasesN > 0 {
|
|
ob.SetList(loadedVMAliasesAt, aliasesAt, aliasesN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoadedVM out of the buffer that arrived.
|
|
func (x *LoadedVM) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoadedVM: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.VM[:], o.BytesFixed(loadedVMVMAt, 32))
|
|
if l := o.List(loadedVMAliasesAt); l.Len() > 0 {
|
|
rows := make([]string, l.Len())
|
|
for i := range rows {
|
|
rows[i] = string(l.BytesAt(i))
|
|
}
|
|
x.Aliases = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- LogAndDisplayLevels -----------------------------------------------
|
|
|
|
const (
|
|
logAndDisplayLevelsLogLevelAt = 0
|
|
logAndDisplayLevelsDisplayLevelAt = 8
|
|
logAndDisplayLevelsSize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LogAndDisplayLevels)(nil)
|
|
|
|
// MarshalZAP writes LogAndDisplayLevels from constant offsets.
|
|
func (x *LogAndDisplayLevels) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(logAndDisplayLevelsSize + 256)
|
|
ob := b.StartObject(logAndDisplayLevelsSize)
|
|
ob.SetText(logAndDisplayLevelsLogLevelAt, string(x.LogLevel))
|
|
ob.SetText(logAndDisplayLevelsDisplayLevelAt, string(x.DisplayLevel))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LogAndDisplayLevels out of the buffer that arrived.
|
|
func (x *LogAndDisplayLevels) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LogAndDisplayLevels: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.LogLevel = string(strings.Clone(o.Text(logAndDisplayLevelsLogLevelAt)))
|
|
x.DisplayLevel = string(strings.Clone(o.Text(logAndDisplayLevelsDisplayLevelAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- LoggerLevel -------------------------------------------------------
|
|
|
|
const (
|
|
loggerLevelLoggerAt = 0
|
|
loggerLevelLevelsAt = 8
|
|
loggerLevelSize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoggerLevel)(nil)
|
|
|
|
// MarshalZAP writes LoggerLevel from constant offsets.
|
|
func (x *LoggerLevel) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loggerLevelSize + 256)
|
|
ob := b.StartObject(loggerLevelSize)
|
|
ob.SetText(loggerLevelLoggerAt, string(x.Logger))
|
|
innerLevels, err := x.Levels.MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
ob.SetBytes(loggerLevelLevelsAt, innerLevels)
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoggerLevel out of the buffer that arrived.
|
|
func (x *LoggerLevel) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoggerLevel: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Logger = string(strings.Clone(o.Text(loggerLevelLoggerAt)))
|
|
if raw := o.Bytes(loggerLevelLevelsAt); len(raw) > 0 {
|
|
if err := x.Levels.UnmarshalZAP(raw); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- LoggerLevelReply --------------------------------------------------
|
|
|
|
const (
|
|
loggerLevelReplyLoggerLevelsAt = 0
|
|
loggerLevelReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoggerLevelReply)(nil)
|
|
|
|
// MarshalZAP writes LoggerLevelReply from constant offsets.
|
|
func (x *LoggerLevelReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loggerLevelReplySize + 256)
|
|
loggerLevelsAt, loggerLevelsN := 0, len(x.LoggerLevels)
|
|
if loggerLevelsN > 0 {
|
|
var blob []byte
|
|
for i := range x.LoggerLevels {
|
|
enc, err := x.LoggerLevels[i].MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
loggerLevelsAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(loggerLevelReplySize)
|
|
if loggerLevelsN > 0 {
|
|
ob.SetList(loggerLevelReplyLoggerLevelsAt, loggerLevelsAt, loggerLevelsN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoggerLevelReply out of the buffer that arrived.
|
|
func (x *LoggerLevelReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoggerLevelReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(loggerLevelReplyLoggerLevelsAt); l.Len() > 0 {
|
|
rows := make(LoggerLevels, l.Len())
|
|
for i := range rows {
|
|
if err := rows[i].UnmarshalZAP(l.BytesAt(i)); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
x.LoggerLevels = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- SetLoggerLevelArgs ------------------------------------------------
|
|
|
|
const (
|
|
setLoggerLevelArgsLoggerNameAt = 0
|
|
setLoggerLevelArgsLogLevelAt = 8
|
|
setLoggerLevelArgsDisplayLevelAt = 16
|
|
setLoggerLevelArgsSize = 24
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*SetLoggerLevelArgs)(nil)
|
|
|
|
// MarshalZAP writes SetLoggerLevelArgs from constant offsets.
|
|
func (x *SetLoggerLevelArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(setLoggerLevelArgsSize + 256)
|
|
ob := b.StartObject(setLoggerLevelArgsSize)
|
|
ob.SetText(setLoggerLevelArgsLoggerNameAt, string(x.LoggerName))
|
|
ob.SetText(setLoggerLevelArgsLogLevelAt, string(x.LogLevel))
|
|
ob.SetText(setLoggerLevelArgsDisplayLevelAt, string(x.DisplayLevel))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads SetLoggerLevelArgs out of the buffer that arrived.
|
|
func (x *SetLoggerLevelArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("SetLoggerLevelArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.LoggerName = string(strings.Clone(o.Text(setLoggerLevelArgsLoggerNameAt)))
|
|
x.LogLevel = string(strings.Clone(o.Text(setLoggerLevelArgsLogLevelAt)))
|
|
x.DisplayLevel = string(strings.Clone(o.Text(setLoggerLevelArgsDisplayLevelAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- SetTrackedChainsArgs ----------------------------------------------
|
|
|
|
const (
|
|
setTrackedChainsArgsChainsAt = 0
|
|
setTrackedChainsArgsSize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*SetTrackedChainsArgs)(nil)
|
|
|
|
// MarshalZAP writes SetTrackedChainsArgs from constant offsets.
|
|
func (x *SetTrackedChainsArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(setTrackedChainsArgsSize + 256)
|
|
chainsAt, chainsN := 0, len(x.Chains)
|
|
if chainsN > 0 {
|
|
var blob []byte
|
|
for i := range x.Chains {
|
|
enc := []byte(x.Chains[i])
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
chainsAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(setTrackedChainsArgsSize)
|
|
if chainsN > 0 {
|
|
ob.SetList(setTrackedChainsArgsChainsAt, chainsAt, chainsN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads SetTrackedChainsArgs out of the buffer that arrived.
|
|
func (x *SetTrackedChainsArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("SetTrackedChainsArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(setTrackedChainsArgsChainsAt); l.Len() > 0 {
|
|
rows := make([]string, l.Len())
|
|
for i := range rows {
|
|
rows[i] = string(l.BytesAt(i))
|
|
}
|
|
x.Chains = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- SetTrackedChainsReply ---------------------------------------------
|
|
|
|
const (
|
|
setTrackedChainsReplyTrackedChainsAt = 0
|
|
setTrackedChainsReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*SetTrackedChainsReply)(nil)
|
|
|
|
// MarshalZAP writes SetTrackedChainsReply from constant offsets.
|
|
func (x *SetTrackedChainsReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(setTrackedChainsReplySize + 256)
|
|
trackedChainsAt, trackedChainsN := 0, len(x.TrackedChains)
|
|
if trackedChainsN > 0 {
|
|
var blob []byte
|
|
for i := range x.TrackedChains {
|
|
enc := []byte(x.TrackedChains[i])
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
trackedChainsAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(setTrackedChainsReplySize)
|
|
if trackedChainsN > 0 {
|
|
ob.SetList(setTrackedChainsReplyTrackedChainsAt, trackedChainsAt, trackedChainsN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads SetTrackedChainsReply out of the buffer that arrived.
|
|
func (x *SetTrackedChainsReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("SetTrackedChainsReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if l := o.List(setTrackedChainsReplyTrackedChainsAt); l.Len() > 0 {
|
|
rows := make([]string, l.Len())
|
|
for i := range rows {
|
|
rows[i] = string(l.BytesAt(i))
|
|
}
|
|
x.TrackedChains = rows
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- SnapshotArgs ------------------------------------------------------
|
|
|
|
const (
|
|
snapshotArgsPathAt = 0
|
|
snapshotArgsSinceAt = 8
|
|
snapshotArgsSize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*SnapshotArgs)(nil)
|
|
|
|
// MarshalZAP writes SnapshotArgs from constant offsets.
|
|
func (x *SnapshotArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(snapshotArgsSize + 256)
|
|
ob := b.StartObject(snapshotArgsSize)
|
|
ob.SetText(snapshotArgsPathAt, string(x.Path))
|
|
ob.SetUint64(snapshotArgsSinceAt, uint64(x.Since))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads SnapshotArgs out of the buffer that arrived.
|
|
func (x *SnapshotArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("SnapshotArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Path = string(strings.Clone(o.Text(snapshotArgsPathAt)))
|
|
x.Since = uint64(o.Uint64(snapshotArgsSinceAt))
|
|
return nil
|
|
}
|
|
|
|
// ---- SnapshotReply -----------------------------------------------------
|
|
|
|
const (
|
|
snapshotReplyVersionAt = 0
|
|
snapshotReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*SnapshotReply)(nil)
|
|
|
|
// MarshalZAP writes SnapshotReply from constant offsets.
|
|
func (x *SnapshotReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(snapshotReplySize + 256)
|
|
ob := b.StartObject(snapshotReplySize)
|
|
ob.SetUint64(snapshotReplyVersionAt, uint64(x.Version))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads SnapshotReply out of the buffer that arrived.
|
|
func (x *SnapshotReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("SnapshotReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Version = uint64(o.Uint64(snapshotReplyVersionAt))
|
|
return nil
|
|
}
|
|
|
|
// ---- VMInfo ------------------------------------------------------------
|
|
|
|
const (
|
|
vMInfoIDAt = 0
|
|
vMInfoAliasesAt = 8
|
|
vMInfoPathAt = 16
|
|
vMInfoSize = 24
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*VMInfo)(nil)
|
|
|
|
// MarshalZAP writes VMInfo from constant offsets.
|
|
func (x *VMInfo) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(vMInfoSize + 256)
|
|
aliasesAt, aliasesN := 0, len(x.Aliases)
|
|
if aliasesN > 0 {
|
|
var blob []byte
|
|
for i := range x.Aliases {
|
|
enc := []byte(x.Aliases[i])
|
|
var n [4]byte
|
|
binary.LittleEndian.PutUint32(n[:], uint32(len(enc)))
|
|
blob = append(blob, n[:]...)
|
|
blob = append(blob, enc...)
|
|
}
|
|
aliasesAt = b.WriteBytes(blob)
|
|
}
|
|
ob := b.StartObject(vMInfoSize)
|
|
ob.SetText(vMInfoIDAt, string(x.ID))
|
|
ob.SetText(vMInfoPathAt, string(x.Path))
|
|
if aliasesN > 0 {
|
|
ob.SetList(vMInfoAliasesAt, aliasesAt, aliasesN)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads VMInfo out of the buffer that arrived.
|
|
func (x *VMInfo) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("VMInfo: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.ID = string(strings.Clone(o.Text(vMInfoIDAt)))
|
|
if l := o.List(vMInfoAliasesAt); l.Len() > 0 {
|
|
rows := make([]string, l.Len())
|
|
for i := range rows {
|
|
rows[i] = string(l.BytesAt(i))
|
|
}
|
|
x.Aliases = rows
|
|
}
|
|
x.Path = string(strings.Clone(o.Text(vMInfoPathAt)))
|
|
return nil
|
|
}
|