forked from TrueCloudLab/frostfs-api-go
8690 lines
213 KiB
Go
Generated
8690 lines
213 KiB
Go
Generated
// Code generated by protoc-gen-go-frostfs. DO NOT EDIT.
|
|
|
|
package object
|
|
|
|
import (
|
|
json "encoding/json"
|
|
fmt "fmt"
|
|
grpc "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
|
grpc1 "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/grpc"
|
|
pool "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/pool"
|
|
proto "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
|
encoding "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto/encoding"
|
|
easyproto "github.com/VictoriaMetrics/easyproto"
|
|
jlexer "github.com/mailru/easyjson/jlexer"
|
|
jwriter "github.com/mailru/easyjson/jwriter"
|
|
strconv "strconv"
|
|
)
|
|
|
|
type GetRequest_Body struct {
|
|
Address *grpc.Address `json:"address"`
|
|
Raw bool `json:"raw"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRequest_Body)(nil)
|
|
_ json.Marshaler = (*GetRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*GetRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Address)
|
|
size += proto.BoolSize(2, x.Raw)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Address != nil && x.Address.StableSize() != 0 {
|
|
x.Address.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Raw {
|
|
mm.AppendBool(2, x.Raw)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Address
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Address")
|
|
}
|
|
x.Address = new(grpc.Address)
|
|
if err := x.Address.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Raw
|
|
data, ok := fc.Bool()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Raw")
|
|
}
|
|
x.Raw = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRequest_Body) GetAddress() *grpc.Address {
|
|
if x != nil {
|
|
return x.Address
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRequest_Body) SetAddress(v *grpc.Address) {
|
|
x.Address = v
|
|
}
|
|
func (x *GetRequest_Body) GetRaw() bool {
|
|
if x != nil {
|
|
return x.Raw
|
|
}
|
|
return false
|
|
}
|
|
func (x *GetRequest_Body) SetRaw(v bool) {
|
|
x.Raw = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix[1:])
|
|
x.Address.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"raw\":"
|
|
out.RawString(prefix)
|
|
out.Bool(x.Raw)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "address":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Address = f
|
|
}
|
|
case "raw":
|
|
{
|
|
var f bool
|
|
f = in.Bool()
|
|
x.Raw = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRequest struct {
|
|
Body *GetRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRequest)(nil)
|
|
_ json.Marshaler = (*GetRequest)(nil)
|
|
_ json.Unmarshaler = (*GetRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *GetRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *GetRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(GetRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRequest) GetBody() *GetRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRequest) SetBody(v *GetRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *GetRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *GetRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *GetRequest_Body
|
|
f = new(GetRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetResponse_Body_Init struct {
|
|
ObjectId *grpc.ObjectID `json:"objectId"`
|
|
Signature *grpc.Signature `json:"signature"`
|
|
Header *Header `json:"header"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetResponse_Body_Init)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetResponse_Body_Init)(nil)
|
|
_ json.Marshaler = (*GetResponse_Body_Init)(nil)
|
|
_ json.Unmarshaler = (*GetResponse_Body_Init)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetResponse_Body_Init) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.ObjectId)
|
|
size += proto.NestedStructureSize(2, x.Signature)
|
|
size += proto.NestedStructureSize(3, x.Header)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetResponse_Body_Init) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetResponse_Body_Init) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.ObjectId != nil && x.ObjectId.StableSize() != 0 {
|
|
x.ObjectId.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Signature != nil && x.Signature.StableSize() != 0 {
|
|
x.Signature.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.Header != nil && x.Header.StableSize() != 0 {
|
|
x.Header.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetResponse_Body_Init) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetResponse_Body_Init")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // ObjectId
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ObjectId")
|
|
}
|
|
x.ObjectId = new(grpc.ObjectID)
|
|
if err := x.ObjectId.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Signature
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Signature")
|
|
}
|
|
x.Signature = new(grpc.Signature)
|
|
if err := x.Signature.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // Header
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Header")
|
|
}
|
|
x.Header = new(Header)
|
|
if err := x.Header.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body_Init) GetObjectId() *grpc.ObjectID {
|
|
if x != nil {
|
|
return x.ObjectId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body_Init) SetObjectId(v *grpc.ObjectID) {
|
|
x.ObjectId = v
|
|
}
|
|
func (x *GetResponse_Body_Init) GetSignature() *grpc.Signature {
|
|
if x != nil {
|
|
return x.Signature
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body_Init) SetSignature(v *grpc.Signature) {
|
|
x.Signature = v
|
|
}
|
|
func (x *GetResponse_Body_Init) GetHeader() *Header {
|
|
if x != nil {
|
|
return x.Header
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body_Init) SetHeader(v *Header) {
|
|
x.Header = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetResponse_Body_Init) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetResponse_Body_Init) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"objectId\":"
|
|
out.RawString(prefix[1:])
|
|
x.ObjectId.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"signature\":"
|
|
out.RawString(prefix)
|
|
x.Signature.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"header\":"
|
|
out.RawString(prefix)
|
|
x.Header.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetResponse_Body_Init) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetResponse_Body_Init) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "objectId":
|
|
{
|
|
var f *grpc.ObjectID
|
|
f = new(grpc.ObjectID)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.ObjectId = f
|
|
}
|
|
case "signature":
|
|
{
|
|
var f *grpc.Signature
|
|
f = new(grpc.Signature)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Signature = f
|
|
}
|
|
case "header":
|
|
{
|
|
var f *Header
|
|
f = new(Header)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Header = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetResponse_Body struct {
|
|
ObjectPart isGetResponse_Body_ObjectPart
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetResponse_Body)(nil)
|
|
_ json.Marshaler = (*GetResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*GetResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok {
|
|
size += proto.NestedStructureSize(1, inner.Init)
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_Chunk); ok {
|
|
size += proto.BytesSize(2, inner.Chunk)
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok {
|
|
size += proto.NestedStructureSize(3, inner.SplitInfo)
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok {
|
|
size += proto.NestedStructureSize(4, inner.EcInfo)
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_Init_); ok {
|
|
if inner.Init != nil && inner.Init.StableSize() != 0 {
|
|
inner.Init.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_Chunk); ok {
|
|
if len(inner.Chunk) != 0 {
|
|
mm.AppendBytes(2, inner.Chunk)
|
|
}
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_SplitInfo); ok {
|
|
if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 {
|
|
inner.SplitInfo.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
if inner, ok := x.ObjectPart.(*GetResponse_Body_EcInfo); ok {
|
|
if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 {
|
|
inner.EcInfo.EmitProtobuf(mm.AppendMessage(4))
|
|
}
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Init
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Init")
|
|
}
|
|
oneofField := &GetResponse_Body_Init_{Init: new(GetResponse_Body_Init)}
|
|
if err := oneofField.Init.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.ObjectPart = oneofField
|
|
case 2: // Chunk
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Chunk")
|
|
}
|
|
x.ObjectPart = &GetResponse_Body_Chunk{Chunk: data}
|
|
case 3: // SplitInfo
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "SplitInfo")
|
|
}
|
|
oneofField := &GetResponse_Body_SplitInfo{SplitInfo: new(SplitInfo)}
|
|
if err := oneofField.SplitInfo.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.ObjectPart = oneofField
|
|
case 4: // EcInfo
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "EcInfo")
|
|
}
|
|
oneofField := &GetResponse_Body_EcInfo{EcInfo: new(ECInfo)}
|
|
if err := oneofField.EcInfo.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.ObjectPart = oneofField
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body) GetObjectPart() isGetResponse_Body_ObjectPart {
|
|
if x != nil {
|
|
return x.ObjectPart
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body) SetObjectPart(v isGetResponse_Body_ObjectPart) {
|
|
x.ObjectPart = v
|
|
}
|
|
func (x *GetResponse_Body) GetInit() *GetResponse_Body_Init {
|
|
if xx, ok := x.GetObjectPart().(*GetResponse_Body_Init_); ok {
|
|
return xx.Init
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body) SetInit(v *GetResponse_Body_Init) {
|
|
x.ObjectPart = &GetResponse_Body_Init_{Init: v}
|
|
}
|
|
func (x *GetResponse_Body) GetChunk() *GetResponse_Body_Chunk {
|
|
if xx, ok := x.GetObjectPart().(*GetResponse_Body_Chunk); ok {
|
|
return xx
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body) SetChunk(v *GetResponse_Body_Chunk) {
|
|
x.ObjectPart = v
|
|
}
|
|
func (x *GetResponse_Body_Chunk) GetChunk() []byte {
|
|
if x != nil {
|
|
return x.Chunk
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body_Chunk) SetChunk(v []byte) {
|
|
x.Chunk = v
|
|
}
|
|
func (x *GetResponse_Body) GetSplitInfo() *SplitInfo {
|
|
if xx, ok := x.GetObjectPart().(*GetResponse_Body_SplitInfo); ok {
|
|
return xx.SplitInfo
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body) SetSplitInfo(v *SplitInfo) {
|
|
x.ObjectPart = &GetResponse_Body_SplitInfo{SplitInfo: v}
|
|
}
|
|
func (x *GetResponse_Body) GetEcInfo() *ECInfo {
|
|
if xx, ok := x.GetObjectPart().(*GetResponse_Body_EcInfo); ok {
|
|
return xx.EcInfo
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse_Body) SetEcInfo(v *ECInfo) {
|
|
x.ObjectPart = &GetResponse_Body_EcInfo{EcInfo: v}
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
switch xx := x.ObjectPart.(type) {
|
|
case *GetResponse_Body_Init_:
|
|
{
|
|
const prefix string = ",\"init\":"
|
|
out.RawString(prefix[1:])
|
|
xx.Init.MarshalEasyJSON(out)
|
|
}
|
|
case *GetResponse_Body_Chunk:
|
|
{
|
|
const prefix string = ",\"chunk\":"
|
|
out.RawString(prefix[1:])
|
|
out.Base64Bytes(xx.Chunk)
|
|
}
|
|
case *GetResponse_Body_SplitInfo:
|
|
{
|
|
const prefix string = ",\"splitInfo\":"
|
|
out.RawString(prefix[1:])
|
|
xx.SplitInfo.MarshalEasyJSON(out)
|
|
}
|
|
case *GetResponse_Body_EcInfo:
|
|
{
|
|
const prefix string = ",\"ecInfo\":"
|
|
out.RawString(prefix[1:])
|
|
xx.EcInfo.MarshalEasyJSON(out)
|
|
}
|
|
default:
|
|
out.RawString("null")
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "init":
|
|
xx := new(GetResponse_Body_Init_)
|
|
x.ObjectPart = xx
|
|
{
|
|
var f *GetResponse_Body_Init
|
|
f = new(GetResponse_Body_Init)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.Init = f
|
|
}
|
|
case "chunk":
|
|
xx := new(GetResponse_Body_Chunk)
|
|
x.ObjectPart = xx
|
|
{
|
|
var f []byte
|
|
f = in.Bytes()
|
|
xx.Chunk = f
|
|
}
|
|
case "splitInfo":
|
|
xx := new(GetResponse_Body_SplitInfo)
|
|
x.ObjectPart = xx
|
|
{
|
|
var f *SplitInfo
|
|
f = new(SplitInfo)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.SplitInfo = f
|
|
}
|
|
case "ecInfo":
|
|
xx := new(GetResponse_Body_EcInfo)
|
|
x.ObjectPart = xx
|
|
{
|
|
var f *ECInfo
|
|
f = new(ECInfo)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.EcInfo = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type isGetResponse_Body_ObjectPart interface {
|
|
isGetResponse_Body_ObjectPart()
|
|
}
|
|
|
|
type GetResponse_Body_Init_ struct {
|
|
Init *GetResponse_Body_Init
|
|
}
|
|
|
|
type GetResponse_Body_Chunk struct {
|
|
Chunk []byte
|
|
}
|
|
|
|
type GetResponse_Body_SplitInfo struct {
|
|
SplitInfo *SplitInfo
|
|
}
|
|
|
|
type GetResponse_Body_EcInfo struct {
|
|
EcInfo *ECInfo
|
|
}
|
|
|
|
func (*GetResponse_Body_Init_) isGetResponse_Body_ObjectPart() {}
|
|
|
|
func (*GetResponse_Body_Chunk) isGetResponse_Body_ObjectPart() {}
|
|
|
|
func (*GetResponse_Body_SplitInfo) isGetResponse_Body_ObjectPart() {}
|
|
|
|
func (*GetResponse_Body_EcInfo) isGetResponse_Body_ObjectPart() {}
|
|
|
|
type GetResponse struct {
|
|
Body *GetResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetResponse)(nil)
|
|
_ json.Marshaler = (*GetResponse)(nil)
|
|
_ json.Unmarshaler = (*GetResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *GetResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *GetResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(GetResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse) GetBody() *GetResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse) SetBody(v *GetResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *GetResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *GetResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *GetResponse_Body
|
|
f = new(GetResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutRequest_Body_Init struct {
|
|
ObjectId *grpc.ObjectID `json:"objectId"`
|
|
Signature *grpc.Signature `json:"signature"`
|
|
Header *Header `json:"header"`
|
|
CopiesNumber []uint32 `json:"copiesNumber"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutRequest_Body_Init)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutRequest_Body_Init)(nil)
|
|
_ json.Marshaler = (*PutRequest_Body_Init)(nil)
|
|
_ json.Unmarshaler = (*PutRequest_Body_Init)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutRequest_Body_Init) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
var n int
|
|
size += proto.NestedStructureSize(1, x.ObjectId)
|
|
size += proto.NestedStructureSize(2, x.Signature)
|
|
size += proto.NestedStructureSize(3, x.Header)
|
|
n, _ = proto.RepeatedUInt32Size(4, x.CopiesNumber)
|
|
size += n
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutRequest_Body_Init) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutRequest_Body_Init) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.ObjectId != nil && x.ObjectId.StableSize() != 0 {
|
|
x.ObjectId.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Signature != nil && x.Signature.StableSize() != 0 {
|
|
x.Signature.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.Header != nil && x.Header.StableSize() != 0 {
|
|
x.Header.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
if len(x.CopiesNumber) != 0 {
|
|
mm.AppendUint32s(4, x.CopiesNumber)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutRequest_Body_Init) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutRequest_Body_Init")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // ObjectId
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ObjectId")
|
|
}
|
|
x.ObjectId = new(grpc.ObjectID)
|
|
if err := x.ObjectId.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Signature
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Signature")
|
|
}
|
|
x.Signature = new(grpc.Signature)
|
|
if err := x.Signature.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // Header
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Header")
|
|
}
|
|
x.Header = new(Header)
|
|
if err := x.Header.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 4: // CopiesNumber
|
|
data, ok := fc.UnpackUint32s(nil)
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "CopiesNumber")
|
|
}
|
|
x.CopiesNumber = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body_Init) GetObjectId() *grpc.ObjectID {
|
|
if x != nil {
|
|
return x.ObjectId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body_Init) SetObjectId(v *grpc.ObjectID) {
|
|
x.ObjectId = v
|
|
}
|
|
func (x *PutRequest_Body_Init) GetSignature() *grpc.Signature {
|
|
if x != nil {
|
|
return x.Signature
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body_Init) SetSignature(v *grpc.Signature) {
|
|
x.Signature = v
|
|
}
|
|
func (x *PutRequest_Body_Init) GetHeader() *Header {
|
|
if x != nil {
|
|
return x.Header
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body_Init) SetHeader(v *Header) {
|
|
x.Header = v
|
|
}
|
|
func (x *PutRequest_Body_Init) GetCopiesNumber() []uint32 {
|
|
if x != nil {
|
|
return x.CopiesNumber
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body_Init) SetCopiesNumber(v []uint32) {
|
|
x.CopiesNumber = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutRequest_Body_Init) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutRequest_Body_Init) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"objectId\":"
|
|
out.RawString(prefix[1:])
|
|
x.ObjectId.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"signature\":"
|
|
out.RawString(prefix)
|
|
x.Signature.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"header\":"
|
|
out.RawString(prefix)
|
|
x.Header.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"copiesNumber\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.CopiesNumber {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.Uint32(x.CopiesNumber[i])
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutRequest_Body_Init) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutRequest_Body_Init) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "objectId":
|
|
{
|
|
var f *grpc.ObjectID
|
|
f = new(grpc.ObjectID)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.ObjectId = f
|
|
}
|
|
case "signature":
|
|
{
|
|
var f *grpc.Signature
|
|
f = new(grpc.Signature)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Signature = f
|
|
}
|
|
case "header":
|
|
{
|
|
var f *Header
|
|
f = new(Header)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Header = f
|
|
}
|
|
case "copiesNumber":
|
|
{
|
|
var f uint32
|
|
var list []uint32
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = in.Uint32()
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.CopiesNumber = list
|
|
in.Delim(']')
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutRequest_Body struct {
|
|
ObjectPart isPutRequest_Body_ObjectPart
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutRequest_Body)(nil)
|
|
_ json.Marshaler = (*PutRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*PutRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
if inner, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok {
|
|
size += proto.NestedStructureSize(1, inner.Init)
|
|
}
|
|
if inner, ok := x.ObjectPart.(*PutRequest_Body_Chunk); ok {
|
|
size += proto.BytesSize(2, inner.Chunk)
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if inner, ok := x.ObjectPart.(*PutRequest_Body_Init_); ok {
|
|
if inner.Init != nil && inner.Init.StableSize() != 0 {
|
|
inner.Init.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
if inner, ok := x.ObjectPart.(*PutRequest_Body_Chunk); ok {
|
|
if len(inner.Chunk) != 0 {
|
|
mm.AppendBytes(2, inner.Chunk)
|
|
}
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Init
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Init")
|
|
}
|
|
oneofField := &PutRequest_Body_Init_{Init: new(PutRequest_Body_Init)}
|
|
if err := oneofField.Init.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.ObjectPart = oneofField
|
|
case 2: // Chunk
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Chunk")
|
|
}
|
|
x.ObjectPart = &PutRequest_Body_Chunk{Chunk: data}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body) GetObjectPart() isPutRequest_Body_ObjectPart {
|
|
if x != nil {
|
|
return x.ObjectPart
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body) SetObjectPart(v isPutRequest_Body_ObjectPart) {
|
|
x.ObjectPart = v
|
|
}
|
|
func (x *PutRequest_Body) GetInit() *PutRequest_Body_Init {
|
|
if xx, ok := x.GetObjectPart().(*PutRequest_Body_Init_); ok {
|
|
return xx.Init
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body) SetInit(v *PutRequest_Body_Init) {
|
|
x.ObjectPart = &PutRequest_Body_Init_{Init: v}
|
|
}
|
|
func (x *PutRequest_Body) GetChunk() *PutRequest_Body_Chunk {
|
|
if xx, ok := x.GetObjectPart().(*PutRequest_Body_Chunk); ok {
|
|
return xx
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body) SetChunk(v *PutRequest_Body_Chunk) {
|
|
x.ObjectPart = v
|
|
}
|
|
func (x *PutRequest_Body_Chunk) GetChunk() []byte {
|
|
if x != nil {
|
|
return x.Chunk
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest_Body_Chunk) SetChunk(v []byte) {
|
|
x.Chunk = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
switch xx := x.ObjectPart.(type) {
|
|
case *PutRequest_Body_Init_:
|
|
{
|
|
const prefix string = ",\"init\":"
|
|
out.RawString(prefix[1:])
|
|
xx.Init.MarshalEasyJSON(out)
|
|
}
|
|
case *PutRequest_Body_Chunk:
|
|
{
|
|
const prefix string = ",\"chunk\":"
|
|
out.RawString(prefix[1:])
|
|
out.Base64Bytes(xx.Chunk)
|
|
}
|
|
default:
|
|
out.RawString("null")
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "init":
|
|
xx := new(PutRequest_Body_Init_)
|
|
x.ObjectPart = xx
|
|
{
|
|
var f *PutRequest_Body_Init
|
|
f = new(PutRequest_Body_Init)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.Init = f
|
|
}
|
|
case "chunk":
|
|
xx := new(PutRequest_Body_Chunk)
|
|
x.ObjectPart = xx
|
|
{
|
|
var f []byte
|
|
f = in.Bytes()
|
|
xx.Chunk = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type isPutRequest_Body_ObjectPart interface {
|
|
isPutRequest_Body_ObjectPart()
|
|
}
|
|
|
|
type PutRequest_Body_Init_ struct {
|
|
Init *PutRequest_Body_Init
|
|
}
|
|
|
|
type PutRequest_Body_Chunk struct {
|
|
Chunk []byte
|
|
}
|
|
|
|
func (*PutRequest_Body_Init_) isPutRequest_Body_ObjectPart() {}
|
|
|
|
func (*PutRequest_Body_Chunk) isPutRequest_Body_ObjectPart() {}
|
|
|
|
type PutRequest struct {
|
|
Body *PutRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutRequest)(nil)
|
|
_ json.Marshaler = (*PutRequest)(nil)
|
|
_ json.Unmarshaler = (*PutRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *PutRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *PutRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(PutRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest) GetBody() *PutRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest) SetBody(v *PutRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *PutRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *PutRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *PutRequest_Body
|
|
f = new(PutRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutResponse_Body struct {
|
|
ObjectId *grpc.ObjectID `json:"objectId"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutResponse_Body)(nil)
|
|
_ json.Marshaler = (*PutResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*PutResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.ObjectId)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.ObjectId != nil && x.ObjectId.StableSize() != 0 {
|
|
x.ObjectId.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // ObjectId
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ObjectId")
|
|
}
|
|
x.ObjectId = new(grpc.ObjectID)
|
|
if err := x.ObjectId.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutResponse_Body) GetObjectId() *grpc.ObjectID {
|
|
if x != nil {
|
|
return x.ObjectId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutResponse_Body) SetObjectId(v *grpc.ObjectID) {
|
|
x.ObjectId = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"objectId\":"
|
|
out.RawString(prefix[1:])
|
|
x.ObjectId.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "objectId":
|
|
{
|
|
var f *grpc.ObjectID
|
|
f = new(grpc.ObjectID)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.ObjectId = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutResponse struct {
|
|
Body *PutResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutResponse)(nil)
|
|
_ json.Marshaler = (*PutResponse)(nil)
|
|
_ json.Unmarshaler = (*PutResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *PutResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *PutResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(PutResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutResponse) GetBody() *PutResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutResponse) SetBody(v *PutResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *PutResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *PutResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *PutResponse_Body
|
|
f = new(PutResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type DeleteRequest_Body struct {
|
|
Address *grpc.Address `json:"address"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*DeleteRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*DeleteRequest_Body)(nil)
|
|
_ json.Marshaler = (*DeleteRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*DeleteRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *DeleteRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Address)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *DeleteRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *DeleteRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Address != nil && x.Address.StableSize() != 0 {
|
|
x.Address.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *DeleteRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "DeleteRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Address
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Address")
|
|
}
|
|
x.Address = new(grpc.Address)
|
|
if err := x.Address.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteRequest_Body) GetAddress() *grpc.Address {
|
|
if x != nil {
|
|
return x.Address
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteRequest_Body) SetAddress(v *grpc.Address) {
|
|
x.Address = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *DeleteRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *DeleteRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix[1:])
|
|
x.Address.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *DeleteRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *DeleteRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "address":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Address = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type DeleteRequest struct {
|
|
Body *DeleteRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*DeleteRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*DeleteRequest)(nil)
|
|
_ json.Marshaler = (*DeleteRequest)(nil)
|
|
_ json.Unmarshaler = (*DeleteRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *DeleteRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *DeleteRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *DeleteRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *DeleteRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *DeleteRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *DeleteRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "DeleteRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(DeleteRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteRequest) GetBody() *DeleteRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteRequest) SetBody(v *DeleteRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *DeleteRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *DeleteRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *DeleteRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *DeleteRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *DeleteRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *DeleteRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *DeleteRequest_Body
|
|
f = new(DeleteRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type DeleteResponse_Body struct {
|
|
Tombstone *grpc.Address `json:"tombstone"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*DeleteResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*DeleteResponse_Body)(nil)
|
|
_ json.Marshaler = (*DeleteResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*DeleteResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *DeleteResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Tombstone)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *DeleteResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *DeleteResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Tombstone != nil && x.Tombstone.StableSize() != 0 {
|
|
x.Tombstone.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *DeleteResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "DeleteResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Tombstone
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Tombstone")
|
|
}
|
|
x.Tombstone = new(grpc.Address)
|
|
if err := x.Tombstone.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteResponse_Body) GetTombstone() *grpc.Address {
|
|
if x != nil {
|
|
return x.Tombstone
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteResponse_Body) SetTombstone(v *grpc.Address) {
|
|
x.Tombstone = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *DeleteResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *DeleteResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"tombstone\":"
|
|
out.RawString(prefix[1:])
|
|
x.Tombstone.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *DeleteResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *DeleteResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "tombstone":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Tombstone = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type DeleteResponse struct {
|
|
Body *DeleteResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*DeleteResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*DeleteResponse)(nil)
|
|
_ json.Marshaler = (*DeleteResponse)(nil)
|
|
_ json.Unmarshaler = (*DeleteResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *DeleteResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *DeleteResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *DeleteResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *DeleteResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *DeleteResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *DeleteResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "DeleteResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(DeleteResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteResponse) GetBody() *DeleteResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteResponse) SetBody(v *DeleteResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *DeleteResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *DeleteResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *DeleteResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *DeleteResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *DeleteResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *DeleteResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *DeleteResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *DeleteResponse_Body
|
|
f = new(DeleteResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type HeadRequest_Body struct {
|
|
Address *grpc.Address `json:"address"`
|
|
MainOnly bool `json:"mainOnly"`
|
|
Raw bool `json:"raw"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*HeadRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*HeadRequest_Body)(nil)
|
|
_ json.Marshaler = (*HeadRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*HeadRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *HeadRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Address)
|
|
size += proto.BoolSize(2, x.MainOnly)
|
|
size += proto.BoolSize(3, x.Raw)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *HeadRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *HeadRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Address != nil && x.Address.StableSize() != 0 {
|
|
x.Address.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MainOnly {
|
|
mm.AppendBool(2, x.MainOnly)
|
|
}
|
|
if x.Raw {
|
|
mm.AppendBool(3, x.Raw)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *HeadRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "HeadRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Address
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Address")
|
|
}
|
|
x.Address = new(grpc.Address)
|
|
if err := x.Address.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MainOnly
|
|
data, ok := fc.Bool()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MainOnly")
|
|
}
|
|
x.MainOnly = data
|
|
case 3: // Raw
|
|
data, ok := fc.Bool()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Raw")
|
|
}
|
|
x.Raw = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadRequest_Body) GetAddress() *grpc.Address {
|
|
if x != nil {
|
|
return x.Address
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadRequest_Body) SetAddress(v *grpc.Address) {
|
|
x.Address = v
|
|
}
|
|
func (x *HeadRequest_Body) GetMainOnly() bool {
|
|
if x != nil {
|
|
return x.MainOnly
|
|
}
|
|
return false
|
|
}
|
|
func (x *HeadRequest_Body) SetMainOnly(v bool) {
|
|
x.MainOnly = v
|
|
}
|
|
func (x *HeadRequest_Body) GetRaw() bool {
|
|
if x != nil {
|
|
return x.Raw
|
|
}
|
|
return false
|
|
}
|
|
func (x *HeadRequest_Body) SetRaw(v bool) {
|
|
x.Raw = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *HeadRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *HeadRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix[1:])
|
|
x.Address.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"mainOnly\":"
|
|
out.RawString(prefix)
|
|
out.Bool(x.MainOnly)
|
|
}
|
|
{
|
|
const prefix string = ",\"raw\":"
|
|
out.RawString(prefix)
|
|
out.Bool(x.Raw)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *HeadRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *HeadRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "address":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Address = f
|
|
}
|
|
case "mainOnly":
|
|
{
|
|
var f bool
|
|
f = in.Bool()
|
|
x.MainOnly = f
|
|
}
|
|
case "raw":
|
|
{
|
|
var f bool
|
|
f = in.Bool()
|
|
x.Raw = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type HeadRequest struct {
|
|
Body *HeadRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*HeadRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*HeadRequest)(nil)
|
|
_ json.Marshaler = (*HeadRequest)(nil)
|
|
_ json.Unmarshaler = (*HeadRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *HeadRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *HeadRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *HeadRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *HeadRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *HeadRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *HeadRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "HeadRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(HeadRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadRequest) GetBody() *HeadRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadRequest) SetBody(v *HeadRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *HeadRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *HeadRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *HeadRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *HeadRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *HeadRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *HeadRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *HeadRequest_Body
|
|
f = new(HeadRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type HeaderWithSignature struct {
|
|
Header *Header `json:"header"`
|
|
Signature *grpc.Signature `json:"signature"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*HeaderWithSignature)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*HeaderWithSignature)(nil)
|
|
_ json.Marshaler = (*HeaderWithSignature)(nil)
|
|
_ json.Unmarshaler = (*HeaderWithSignature)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *HeaderWithSignature) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Header)
|
|
size += proto.NestedStructureSize(2, x.Signature)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *HeaderWithSignature) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *HeaderWithSignature) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Header != nil && x.Header.StableSize() != 0 {
|
|
x.Header.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Signature != nil && x.Signature.StableSize() != 0 {
|
|
x.Signature.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *HeaderWithSignature) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "HeaderWithSignature")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Header
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Header")
|
|
}
|
|
x.Header = new(Header)
|
|
if err := x.Header.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Signature
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Signature")
|
|
}
|
|
x.Signature = new(grpc.Signature)
|
|
if err := x.Signature.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeaderWithSignature) GetHeader() *Header {
|
|
if x != nil {
|
|
return x.Header
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeaderWithSignature) SetHeader(v *Header) {
|
|
x.Header = v
|
|
}
|
|
func (x *HeaderWithSignature) GetSignature() *grpc.Signature {
|
|
if x != nil {
|
|
return x.Signature
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeaderWithSignature) SetSignature(v *grpc.Signature) {
|
|
x.Signature = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *HeaderWithSignature) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *HeaderWithSignature) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"header\":"
|
|
out.RawString(prefix[1:])
|
|
x.Header.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"signature\":"
|
|
out.RawString(prefix)
|
|
x.Signature.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *HeaderWithSignature) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *HeaderWithSignature) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "header":
|
|
{
|
|
var f *Header
|
|
f = new(Header)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Header = f
|
|
}
|
|
case "signature":
|
|
{
|
|
var f *grpc.Signature
|
|
f = new(grpc.Signature)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Signature = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type HeadResponse_Body struct {
|
|
Head isHeadResponse_Body_Head
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*HeadResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*HeadResponse_Body)(nil)
|
|
_ json.Marshaler = (*HeadResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*HeadResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *HeadResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_Header); ok {
|
|
size += proto.NestedStructureSize(1, inner.Header)
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok {
|
|
size += proto.NestedStructureSize(2, inner.ShortHeader)
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok {
|
|
size += proto.NestedStructureSize(3, inner.SplitInfo)
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_EcInfo); ok {
|
|
size += proto.NestedStructureSize(4, inner.EcInfo)
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *HeadResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *HeadResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_Header); ok {
|
|
if inner.Header != nil && inner.Header.StableSize() != 0 {
|
|
inner.Header.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_ShortHeader); ok {
|
|
if inner.ShortHeader != nil && inner.ShortHeader.StableSize() != 0 {
|
|
inner.ShortHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_SplitInfo); ok {
|
|
if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 {
|
|
inner.SplitInfo.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
if inner, ok := x.Head.(*HeadResponse_Body_EcInfo); ok {
|
|
if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 {
|
|
inner.EcInfo.EmitProtobuf(mm.AppendMessage(4))
|
|
}
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *HeadResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "HeadResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Header
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Header")
|
|
}
|
|
oneofField := &HeadResponse_Body_Header{Header: new(HeaderWithSignature)}
|
|
if err := oneofField.Header.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.Head = oneofField
|
|
case 2: // ShortHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ShortHeader")
|
|
}
|
|
oneofField := &HeadResponse_Body_ShortHeader{ShortHeader: new(ShortHeader)}
|
|
if err := oneofField.ShortHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.Head = oneofField
|
|
case 3: // SplitInfo
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "SplitInfo")
|
|
}
|
|
oneofField := &HeadResponse_Body_SplitInfo{SplitInfo: new(SplitInfo)}
|
|
if err := oneofField.SplitInfo.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.Head = oneofField
|
|
case 4: // EcInfo
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "EcInfo")
|
|
}
|
|
oneofField := &HeadResponse_Body_EcInfo{EcInfo: new(ECInfo)}
|
|
if err := oneofField.EcInfo.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.Head = oneofField
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse_Body) GetHead() isHeadResponse_Body_Head {
|
|
if x != nil {
|
|
return x.Head
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse_Body) SetHead(v isHeadResponse_Body_Head) {
|
|
x.Head = v
|
|
}
|
|
func (x *HeadResponse_Body) GetHeader() *HeaderWithSignature {
|
|
if xx, ok := x.GetHead().(*HeadResponse_Body_Header); ok {
|
|
return xx.Header
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse_Body) SetHeader(v *HeaderWithSignature) {
|
|
x.Head = &HeadResponse_Body_Header{Header: v}
|
|
}
|
|
func (x *HeadResponse_Body) GetShortHeader() *ShortHeader {
|
|
if xx, ok := x.GetHead().(*HeadResponse_Body_ShortHeader); ok {
|
|
return xx.ShortHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse_Body) SetShortHeader(v *ShortHeader) {
|
|
x.Head = &HeadResponse_Body_ShortHeader{ShortHeader: v}
|
|
}
|
|
func (x *HeadResponse_Body) GetSplitInfo() *SplitInfo {
|
|
if xx, ok := x.GetHead().(*HeadResponse_Body_SplitInfo); ok {
|
|
return xx.SplitInfo
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse_Body) SetSplitInfo(v *SplitInfo) {
|
|
x.Head = &HeadResponse_Body_SplitInfo{SplitInfo: v}
|
|
}
|
|
func (x *HeadResponse_Body) GetEcInfo() *ECInfo {
|
|
if xx, ok := x.GetHead().(*HeadResponse_Body_EcInfo); ok {
|
|
return xx.EcInfo
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse_Body) SetEcInfo(v *ECInfo) {
|
|
x.Head = &HeadResponse_Body_EcInfo{EcInfo: v}
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *HeadResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *HeadResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
switch xx := x.Head.(type) {
|
|
case *HeadResponse_Body_Header:
|
|
{
|
|
const prefix string = ",\"header\":"
|
|
out.RawString(prefix[1:])
|
|
xx.Header.MarshalEasyJSON(out)
|
|
}
|
|
case *HeadResponse_Body_ShortHeader:
|
|
{
|
|
const prefix string = ",\"shortHeader\":"
|
|
out.RawString(prefix[1:])
|
|
xx.ShortHeader.MarshalEasyJSON(out)
|
|
}
|
|
case *HeadResponse_Body_SplitInfo:
|
|
{
|
|
const prefix string = ",\"splitInfo\":"
|
|
out.RawString(prefix[1:])
|
|
xx.SplitInfo.MarshalEasyJSON(out)
|
|
}
|
|
case *HeadResponse_Body_EcInfo:
|
|
{
|
|
const prefix string = ",\"ecInfo\":"
|
|
out.RawString(prefix[1:])
|
|
xx.EcInfo.MarshalEasyJSON(out)
|
|
}
|
|
default:
|
|
out.RawString("null")
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *HeadResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *HeadResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "header":
|
|
xx := new(HeadResponse_Body_Header)
|
|
x.Head = xx
|
|
{
|
|
var f *HeaderWithSignature
|
|
f = new(HeaderWithSignature)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.Header = f
|
|
}
|
|
case "shortHeader":
|
|
xx := new(HeadResponse_Body_ShortHeader)
|
|
x.Head = xx
|
|
{
|
|
var f *ShortHeader
|
|
f = new(ShortHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.ShortHeader = f
|
|
}
|
|
case "splitInfo":
|
|
xx := new(HeadResponse_Body_SplitInfo)
|
|
x.Head = xx
|
|
{
|
|
var f *SplitInfo
|
|
f = new(SplitInfo)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.SplitInfo = f
|
|
}
|
|
case "ecInfo":
|
|
xx := new(HeadResponse_Body_EcInfo)
|
|
x.Head = xx
|
|
{
|
|
var f *ECInfo
|
|
f = new(ECInfo)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.EcInfo = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type isHeadResponse_Body_Head interface {
|
|
isHeadResponse_Body_Head()
|
|
}
|
|
|
|
type HeadResponse_Body_Header struct {
|
|
Header *HeaderWithSignature
|
|
}
|
|
|
|
type HeadResponse_Body_ShortHeader struct {
|
|
ShortHeader *ShortHeader
|
|
}
|
|
|
|
type HeadResponse_Body_SplitInfo struct {
|
|
SplitInfo *SplitInfo
|
|
}
|
|
|
|
type HeadResponse_Body_EcInfo struct {
|
|
EcInfo *ECInfo
|
|
}
|
|
|
|
func (*HeadResponse_Body_Header) isHeadResponse_Body_Head() {}
|
|
|
|
func (*HeadResponse_Body_ShortHeader) isHeadResponse_Body_Head() {}
|
|
|
|
func (*HeadResponse_Body_SplitInfo) isHeadResponse_Body_Head() {}
|
|
|
|
func (*HeadResponse_Body_EcInfo) isHeadResponse_Body_Head() {}
|
|
|
|
type HeadResponse struct {
|
|
Body *HeadResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*HeadResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*HeadResponse)(nil)
|
|
_ json.Marshaler = (*HeadResponse)(nil)
|
|
_ json.Unmarshaler = (*HeadResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *HeadResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *HeadResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *HeadResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *HeadResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *HeadResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *HeadResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "HeadResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(HeadResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse) GetBody() *HeadResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse) SetBody(v *HeadResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *HeadResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *HeadResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *HeadResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *HeadResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *HeadResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *HeadResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *HeadResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *HeadResponse_Body
|
|
f = new(HeadResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type SearchRequest_Body_Filter struct {
|
|
MatchType MatchType `json:"matchType"`
|
|
Key string `json:"key"`
|
|
Value string `json:"value"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*SearchRequest_Body_Filter)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*SearchRequest_Body_Filter)(nil)
|
|
_ json.Marshaler = (*SearchRequest_Body_Filter)(nil)
|
|
_ json.Unmarshaler = (*SearchRequest_Body_Filter)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *SearchRequest_Body_Filter) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.EnumSize(1, int32(x.MatchType))
|
|
size += proto.StringSize(2, x.Key)
|
|
size += proto.StringSize(3, x.Value)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *SearchRequest_Body_Filter) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *SearchRequest_Body_Filter) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if int32(x.MatchType) != 0 {
|
|
mm.AppendInt32(1, int32(x.MatchType))
|
|
}
|
|
if len(x.Key) != 0 {
|
|
mm.AppendString(2, x.Key)
|
|
}
|
|
if len(x.Value) != 0 {
|
|
mm.AppendString(3, x.Value)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *SearchRequest_Body_Filter) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "SearchRequest_Body_Filter")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // MatchType
|
|
data, ok := fc.Int32()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MatchType")
|
|
}
|
|
x.MatchType = MatchType(data)
|
|
case 2: // Key
|
|
data, ok := fc.String()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Key")
|
|
}
|
|
x.Key = data
|
|
case 3: // Value
|
|
data, ok := fc.String()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Value")
|
|
}
|
|
x.Value = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest_Body_Filter) GetMatchType() MatchType {
|
|
if x != nil {
|
|
return x.MatchType
|
|
}
|
|
return 0
|
|
}
|
|
func (x *SearchRequest_Body_Filter) SetMatchType(v MatchType) {
|
|
x.MatchType = v
|
|
}
|
|
func (x *SearchRequest_Body_Filter) GetKey() string {
|
|
if x != nil {
|
|
return x.Key
|
|
}
|
|
return ""
|
|
}
|
|
func (x *SearchRequest_Body_Filter) SetKey(v string) {
|
|
x.Key = v
|
|
}
|
|
func (x *SearchRequest_Body_Filter) GetValue() string {
|
|
if x != nil {
|
|
return x.Value
|
|
}
|
|
return ""
|
|
}
|
|
func (x *SearchRequest_Body_Filter) SetValue(v string) {
|
|
x.Value = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *SearchRequest_Body_Filter) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *SearchRequest_Body_Filter) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"matchType\":"
|
|
out.RawString(prefix[1:])
|
|
out.Int32(int32(x.MatchType))
|
|
}
|
|
{
|
|
const prefix string = ",\"key\":"
|
|
out.RawString(prefix)
|
|
out.String(x.Key)
|
|
}
|
|
{
|
|
const prefix string = ",\"value\":"
|
|
out.RawString(prefix)
|
|
out.String(x.Value)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *SearchRequest_Body_Filter) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *SearchRequest_Body_Filter) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "matchType":
|
|
{
|
|
var f MatchType
|
|
var parsedValue MatchType
|
|
switch v := in.Interface().(type) {
|
|
case string:
|
|
if vv, ok := MatchType_value[v]; ok {
|
|
parsedValue = MatchType(vv)
|
|
break
|
|
}
|
|
vv, err := strconv.ParseInt(v, 10, 32)
|
|
if err != nil {
|
|
in.AddError(err)
|
|
return
|
|
}
|
|
parsedValue = MatchType(vv)
|
|
case float64:
|
|
parsedValue = MatchType(v)
|
|
}
|
|
f = parsedValue
|
|
x.MatchType = f
|
|
}
|
|
case "key":
|
|
{
|
|
var f string
|
|
f = in.String()
|
|
x.Key = f
|
|
}
|
|
case "value":
|
|
{
|
|
var f string
|
|
f = in.String()
|
|
x.Value = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type SearchRequest_Body struct {
|
|
ContainerId *grpc.ContainerID `json:"containerId"`
|
|
Version uint32 `json:"version"`
|
|
Filters []*SearchRequest_Body_Filter `json:"filters"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*SearchRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*SearchRequest_Body)(nil)
|
|
_ json.Marshaler = (*SearchRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*SearchRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *SearchRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.ContainerId)
|
|
size += proto.UInt32Size(2, x.Version)
|
|
for i := range x.Filters {
|
|
size += proto.NestedStructureSize(3, x.Filters[i])
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *SearchRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *SearchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.ContainerId != nil && x.ContainerId.StableSize() != 0 {
|
|
x.ContainerId.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Version != 0 {
|
|
mm.AppendUint32(2, x.Version)
|
|
}
|
|
for i := range x.Filters {
|
|
if x.Filters[i] != nil && x.Filters[i].StableSize() != 0 {
|
|
x.Filters[i].EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *SearchRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "SearchRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // ContainerId
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ContainerId")
|
|
}
|
|
x.ContainerId = new(grpc.ContainerID)
|
|
if err := x.ContainerId.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Version
|
|
data, ok := fc.Uint32()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Version")
|
|
}
|
|
x.Version = data
|
|
case 3: // Filters
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Filters")
|
|
}
|
|
x.Filters = append(x.Filters, new(SearchRequest_Body_Filter))
|
|
ff := x.Filters[len(x.Filters)-1]
|
|
if err := ff.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest_Body) GetContainerId() *grpc.ContainerID {
|
|
if x != nil {
|
|
return x.ContainerId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest_Body) SetContainerId(v *grpc.ContainerID) {
|
|
x.ContainerId = v
|
|
}
|
|
func (x *SearchRequest_Body) GetVersion() uint32 {
|
|
if x != nil {
|
|
return x.Version
|
|
}
|
|
return 0
|
|
}
|
|
func (x *SearchRequest_Body) SetVersion(v uint32) {
|
|
x.Version = v
|
|
}
|
|
func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter {
|
|
if x != nil {
|
|
return x.Filters
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest_Body) SetFilters(v []*SearchRequest_Body_Filter) {
|
|
x.Filters = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *SearchRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *SearchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"containerId\":"
|
|
out.RawString(prefix[1:])
|
|
x.ContainerId.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"version\":"
|
|
out.RawString(prefix)
|
|
out.Uint32(x.Version)
|
|
}
|
|
{
|
|
const prefix string = ",\"filters\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.Filters {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
x.Filters[i].MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *SearchRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *SearchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "containerId":
|
|
{
|
|
var f *grpc.ContainerID
|
|
f = new(grpc.ContainerID)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.ContainerId = f
|
|
}
|
|
case "version":
|
|
{
|
|
var f uint32
|
|
f = in.Uint32()
|
|
x.Version = f
|
|
}
|
|
case "filters":
|
|
{
|
|
var f *SearchRequest_Body_Filter
|
|
var list []*SearchRequest_Body_Filter
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = new(SearchRequest_Body_Filter)
|
|
f.UnmarshalEasyJSON(in)
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.Filters = list
|
|
in.Delim(']')
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type SearchRequest struct {
|
|
Body *SearchRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*SearchRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*SearchRequest)(nil)
|
|
_ json.Marshaler = (*SearchRequest)(nil)
|
|
_ json.Unmarshaler = (*SearchRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *SearchRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *SearchRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *SearchRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *SearchRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *SearchRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *SearchRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "SearchRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(SearchRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest) GetBody() *SearchRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest) SetBody(v *SearchRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *SearchRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *SearchRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *SearchRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *SearchRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *SearchRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *SearchRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *SearchRequest_Body
|
|
f = new(SearchRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type SearchResponse_Body struct {
|
|
IdList []*grpc.ObjectID `json:"idList"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*SearchResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*SearchResponse_Body)(nil)
|
|
_ json.Marshaler = (*SearchResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*SearchResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *SearchResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
for i := range x.IdList {
|
|
size += proto.NestedStructureSize(1, x.IdList[i])
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *SearchResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *SearchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
for i := range x.IdList {
|
|
if x.IdList[i] != nil && x.IdList[i].StableSize() != 0 {
|
|
x.IdList[i].EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *SearchResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "SearchResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // IdList
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "IdList")
|
|
}
|
|
x.IdList = append(x.IdList, new(grpc.ObjectID))
|
|
ff := x.IdList[len(x.IdList)-1]
|
|
if err := ff.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchResponse_Body) GetIdList() []*grpc.ObjectID {
|
|
if x != nil {
|
|
return x.IdList
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchResponse_Body) SetIdList(v []*grpc.ObjectID) {
|
|
x.IdList = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *SearchResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *SearchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"idList\":"
|
|
out.RawString(prefix[1:])
|
|
out.RawByte('[')
|
|
for i := range x.IdList {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
x.IdList[i].MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *SearchResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *SearchResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "idList":
|
|
{
|
|
var f *grpc.ObjectID
|
|
var list []*grpc.ObjectID
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = new(grpc.ObjectID)
|
|
f.UnmarshalEasyJSON(in)
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.IdList = list
|
|
in.Delim(']')
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type SearchResponse struct {
|
|
Body *SearchResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*SearchResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*SearchResponse)(nil)
|
|
_ json.Marshaler = (*SearchResponse)(nil)
|
|
_ json.Unmarshaler = (*SearchResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *SearchResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *SearchResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *SearchResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *SearchResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *SearchResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *SearchResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "SearchResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(SearchResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchResponse) GetBody() *SearchResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchResponse) SetBody(v *SearchResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *SearchResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *SearchResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *SearchResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *SearchResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *SearchResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *SearchResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *SearchResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *SearchResponse_Body
|
|
f = new(SearchResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type Range struct {
|
|
Offset uint64 `json:"offset"`
|
|
Length uint64 `json:"length"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*Range)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*Range)(nil)
|
|
_ json.Marshaler = (*Range)(nil)
|
|
_ json.Unmarshaler = (*Range)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *Range) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.UInt64Size(1, x.Offset)
|
|
size += proto.UInt64Size(2, x.Length)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *Range) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *Range) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Offset != 0 {
|
|
mm.AppendUint64(1, x.Offset)
|
|
}
|
|
if x.Length != 0 {
|
|
mm.AppendUint64(2, x.Length)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *Range) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "Range")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Offset
|
|
data, ok := fc.Uint64()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Offset")
|
|
}
|
|
x.Offset = data
|
|
case 2: // Length
|
|
data, ok := fc.Uint64()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Length")
|
|
}
|
|
x.Length = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *Range) GetOffset() uint64 {
|
|
if x != nil {
|
|
return x.Offset
|
|
}
|
|
return 0
|
|
}
|
|
func (x *Range) SetOffset(v uint64) {
|
|
x.Offset = v
|
|
}
|
|
func (x *Range) GetLength() uint64 {
|
|
if x != nil {
|
|
return x.Length
|
|
}
|
|
return 0
|
|
}
|
|
func (x *Range) SetLength(v uint64) {
|
|
x.Length = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *Range) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *Range) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"offset\":"
|
|
out.RawString(prefix[1:])
|
|
out.Uint64(x.Offset)
|
|
}
|
|
{
|
|
const prefix string = ",\"length\":"
|
|
out.RawString(prefix)
|
|
out.Uint64(x.Length)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *Range) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *Range) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "offset":
|
|
{
|
|
var f uint64
|
|
f = in.Uint64()
|
|
x.Offset = f
|
|
}
|
|
case "length":
|
|
{
|
|
var f uint64
|
|
f = in.Uint64()
|
|
x.Length = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeRequest_Body struct {
|
|
Address *grpc.Address `json:"address"`
|
|
Range *Range `json:"range"`
|
|
Raw bool `json:"raw"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeRequest_Body)(nil)
|
|
_ json.Marshaler = (*GetRangeRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*GetRangeRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Address)
|
|
size += proto.NestedStructureSize(2, x.Range)
|
|
size += proto.BoolSize(3, x.Raw)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Address != nil && x.Address.StableSize() != 0 {
|
|
x.Address.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.Range != nil && x.Range.StableSize() != 0 {
|
|
x.Range.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.Raw {
|
|
mm.AppendBool(3, x.Raw)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Address
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Address")
|
|
}
|
|
x.Address = new(grpc.Address)
|
|
if err := x.Address.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Range
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Range")
|
|
}
|
|
x.Range = new(Range)
|
|
if err := x.Range.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // Raw
|
|
data, ok := fc.Bool()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Raw")
|
|
}
|
|
x.Raw = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest_Body) GetAddress() *grpc.Address {
|
|
if x != nil {
|
|
return x.Address
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest_Body) SetAddress(v *grpc.Address) {
|
|
x.Address = v
|
|
}
|
|
func (x *GetRangeRequest_Body) GetRange() *Range {
|
|
if x != nil {
|
|
return x.Range
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest_Body) SetRange(v *Range) {
|
|
x.Range = v
|
|
}
|
|
func (x *GetRangeRequest_Body) GetRaw() bool {
|
|
if x != nil {
|
|
return x.Raw
|
|
}
|
|
return false
|
|
}
|
|
func (x *GetRangeRequest_Body) SetRaw(v bool) {
|
|
x.Raw = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix[1:])
|
|
x.Address.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"range\":"
|
|
out.RawString(prefix)
|
|
x.Range.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"raw\":"
|
|
out.RawString(prefix)
|
|
out.Bool(x.Raw)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "address":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Address = f
|
|
}
|
|
case "range":
|
|
{
|
|
var f *Range
|
|
f = new(Range)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Range = f
|
|
}
|
|
case "raw":
|
|
{
|
|
var f bool
|
|
f = in.Bool()
|
|
x.Raw = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeRequest struct {
|
|
Body *GetRangeRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeRequest)(nil)
|
|
_ json.Marshaler = (*GetRangeRequest)(nil)
|
|
_ json.Unmarshaler = (*GetRangeRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *GetRangeRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *GetRangeRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(GetRangeRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest) GetBody() *GetRangeRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest) SetBody(v *GetRangeRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *GetRangeRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *GetRangeRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *GetRangeRequest_Body
|
|
f = new(GetRangeRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeResponse_Body struct {
|
|
RangePart isGetRangeResponse_Body_RangePart
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeResponse_Body)(nil)
|
|
_ json.Marshaler = (*GetRangeResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*GetRangeResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
if inner, ok := x.RangePart.(*GetRangeResponse_Body_Chunk); ok {
|
|
size += proto.BytesSize(1, inner.Chunk)
|
|
}
|
|
if inner, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok {
|
|
size += proto.NestedStructureSize(2, inner.SplitInfo)
|
|
}
|
|
if inner, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok {
|
|
size += proto.NestedStructureSize(3, inner.EcInfo)
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if inner, ok := x.RangePart.(*GetRangeResponse_Body_Chunk); ok {
|
|
if len(inner.Chunk) != 0 {
|
|
mm.AppendBytes(1, inner.Chunk)
|
|
}
|
|
}
|
|
if inner, ok := x.RangePart.(*GetRangeResponse_Body_SplitInfo); ok {
|
|
if inner.SplitInfo != nil && inner.SplitInfo.StableSize() != 0 {
|
|
inner.SplitInfo.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
}
|
|
if inner, ok := x.RangePart.(*GetRangeResponse_Body_EcInfo); ok {
|
|
if inner.EcInfo != nil && inner.EcInfo.StableSize() != 0 {
|
|
inner.EcInfo.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Chunk
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Chunk")
|
|
}
|
|
x.RangePart = &GetRangeResponse_Body_Chunk{Chunk: data}
|
|
case 2: // SplitInfo
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "SplitInfo")
|
|
}
|
|
oneofField := &GetRangeResponse_Body_SplitInfo{SplitInfo: new(SplitInfo)}
|
|
if err := oneofField.SplitInfo.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.RangePart = oneofField
|
|
case 3: // EcInfo
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "EcInfo")
|
|
}
|
|
oneofField := &GetRangeResponse_Body_EcInfo{EcInfo: new(ECInfo)}
|
|
if err := oneofField.EcInfo.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
x.RangePart = oneofField
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse_Body) GetRangePart() isGetRangeResponse_Body_RangePart {
|
|
if x != nil {
|
|
return x.RangePart
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse_Body) SetRangePart(v isGetRangeResponse_Body_RangePart) {
|
|
x.RangePart = v
|
|
}
|
|
func (x *GetRangeResponse_Body) GetChunk() *GetRangeResponse_Body_Chunk {
|
|
if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_Chunk); ok {
|
|
return xx
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse_Body) SetChunk(v *GetRangeResponse_Body_Chunk) {
|
|
x.RangePart = v
|
|
}
|
|
func (x *GetRangeResponse_Body_Chunk) GetChunk() []byte {
|
|
if x != nil {
|
|
return x.Chunk
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse_Body_Chunk) SetChunk(v []byte) {
|
|
x.Chunk = v
|
|
}
|
|
func (x *GetRangeResponse_Body) GetSplitInfo() *SplitInfo {
|
|
if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_SplitInfo); ok {
|
|
return xx.SplitInfo
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) {
|
|
x.RangePart = &GetRangeResponse_Body_SplitInfo{SplitInfo: v}
|
|
}
|
|
func (x *GetRangeResponse_Body) GetEcInfo() *ECInfo {
|
|
if xx, ok := x.GetRangePart().(*GetRangeResponse_Body_EcInfo); ok {
|
|
return xx.EcInfo
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse_Body) SetEcInfo(v *ECInfo) {
|
|
x.RangePart = &GetRangeResponse_Body_EcInfo{EcInfo: v}
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
switch xx := x.RangePart.(type) {
|
|
case *GetRangeResponse_Body_Chunk:
|
|
{
|
|
const prefix string = ",\"chunk\":"
|
|
out.RawString(prefix[1:])
|
|
out.Base64Bytes(xx.Chunk)
|
|
}
|
|
case *GetRangeResponse_Body_SplitInfo:
|
|
{
|
|
const prefix string = ",\"splitInfo\":"
|
|
out.RawString(prefix[1:])
|
|
xx.SplitInfo.MarshalEasyJSON(out)
|
|
}
|
|
case *GetRangeResponse_Body_EcInfo:
|
|
{
|
|
const prefix string = ",\"ecInfo\":"
|
|
out.RawString(prefix[1:])
|
|
xx.EcInfo.MarshalEasyJSON(out)
|
|
}
|
|
default:
|
|
out.RawString("null")
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "chunk":
|
|
xx := new(GetRangeResponse_Body_Chunk)
|
|
x.RangePart = xx
|
|
{
|
|
var f []byte
|
|
f = in.Bytes()
|
|
xx.Chunk = f
|
|
}
|
|
case "splitInfo":
|
|
xx := new(GetRangeResponse_Body_SplitInfo)
|
|
x.RangePart = xx
|
|
{
|
|
var f *SplitInfo
|
|
f = new(SplitInfo)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.SplitInfo = f
|
|
}
|
|
case "ecInfo":
|
|
xx := new(GetRangeResponse_Body_EcInfo)
|
|
x.RangePart = xx
|
|
{
|
|
var f *ECInfo
|
|
f = new(ECInfo)
|
|
f.UnmarshalEasyJSON(in)
|
|
xx.EcInfo = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type isGetRangeResponse_Body_RangePart interface {
|
|
isGetRangeResponse_Body_RangePart()
|
|
}
|
|
|
|
type GetRangeResponse_Body_Chunk struct {
|
|
Chunk []byte
|
|
}
|
|
|
|
type GetRangeResponse_Body_SplitInfo struct {
|
|
SplitInfo *SplitInfo
|
|
}
|
|
|
|
type GetRangeResponse_Body_EcInfo struct {
|
|
EcInfo *ECInfo
|
|
}
|
|
|
|
func (*GetRangeResponse_Body_Chunk) isGetRangeResponse_Body_RangePart() {}
|
|
|
|
func (*GetRangeResponse_Body_SplitInfo) isGetRangeResponse_Body_RangePart() {}
|
|
|
|
func (*GetRangeResponse_Body_EcInfo) isGetRangeResponse_Body_RangePart() {}
|
|
|
|
type GetRangeResponse struct {
|
|
Body *GetRangeResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeResponse)(nil)
|
|
_ json.Marshaler = (*GetRangeResponse)(nil)
|
|
_ json.Unmarshaler = (*GetRangeResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *GetRangeResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *GetRangeResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(GetRangeResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse) GetBody() *GetRangeResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse) SetBody(v *GetRangeResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *GetRangeResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *GetRangeResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *GetRangeResponse_Body
|
|
f = new(GetRangeResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeHashRequest_Body struct {
|
|
Address *grpc.Address `json:"address"`
|
|
Ranges []*Range `json:"ranges"`
|
|
Salt []byte `json:"salt"`
|
|
Type grpc.ChecksumType `json:"type"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeHashRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeHashRequest_Body)(nil)
|
|
_ json.Marshaler = (*GetRangeHashRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*GetRangeHashRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeHashRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Address)
|
|
for i := range x.Ranges {
|
|
size += proto.NestedStructureSize(2, x.Ranges[i])
|
|
}
|
|
size += proto.BytesSize(3, x.Salt)
|
|
size += proto.EnumSize(4, int32(x.Type))
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeHashRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeHashRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Address != nil && x.Address.StableSize() != 0 {
|
|
x.Address.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
for i := range x.Ranges {
|
|
if x.Ranges[i] != nil && x.Ranges[i].StableSize() != 0 {
|
|
x.Ranges[i].EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
}
|
|
if len(x.Salt) != 0 {
|
|
mm.AppendBytes(3, x.Salt)
|
|
}
|
|
if int32(x.Type) != 0 {
|
|
mm.AppendInt32(4, int32(x.Type))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeHashRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeHashRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Address
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Address")
|
|
}
|
|
x.Address = new(grpc.Address)
|
|
if err := x.Address.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Ranges
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Ranges")
|
|
}
|
|
x.Ranges = append(x.Ranges, new(Range))
|
|
ff := x.Ranges[len(x.Ranges)-1]
|
|
if err := ff.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // Salt
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Salt")
|
|
}
|
|
x.Salt = data
|
|
case 4: // Type
|
|
data, ok := fc.Int32()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Type")
|
|
}
|
|
x.Type = grpc.ChecksumType(data)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest_Body) GetAddress() *grpc.Address {
|
|
if x != nil {
|
|
return x.Address
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest_Body) SetAddress(v *grpc.Address) {
|
|
x.Address = v
|
|
}
|
|
func (x *GetRangeHashRequest_Body) GetRanges() []*Range {
|
|
if x != nil {
|
|
return x.Ranges
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest_Body) SetRanges(v []*Range) {
|
|
x.Ranges = v
|
|
}
|
|
func (x *GetRangeHashRequest_Body) GetSalt() []byte {
|
|
if x != nil {
|
|
return x.Salt
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest_Body) SetSalt(v []byte) {
|
|
x.Salt = v
|
|
}
|
|
func (x *GetRangeHashRequest_Body) GetType() grpc.ChecksumType {
|
|
if x != nil {
|
|
return x.Type
|
|
}
|
|
return 0
|
|
}
|
|
func (x *GetRangeHashRequest_Body) SetType(v grpc.ChecksumType) {
|
|
x.Type = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeHashRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeHashRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix[1:])
|
|
x.Address.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"ranges\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.Ranges {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
x.Ranges[i].MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
{
|
|
const prefix string = ",\"salt\":"
|
|
out.RawString(prefix)
|
|
out.Base64Bytes(x.Salt)
|
|
}
|
|
{
|
|
const prefix string = ",\"type\":"
|
|
out.RawString(prefix)
|
|
out.Int32(int32(x.Type))
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeHashRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeHashRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "address":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Address = f
|
|
}
|
|
case "ranges":
|
|
{
|
|
var f *Range
|
|
var list []*Range
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = new(Range)
|
|
f.UnmarshalEasyJSON(in)
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.Ranges = list
|
|
in.Delim(']')
|
|
}
|
|
case "salt":
|
|
{
|
|
var f []byte
|
|
f = in.Bytes()
|
|
x.Salt = f
|
|
}
|
|
case "type":
|
|
{
|
|
var f grpc.ChecksumType
|
|
var parsedValue grpc.ChecksumType
|
|
switch v := in.Interface().(type) {
|
|
case string:
|
|
if vv, ok := grpc.ChecksumType_value[v]; ok {
|
|
parsedValue = grpc.ChecksumType(vv)
|
|
break
|
|
}
|
|
vv, err := strconv.ParseInt(v, 10, 32)
|
|
if err != nil {
|
|
in.AddError(err)
|
|
return
|
|
}
|
|
parsedValue = grpc.ChecksumType(vv)
|
|
case float64:
|
|
parsedValue = grpc.ChecksumType(v)
|
|
}
|
|
f = parsedValue
|
|
x.Type = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeHashRequest struct {
|
|
Body *GetRangeHashRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeHashRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeHashRequest)(nil)
|
|
_ json.Marshaler = (*GetRangeHashRequest)(nil)
|
|
_ json.Unmarshaler = (*GetRangeHashRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeHashRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *GetRangeHashRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *GetRangeHashRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeHashRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeHashRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeHashRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeHashRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(GetRangeHashRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest) GetBody() *GetRangeHashRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *GetRangeHashRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *GetRangeHashRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeHashRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeHashRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeHashRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeHashRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *GetRangeHashRequest_Body
|
|
f = new(GetRangeHashRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeHashResponse_Body struct {
|
|
Type grpc.ChecksumType `json:"type"`
|
|
HashList [][]byte `json:"hashList"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeHashResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeHashResponse_Body)(nil)
|
|
_ json.Marshaler = (*GetRangeHashResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*GetRangeHashResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeHashResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.EnumSize(1, int32(x.Type))
|
|
size += proto.RepeatedBytesSize(2, x.HashList)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeHashResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeHashResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if int32(x.Type) != 0 {
|
|
mm.AppendInt32(1, int32(x.Type))
|
|
}
|
|
for j := range x.HashList {
|
|
mm.AppendBytes(2, x.HashList[j])
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeHashResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeHashResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Type
|
|
data, ok := fc.Int32()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Type")
|
|
}
|
|
x.Type = grpc.ChecksumType(data)
|
|
case 2: // HashList
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "HashList")
|
|
}
|
|
x.HashList = append(x.HashList, data)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashResponse_Body) GetType() grpc.ChecksumType {
|
|
if x != nil {
|
|
return x.Type
|
|
}
|
|
return 0
|
|
}
|
|
func (x *GetRangeHashResponse_Body) SetType(v grpc.ChecksumType) {
|
|
x.Type = v
|
|
}
|
|
func (x *GetRangeHashResponse_Body) GetHashList() [][]byte {
|
|
if x != nil {
|
|
return x.HashList
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashResponse_Body) SetHashList(v [][]byte) {
|
|
x.HashList = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeHashResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeHashResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"type\":"
|
|
out.RawString(prefix[1:])
|
|
out.Int32(int32(x.Type))
|
|
}
|
|
{
|
|
const prefix string = ",\"hashList\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.HashList {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.Base64Bytes(x.HashList[i])
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeHashResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeHashResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "type":
|
|
{
|
|
var f grpc.ChecksumType
|
|
var parsedValue grpc.ChecksumType
|
|
switch v := in.Interface().(type) {
|
|
case string:
|
|
if vv, ok := grpc.ChecksumType_value[v]; ok {
|
|
parsedValue = grpc.ChecksumType(vv)
|
|
break
|
|
}
|
|
vv, err := strconv.ParseInt(v, 10, 32)
|
|
if err != nil {
|
|
in.AddError(err)
|
|
return
|
|
}
|
|
parsedValue = grpc.ChecksumType(vv)
|
|
case float64:
|
|
parsedValue = grpc.ChecksumType(v)
|
|
}
|
|
f = parsedValue
|
|
x.Type = f
|
|
}
|
|
case "hashList":
|
|
{
|
|
var f []byte
|
|
var list [][]byte
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = in.Bytes()
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.HashList = list
|
|
in.Delim(']')
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type GetRangeHashResponse struct {
|
|
Body *GetRangeHashResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*GetRangeHashResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*GetRangeHashResponse)(nil)
|
|
_ json.Marshaler = (*GetRangeHashResponse)(nil)
|
|
_ json.Unmarshaler = (*GetRangeHashResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *GetRangeHashResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *GetRangeHashResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *GetRangeHashResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *GetRangeHashResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *GetRangeHashResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *GetRangeHashResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "GetRangeHashResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(GetRangeHashResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashResponse) GetBody() *GetRangeHashResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashResponse) SetBody(v *GetRangeHashResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *GetRangeHashResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *GetRangeHashResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *GetRangeHashResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *GetRangeHashResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *GetRangeHashResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *GetRangeHashResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *GetRangeHashResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *GetRangeHashResponse_Body
|
|
f = new(GetRangeHashResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutSingleRequest_Body struct {
|
|
Object *Object `json:"object"`
|
|
CopiesNumber []uint32 `json:"copiesNumber"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutSingleRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutSingleRequest_Body)(nil)
|
|
_ json.Marshaler = (*PutSingleRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*PutSingleRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutSingleRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
var n int
|
|
size += proto.NestedStructureSize(1, x.Object)
|
|
n, _ = proto.RepeatedUInt32Size(2, x.CopiesNumber)
|
|
size += n
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutSingleRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutSingleRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Object != nil && x.Object.StableSize() != 0 {
|
|
x.Object.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if len(x.CopiesNumber) != 0 {
|
|
mm.AppendUint32s(2, x.CopiesNumber)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutSingleRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutSingleRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Object
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Object")
|
|
}
|
|
x.Object = new(Object)
|
|
if err := x.Object.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // CopiesNumber
|
|
data, ok := fc.UnpackUint32s(nil)
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "CopiesNumber")
|
|
}
|
|
x.CopiesNumber = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest_Body) GetObject() *Object {
|
|
if x != nil {
|
|
return x.Object
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest_Body) SetObject(v *Object) {
|
|
x.Object = v
|
|
}
|
|
func (x *PutSingleRequest_Body) GetCopiesNumber() []uint32 {
|
|
if x != nil {
|
|
return x.CopiesNumber
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest_Body) SetCopiesNumber(v []uint32) {
|
|
x.CopiesNumber = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutSingleRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutSingleRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"object\":"
|
|
out.RawString(prefix[1:])
|
|
x.Object.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"copiesNumber\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.CopiesNumber {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.Uint32(x.CopiesNumber[i])
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutSingleRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutSingleRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "object":
|
|
{
|
|
var f *Object
|
|
f = new(Object)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Object = f
|
|
}
|
|
case "copiesNumber":
|
|
{
|
|
var f uint32
|
|
var list []uint32
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = in.Uint32()
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.CopiesNumber = list
|
|
in.Delim(']')
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutSingleRequest struct {
|
|
Body *PutSingleRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutSingleRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutSingleRequest)(nil)
|
|
_ json.Marshaler = (*PutSingleRequest)(nil)
|
|
_ json.Unmarshaler = (*PutSingleRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutSingleRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *PutSingleRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *PutSingleRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutSingleRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutSingleRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutSingleRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutSingleRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(PutSingleRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest) GetBody() *PutSingleRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest) SetBody(v *PutSingleRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *PutSingleRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *PutSingleRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutSingleRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutSingleRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutSingleRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutSingleRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *PutSingleRequest_Body
|
|
f = new(PutSingleRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutSingleResponse_Body struct {
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutSingleResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutSingleResponse_Body)(nil)
|
|
_ json.Marshaler = (*PutSingleResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*PutSingleResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutSingleResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutSingleResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutSingleResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutSingleResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutSingleResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutSingleResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutSingleResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutSingleResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutSingleResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PutSingleResponse struct {
|
|
Body *PutSingleResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PutSingleResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PutSingleResponse)(nil)
|
|
_ json.Marshaler = (*PutSingleResponse)(nil)
|
|
_ json.Unmarshaler = (*PutSingleResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PutSingleResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *PutSingleResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *PutSingleResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PutSingleResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PutSingleResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PutSingleResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PutSingleResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(PutSingleResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleResponse) GetBody() *PutSingleResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleResponse) SetBody(v *PutSingleResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *PutSingleResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *PutSingleResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PutSingleResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PutSingleResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PutSingleResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PutSingleResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PutSingleResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *PutSingleResponse_Body
|
|
f = new(PutSingleResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PatchRequest_Body_Patch struct {
|
|
SourceRange *Range `json:"sourceRange"`
|
|
Chunk []byte `json:"chunk"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PatchRequest_Body_Patch)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PatchRequest_Body_Patch)(nil)
|
|
_ json.Marshaler = (*PatchRequest_Body_Patch)(nil)
|
|
_ json.Unmarshaler = (*PatchRequest_Body_Patch)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PatchRequest_Body_Patch) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.SourceRange)
|
|
size += proto.BytesSize(2, x.Chunk)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PatchRequest_Body_Patch) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PatchRequest_Body_Patch) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.SourceRange != nil && x.SourceRange.StableSize() != 0 {
|
|
x.SourceRange.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if len(x.Chunk) != 0 {
|
|
mm.AppendBytes(2, x.Chunk)
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PatchRequest_Body_Patch) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PatchRequest_Body_Patch")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // SourceRange
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "SourceRange")
|
|
}
|
|
x.SourceRange = new(Range)
|
|
if err := x.SourceRange.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // Chunk
|
|
data, ok := fc.Bytes()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Chunk")
|
|
}
|
|
x.Chunk = data
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body_Patch) GetSourceRange() *Range {
|
|
if x != nil {
|
|
return x.SourceRange
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body_Patch) SetSourceRange(v *Range) {
|
|
x.SourceRange = v
|
|
}
|
|
func (x *PatchRequest_Body_Patch) GetChunk() []byte {
|
|
if x != nil {
|
|
return x.Chunk
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body_Patch) SetChunk(v []byte) {
|
|
x.Chunk = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PatchRequest_Body_Patch) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PatchRequest_Body_Patch) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"sourceRange\":"
|
|
out.RawString(prefix[1:])
|
|
x.SourceRange.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"chunk\":"
|
|
out.RawString(prefix)
|
|
out.Base64Bytes(x.Chunk)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PatchRequest_Body_Patch) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PatchRequest_Body_Patch) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "sourceRange":
|
|
{
|
|
var f *Range
|
|
f = new(Range)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.SourceRange = f
|
|
}
|
|
case "chunk":
|
|
{
|
|
var f []byte
|
|
f = in.Bytes()
|
|
x.Chunk = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PatchRequest_Body struct {
|
|
Address *grpc.Address `json:"address"`
|
|
NewAttributes []*Header_Attribute `json:"newAttributes"`
|
|
ReplaceAttributes bool `json:"replaceAttributes"`
|
|
Patch *PatchRequest_Body_Patch `json:"patch"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PatchRequest_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PatchRequest_Body)(nil)
|
|
_ json.Marshaler = (*PatchRequest_Body)(nil)
|
|
_ json.Unmarshaler = (*PatchRequest_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PatchRequest_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Address)
|
|
for i := range x.NewAttributes {
|
|
size += proto.NestedStructureSize(2, x.NewAttributes[i])
|
|
}
|
|
size += proto.BoolSize(3, x.ReplaceAttributes)
|
|
size += proto.NestedStructureSize(4, x.Patch)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PatchRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PatchRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Address != nil && x.Address.StableSize() != 0 {
|
|
x.Address.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
for i := range x.NewAttributes {
|
|
if x.NewAttributes[i] != nil && x.NewAttributes[i].StableSize() != 0 {
|
|
x.NewAttributes[i].EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
}
|
|
if x.ReplaceAttributes {
|
|
mm.AppendBool(3, x.ReplaceAttributes)
|
|
}
|
|
if x.Patch != nil && x.Patch.StableSize() != 0 {
|
|
x.Patch.EmitProtobuf(mm.AppendMessage(4))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PatchRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PatchRequest_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Address
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Address")
|
|
}
|
|
x.Address = new(grpc.Address)
|
|
if err := x.Address.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // NewAttributes
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "NewAttributes")
|
|
}
|
|
x.NewAttributes = append(x.NewAttributes, new(Header_Attribute))
|
|
ff := x.NewAttributes[len(x.NewAttributes)-1]
|
|
if err := ff.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // ReplaceAttributes
|
|
data, ok := fc.Bool()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ReplaceAttributes")
|
|
}
|
|
x.ReplaceAttributes = data
|
|
case 4: // Patch
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Patch")
|
|
}
|
|
x.Patch = new(PatchRequest_Body_Patch)
|
|
if err := x.Patch.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body) GetAddress() *grpc.Address {
|
|
if x != nil {
|
|
return x.Address
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body) SetAddress(v *grpc.Address) {
|
|
x.Address = v
|
|
}
|
|
func (x *PatchRequest_Body) GetNewAttributes() []*Header_Attribute {
|
|
if x != nil {
|
|
return x.NewAttributes
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body) SetNewAttributes(v []*Header_Attribute) {
|
|
x.NewAttributes = v
|
|
}
|
|
func (x *PatchRequest_Body) GetReplaceAttributes() bool {
|
|
if x != nil {
|
|
return x.ReplaceAttributes
|
|
}
|
|
return false
|
|
}
|
|
func (x *PatchRequest_Body) SetReplaceAttributes(v bool) {
|
|
x.ReplaceAttributes = v
|
|
}
|
|
func (x *PatchRequest_Body) GetPatch() *PatchRequest_Body_Patch {
|
|
if x != nil {
|
|
return x.Patch
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest_Body) SetPatch(v *PatchRequest_Body_Patch) {
|
|
x.Patch = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PatchRequest_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PatchRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix[1:])
|
|
x.Address.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"newAttributes\":"
|
|
out.RawString(prefix)
|
|
out.RawByte('[')
|
|
for i := range x.NewAttributes {
|
|
if i != 0 {
|
|
out.RawByte(',')
|
|
}
|
|
x.NewAttributes[i].MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
{
|
|
const prefix string = ",\"replaceAttributes\":"
|
|
out.RawString(prefix)
|
|
out.Bool(x.ReplaceAttributes)
|
|
}
|
|
{
|
|
const prefix string = ",\"patch\":"
|
|
out.RawString(prefix)
|
|
x.Patch.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PatchRequest_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PatchRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "address":
|
|
{
|
|
var f *grpc.Address
|
|
f = new(grpc.Address)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Address = f
|
|
}
|
|
case "newAttributes":
|
|
{
|
|
var f *Header_Attribute
|
|
var list []*Header_Attribute
|
|
in.Delim('[')
|
|
for !in.IsDelim(']') {
|
|
f = new(Header_Attribute)
|
|
f.UnmarshalEasyJSON(in)
|
|
list = append(list, f)
|
|
in.WantComma()
|
|
}
|
|
x.NewAttributes = list
|
|
in.Delim(']')
|
|
}
|
|
case "replaceAttributes":
|
|
{
|
|
var f bool
|
|
f = in.Bool()
|
|
x.ReplaceAttributes = f
|
|
}
|
|
case "patch":
|
|
{
|
|
var f *PatchRequest_Body_Patch
|
|
f = new(PatchRequest_Body_Patch)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Patch = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PatchRequest struct {
|
|
Body *PatchRequest_Body `json:"body"`
|
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PatchRequest)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PatchRequest)(nil)
|
|
_ json.Marshaler = (*PatchRequest)(nil)
|
|
_ json.Unmarshaler = (*PatchRequest)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PatchRequest) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *PatchRequest) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *PatchRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PatchRequest) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PatchRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PatchRequest) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PatchRequest")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(PatchRequest_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest) GetBody() *PatchRequest_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest) SetBody(v *PatchRequest_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *PatchRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *PatchRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PatchRequest) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PatchRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PatchRequest) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PatchRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *PatchRequest_Body
|
|
f = new(PatchRequest_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.RequestMetaHeader
|
|
f = new(grpc1.RequestMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.RequestVerificationHeader
|
|
f = new(grpc1.RequestVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PatchResponse_Body struct {
|
|
ObjectId *grpc.ObjectID `json:"objectId"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PatchResponse_Body)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PatchResponse_Body)(nil)
|
|
_ json.Marshaler = (*PatchResponse_Body)(nil)
|
|
_ json.Unmarshaler = (*PatchResponse_Body)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PatchResponse_Body) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.ObjectId)
|
|
return size
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PatchResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PatchResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.ObjectId != nil && x.ObjectId.StableSize() != 0 {
|
|
x.ObjectId.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PatchResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PatchResponse_Body")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // ObjectId
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "ObjectId")
|
|
}
|
|
x.ObjectId = new(grpc.ObjectID)
|
|
if err := x.ObjectId.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchResponse_Body) GetObjectId() *grpc.ObjectID {
|
|
if x != nil {
|
|
return x.ObjectId
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchResponse_Body) SetObjectId(v *grpc.ObjectID) {
|
|
x.ObjectId = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PatchResponse_Body) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PatchResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"objectId\":"
|
|
out.RawString(prefix[1:])
|
|
x.ObjectId.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PatchResponse_Body) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PatchResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "objectId":
|
|
{
|
|
var f *grpc.ObjectID
|
|
f = new(grpc.ObjectID)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.ObjectId = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
|
|
type PatchResponse struct {
|
|
Body *PatchResponse_Body `json:"body"`
|
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
|
}
|
|
|
|
var (
|
|
_ encoding.ProtoMarshaler = (*PatchResponse)(nil)
|
|
_ encoding.ProtoUnmarshaler = (*PatchResponse)(nil)
|
|
_ json.Marshaler = (*PatchResponse)(nil)
|
|
_ json.Unmarshaler = (*PatchResponse)(nil)
|
|
)
|
|
|
|
// StableSize returns the size of x in protobuf format.
|
|
//
|
|
// Structures with the same field values have the same binary size.
|
|
func (x *PatchResponse) StableSize() (size int) {
|
|
if x == nil {
|
|
return 0
|
|
}
|
|
size += proto.NestedStructureSize(1, x.Body)
|
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
|
return size
|
|
}
|
|
|
|
// ReadSignedData fills buf with signed data of x.
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
//
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
//
|
|
// Structures with the same field values have the same signed data.
|
|
func (x *PatchResponse) SignedDataSize() int {
|
|
return x.GetBody().StableSize()
|
|
}
|
|
|
|
// SignedDataSize returns size of the request signed data in bytes.
|
|
//
|
|
// Structures with the same field values have the same signed data size.
|
|
func (x *PatchResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
return x.GetBody().MarshalProtobuf(buf), nil
|
|
}
|
|
|
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
|
func (x *PatchResponse) MarshalProtobuf(dst []byte) []byte {
|
|
m := pool.MarshalerPool.Get()
|
|
defer pool.MarshalerPool.Put(m)
|
|
x.EmitProtobuf(m.MessageMarshaler())
|
|
dst = m.Marshal(dst)
|
|
return dst
|
|
}
|
|
|
|
func (x *PatchResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Body != nil && x.Body.StableSize() != 0 {
|
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
|
}
|
|
if x.MetaHeader != nil && x.MetaHeader.StableSize() != 0 {
|
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
|
}
|
|
if x.VerifyHeader != nil && x.VerifyHeader.StableSize() != 0 {
|
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
|
}
|
|
}
|
|
|
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
|
func (x *PatchResponse) UnmarshalProtobuf(src []byte) (err error) {
|
|
var fc easyproto.FieldContext
|
|
for len(src) > 0 {
|
|
src, err = fc.NextField(src)
|
|
if err != nil {
|
|
return fmt.Errorf("cannot read next field in %s", "PatchResponse")
|
|
}
|
|
switch fc.FieldNum {
|
|
case 1: // Body
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
|
}
|
|
x.Body = new(PatchResponse_Body)
|
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 2: // MetaHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
|
}
|
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
case 3: // VerifyHeader
|
|
data, ok := fc.MessageData()
|
|
if !ok {
|
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
|
}
|
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
|
return fmt.Errorf("unmarshal: %w", err)
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchResponse) GetBody() *PatchResponse_Body {
|
|
if x != nil {
|
|
return x.Body
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchResponse) SetBody(v *PatchResponse_Body) {
|
|
x.Body = v
|
|
}
|
|
func (x *PatchResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
|
if x != nil {
|
|
return x.MetaHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
|
x.MetaHeader = v
|
|
}
|
|
func (x *PatchResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
|
if x != nil {
|
|
return x.VerifyHeader
|
|
}
|
|
return nil
|
|
}
|
|
func (x *PatchResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
|
x.VerifyHeader = v
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface.
|
|
func (x *PatchResponse) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
x.MarshalEasyJSON(&w)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
func (x *PatchResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
|
if x == nil {
|
|
out.RawString("null")
|
|
return
|
|
}
|
|
out.RawByte('{')
|
|
{
|
|
const prefix string = ",\"body\":"
|
|
out.RawString(prefix[1:])
|
|
x.Body.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"metaHeader\":"
|
|
out.RawString(prefix)
|
|
x.MetaHeader.MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"verifyHeader\":"
|
|
out.RawString(prefix)
|
|
x.VerifyHeader.MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
|
func (x *PatchResponse) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
x.UnmarshalEasyJSON(&r)
|
|
return r.Error()
|
|
}
|
|
func (x *PatchResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|
isTopLevel := in.IsStart()
|
|
if in.IsNull() {
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
in.Skip()
|
|
return
|
|
}
|
|
in.Delim('{')
|
|
for !in.IsDelim('}') {
|
|
key := in.UnsafeFieldName(false)
|
|
in.WantColon()
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
in.WantComma()
|
|
continue
|
|
}
|
|
switch key {
|
|
case "body":
|
|
{
|
|
var f *PatchResponse_Body
|
|
f = new(PatchResponse_Body)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.Body = f
|
|
}
|
|
case "metaHeader":
|
|
{
|
|
var f *grpc1.ResponseMetaHeader
|
|
f = new(grpc1.ResponseMetaHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.MetaHeader = f
|
|
}
|
|
case "verifyHeader":
|
|
{
|
|
var f *grpc1.ResponseVerificationHeader
|
|
f = new(grpc1.ResponseVerificationHeader)
|
|
f.UnmarshalEasyJSON(in)
|
|
x.VerifyHeader = f
|
|
}
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|