aa580b158e
Signed-off-by: Anton Nesterov <anton@demiurg.io>
494 lines
12 KiB
Go
494 lines
12 KiB
Go
package proto
|
|
|
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
|
|
|
import (
|
|
"github.com/tinylib/msgp/msgp"
|
|
)
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *BuilderMethod) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "method":
|
|
z.Method, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Method")
|
|
return
|
|
}
|
|
case "args":
|
|
var zb0002 uint32
|
|
zb0002, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args")
|
|
return
|
|
}
|
|
if cap(z.Args) >= int(zb0002) {
|
|
z.Args = (z.Args)[:zb0002]
|
|
} else {
|
|
z.Args = make([]interface{}, zb0002)
|
|
}
|
|
for za0001 := range z.Args {
|
|
z.Args[za0001], err = dc.ReadIntf()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args", za0001)
|
|
return
|
|
}
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *BuilderMethod) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 2
|
|
// write "method"
|
|
err = en.Append(0x82, 0xa6, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.Method)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Method")
|
|
return
|
|
}
|
|
// write "args"
|
|
err = en.Append(0xa4, 0x61, 0x72, 0x67, 0x73)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.Args)))
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args")
|
|
return
|
|
}
|
|
for za0001 := range z.Args {
|
|
err = en.WriteIntf(z.Args[za0001])
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args", za0001)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *BuilderMethod) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 2
|
|
// string "method"
|
|
o = append(o, 0x82, 0xa6, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64)
|
|
o = msgp.AppendString(o, z.Method)
|
|
// string "args"
|
|
o = append(o, 0xa4, 0x61, 0x72, 0x67, 0x73)
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.Args)))
|
|
for za0001 := range z.Args {
|
|
o, err = msgp.AppendIntf(o, z.Args[za0001])
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args", za0001)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *BuilderMethod) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "method":
|
|
z.Method, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Method")
|
|
return
|
|
}
|
|
case "args":
|
|
var zb0002 uint32
|
|
zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args")
|
|
return
|
|
}
|
|
if cap(z.Args) >= int(zb0002) {
|
|
z.Args = (z.Args)[:zb0002]
|
|
} else {
|
|
z.Args = make([]interface{}, zb0002)
|
|
}
|
|
for za0001 := range z.Args {
|
|
z.Args[za0001], bts, err = msgp.ReadIntfBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Args", za0001)
|
|
return
|
|
}
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *BuilderMethod) Msgsize() (s int) {
|
|
s = 1 + 7 + msgp.StringPrefixSize + len(z.Method) + 5 + msgp.ArrayHeaderSize
|
|
for za0001 := range z.Args {
|
|
s += msgp.GuessSize(z.Args[za0001])
|
|
}
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *Request) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "id":
|
|
z.Id, err = dc.ReadUint32()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Id")
|
|
return
|
|
}
|
|
case "db":
|
|
z.Db, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Db")
|
|
return
|
|
}
|
|
case "commands":
|
|
var zb0002 uint32
|
|
zb0002, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands")
|
|
return
|
|
}
|
|
if cap(z.Commands) >= int(zb0002) {
|
|
z.Commands = (z.Commands)[:zb0002]
|
|
} else {
|
|
z.Commands = make([]BuilderMethod, zb0002)
|
|
}
|
|
for za0001 := range z.Commands {
|
|
var zb0003 uint32
|
|
zb0003, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001)
|
|
return
|
|
}
|
|
for zb0003 > 0 {
|
|
zb0003--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "method":
|
|
z.Commands[za0001].Method, err = dc.ReadString()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Method")
|
|
return
|
|
}
|
|
case "args":
|
|
var zb0004 uint32
|
|
zb0004, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args")
|
|
return
|
|
}
|
|
if cap(z.Commands[za0001].Args) >= int(zb0004) {
|
|
z.Commands[za0001].Args = (z.Commands[za0001].Args)[:zb0004]
|
|
} else {
|
|
z.Commands[za0001].Args = make([]interface{}, zb0004)
|
|
}
|
|
for za0002 := range z.Commands[za0001].Args {
|
|
z.Commands[za0001].Args[za0002], err = dc.ReadIntf()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args", za0002)
|
|
return
|
|
}
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *Request) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 3
|
|
// write "id"
|
|
err = en.Append(0x83, 0xa2, 0x69, 0x64)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteUint32(z.Id)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Id")
|
|
return
|
|
}
|
|
// write "db"
|
|
err = en.Append(0xa2, 0x64, 0x62)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.Db)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Db")
|
|
return
|
|
}
|
|
// write "commands"
|
|
err = en.Append(0xa8, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.Commands)))
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands")
|
|
return
|
|
}
|
|
for za0001 := range z.Commands {
|
|
// map header, size 2
|
|
// write "method"
|
|
err = en.Append(0x82, 0xa6, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteString(z.Commands[za0001].Method)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Method")
|
|
return
|
|
}
|
|
// write "args"
|
|
err = en.Append(0xa4, 0x61, 0x72, 0x67, 0x73)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.Commands[za0001].Args)))
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args")
|
|
return
|
|
}
|
|
for za0002 := range z.Commands[za0001].Args {
|
|
err = en.WriteIntf(z.Commands[za0001].Args[za0002])
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args", za0002)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *Request) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 3
|
|
// string "id"
|
|
o = append(o, 0x83, 0xa2, 0x69, 0x64)
|
|
o = msgp.AppendUint32(o, z.Id)
|
|
// string "db"
|
|
o = append(o, 0xa2, 0x64, 0x62)
|
|
o = msgp.AppendString(o, z.Db)
|
|
// string "commands"
|
|
o = append(o, 0xa8, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73)
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.Commands)))
|
|
for za0001 := range z.Commands {
|
|
// map header, size 2
|
|
// string "method"
|
|
o = append(o, 0x82, 0xa6, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64)
|
|
o = msgp.AppendString(o, z.Commands[za0001].Method)
|
|
// string "args"
|
|
o = append(o, 0xa4, 0x61, 0x72, 0x67, 0x73)
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.Commands[za0001].Args)))
|
|
for za0002 := range z.Commands[za0001].Args {
|
|
o, err = msgp.AppendIntf(o, z.Commands[za0001].Args[za0002])
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args", za0002)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *Request) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zb0001 uint32
|
|
zb0001, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
for zb0001 > 0 {
|
|
zb0001--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "id":
|
|
z.Id, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Id")
|
|
return
|
|
}
|
|
case "db":
|
|
z.Db, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Db")
|
|
return
|
|
}
|
|
case "commands":
|
|
var zb0002 uint32
|
|
zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands")
|
|
return
|
|
}
|
|
if cap(z.Commands) >= int(zb0002) {
|
|
z.Commands = (z.Commands)[:zb0002]
|
|
} else {
|
|
z.Commands = make([]BuilderMethod, zb0002)
|
|
}
|
|
for za0001 := range z.Commands {
|
|
var zb0003 uint32
|
|
zb0003, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001)
|
|
return
|
|
}
|
|
for zb0003 > 0 {
|
|
zb0003--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001)
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "method":
|
|
z.Commands[za0001].Method, bts, err = msgp.ReadStringBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Method")
|
|
return
|
|
}
|
|
case "args":
|
|
var zb0004 uint32
|
|
zb0004, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args")
|
|
return
|
|
}
|
|
if cap(z.Commands[za0001].Args) >= int(zb0004) {
|
|
z.Commands[za0001].Args = (z.Commands[za0001].Args)[:zb0004]
|
|
} else {
|
|
z.Commands[za0001].Args = make([]interface{}, zb0004)
|
|
}
|
|
for za0002 := range z.Commands[za0001].Args {
|
|
z.Commands[za0001].Args[za0002], bts, err = msgp.ReadIntfBytes(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001, "Args", za0002)
|
|
return
|
|
}
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err, "Commands", za0001)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
err = msgp.WrapError(err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *Request) Msgsize() (s int) {
|
|
s = 1 + 3 + msgp.Uint32Size + 3 + msgp.StringPrefixSize + len(z.Db) + 9 + msgp.ArrayHeaderSize
|
|
for za0001 := range z.Commands {
|
|
s += 1 + 7 + msgp.StringPrefixSize + len(z.Commands[za0001].Method) + 5 + msgp.ArrayHeaderSize
|
|
for za0002 := range z.Commands[za0001].Args {
|
|
s += msgp.GuessSize(z.Commands[za0001].Args[za0002])
|
|
}
|
|
}
|
|
return
|
|
}
|