// Autogenerated by Thrift Compiler (0.13.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

package admin

import (
	"bytes"
	"context"
	"database/sql/driver"
	"errors"
	"fmt"
	"github.com/apache/incubator-pegasus/go-client/idl/base"
	"github.com/apache/incubator-pegasus/go-client/idl/replication"
	"github.com/apache/thrift/lib/go/thrift"
	"reflect"
)

// (needed to ensure safety because of naive import list construction.)
var _ = thrift.ZERO
var _ = fmt.Printf
var _ = context.Background
var _ = reflect.DeepEqual
var _ = bytes.Equal

var _ = base.GoUnusedProtection__
var _ = replication.GoUnusedProtection__

type SplitControlType int64

const (
	SplitControlType_PAUSE   SplitControlType = 0
	SplitControlType_RESTART SplitControlType = 1
	SplitControlType_CANCEL  SplitControlType = 2
)

func (p SplitControlType) String() string {
	switch p {
	case SplitControlType_PAUSE:
		return "PAUSE"
	case SplitControlType_RESTART:
		return "RESTART"
	case SplitControlType_CANCEL:
		return "CANCEL"
	}
	return "<UNSET>"
}

func SplitControlTypeFromString(s string) (SplitControlType, error) {
	switch s {
	case "PAUSE":
		return SplitControlType_PAUSE, nil
	case "RESTART":
		return SplitControlType_RESTART, nil
	case "CANCEL":
		return SplitControlType_CANCEL, nil
	}
	return SplitControlType(0), fmt.Errorf("not a valid SplitControlType string")
}

func SplitControlTypePtr(v SplitControlType) *SplitControlType { return &v }

func (p SplitControlType) MarshalText() ([]byte, error) {
	return []byte(p.String()), nil
}

func (p *SplitControlType) UnmarshalText(text []byte) error {
	q, err := SplitControlTypeFromString(string(text))
	if err != nil {
		return err
	}
	*p = q
	return nil
}

func (p *SplitControlType) Scan(value interface{}) error {
	v, ok := value.(int64)
	if !ok {
		return errors.New("Scan value is not int64")
	}
	*p = SplitControlType(v)
	return nil
}

func (p *SplitControlType) Value() (driver.Value, error) {
	if p == nil {
		return nil, nil
	}
	return int64(*p), nil
}

// Attributes:
//  - AppName
//  - NewPartitionCount_
type StartPartitionSplitRequest struct {
	AppName            string `thrift:"app_name,1" db:"app_name" json:"app_name"`
	NewPartitionCount_ int32  `thrift:"new_partition_count,2" db:"new_partition_count" json:"new_partition_count"`
}

func NewStartPartitionSplitRequest() *StartPartitionSplitRequest {
	return &StartPartitionSplitRequest{}
}

func (p *StartPartitionSplitRequest) GetAppName() string {
	return p.AppName
}

func (p *StartPartitionSplitRequest) GetNewPartitionCount_() int32 {
	return p.NewPartitionCount_
}
func (p *StartPartitionSplitRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *StartPartitionSplitRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *StartPartitionSplitRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.NewPartitionCount_ = v
	}
	return nil
}

func (p *StartPartitionSplitRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("start_partition_split_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *StartPartitionSplitRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *StartPartitionSplitRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("new_partition_count", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:new_partition_count: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.NewPartitionCount_)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.new_partition_count (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:new_partition_count: ", p), err)
	}
	return err
}

func (p *StartPartitionSplitRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("StartPartitionSplitRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - HintMsg
type StartPartitionSplitResponse struct {
	Err     *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
	HintMsg string          `thrift:"hint_msg,2" db:"hint_msg" json:"hint_msg"`
}

func NewStartPartitionSplitResponse() *StartPartitionSplitResponse {
	return &StartPartitionSplitResponse{}
}

var StartPartitionSplitResponse_Err_DEFAULT *base.ErrorCode

func (p *StartPartitionSplitResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return StartPartitionSplitResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *StartPartitionSplitResponse) GetHintMsg() string {
	return p.HintMsg
}
func (p *StartPartitionSplitResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *StartPartitionSplitResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *StartPartitionSplitResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *StartPartitionSplitResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.HintMsg = v
	}
	return nil
}

func (p *StartPartitionSplitResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("start_partition_split_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *StartPartitionSplitResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *StartPartitionSplitResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hint_msg: ", p), err)
	}
	if err := oprot.WriteString(string(p.HintMsg)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.hint_msg (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hint_msg: ", p), err)
	}
	return err
}

func (p *StartPartitionSplitResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("StartPartitionSplitResponse(%+v)", *p)
}

// Attributes:
//  - AppName
//  - ControlType
//  - ParentPidx
//  - OldPartitionCount
type ControlSplitRequest struct {
	AppName           string           `thrift:"app_name,1" db:"app_name" json:"app_name"`
	ControlType       SplitControlType `thrift:"control_type,2" db:"control_type" json:"control_type"`
	ParentPidx        int32            `thrift:"parent_pidx,3" db:"parent_pidx" json:"parent_pidx"`
	OldPartitionCount *int32           `thrift:"old_partition_count,4" db:"old_partition_count" json:"old_partition_count,omitempty"`
}

func NewControlSplitRequest() *ControlSplitRequest {
	return &ControlSplitRequest{}
}

func (p *ControlSplitRequest) GetAppName() string {
	return p.AppName
}

func (p *ControlSplitRequest) GetControlType() SplitControlType {
	return p.ControlType
}

func (p *ControlSplitRequest) GetParentPidx() int32 {
	return p.ParentPidx
}

var ControlSplitRequest_OldPartitionCount_DEFAULT int32

func (p *ControlSplitRequest) GetOldPartitionCount() int32 {
	if !p.IsSetOldPartitionCount() {
		return ControlSplitRequest_OldPartitionCount_DEFAULT
	}
	return *p.OldPartitionCount
}
func (p *ControlSplitRequest) IsSetOldPartitionCount() bool {
	return p.OldPartitionCount != nil
}

func (p *ControlSplitRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *ControlSplitRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *ControlSplitRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		temp := SplitControlType(v)
		p.ControlType = temp
	}
	return nil
}

func (p *ControlSplitRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		p.ParentPidx = v
	}
	return nil
}

func (p *ControlSplitRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.OldPartitionCount = &v
	}
	return nil
}

func (p *ControlSplitRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("control_split_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *ControlSplitRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *ControlSplitRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("control_type", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:control_type: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.ControlType)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.control_type (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:control_type: ", p), err)
	}
	return err
}

func (p *ControlSplitRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("parent_pidx", thrift.I32, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:parent_pidx: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.ParentPidx)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.parent_pidx (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:parent_pidx: ", p), err)
	}
	return err
}

func (p *ControlSplitRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if p.IsSetOldPartitionCount() {
		if err := oprot.WriteFieldBegin("old_partition_count", thrift.I32, 4); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:old_partition_count: ", p), err)
		}
		if err := oprot.WriteI32(int32(*p.OldPartitionCount)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.old_partition_count (4) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 4:old_partition_count: ", p), err)
		}
	}
	return err
}

func (p *ControlSplitRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ControlSplitRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - HintMsg
type ControlSplitResponse struct {
	Err     *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
	HintMsg *string         `thrift:"hint_msg,2" db:"hint_msg" json:"hint_msg,omitempty"`
}

func NewControlSplitResponse() *ControlSplitResponse {
	return &ControlSplitResponse{}
}

var ControlSplitResponse_Err_DEFAULT *base.ErrorCode

func (p *ControlSplitResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return ControlSplitResponse_Err_DEFAULT
	}
	return p.Err
}

var ControlSplitResponse_HintMsg_DEFAULT string

func (p *ControlSplitResponse) GetHintMsg() string {
	if !p.IsSetHintMsg() {
		return ControlSplitResponse_HintMsg_DEFAULT
	}
	return *p.HintMsg
}
func (p *ControlSplitResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *ControlSplitResponse) IsSetHintMsg() bool {
	return p.HintMsg != nil
}

func (p *ControlSplitResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *ControlSplitResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *ControlSplitResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.HintMsg = &v
	}
	return nil
}

func (p *ControlSplitResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("control_split_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *ControlSplitResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *ControlSplitResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetHintMsg() {
		if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 2); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hint_msg: ", p), err)
		}
		if err := oprot.WriteString(string(*p.HintMsg)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.hint_msg (2) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hint_msg: ", p), err)
		}
	}
	return err
}

func (p *ControlSplitResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ControlSplitResponse(%+v)", *p)
}

// Attributes:
//  - AppName
type QuerySplitRequest struct {
	AppName string `thrift:"app_name,1" db:"app_name" json:"app_name"`
}

func NewQuerySplitRequest() *QuerySplitRequest {
	return &QuerySplitRequest{}
}

func (p *QuerySplitRequest) GetAppName() string {
	return p.AppName
}
func (p *QuerySplitRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *QuerySplitRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *QuerySplitRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("query_split_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *QuerySplitRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *QuerySplitRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("QuerySplitRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - NewPartitionCount_
//  - Status
//  - HintMsg
type QuerySplitResponse struct {
	Err                *base.ErrorCode       `thrift:"err,1" db:"err" json:"err"`
	NewPartitionCount_ int32                 `thrift:"new_partition_count,2" db:"new_partition_count" json:"new_partition_count"`
	Status             map[int32]SplitStatus `thrift:"status,3" db:"status" json:"status"`
	HintMsg            *string               `thrift:"hint_msg,4" db:"hint_msg" json:"hint_msg,omitempty"`
}

func NewQuerySplitResponse() *QuerySplitResponse {
	return &QuerySplitResponse{}
}

var QuerySplitResponse_Err_DEFAULT *base.ErrorCode

func (p *QuerySplitResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return QuerySplitResponse_Err_DEFAULT
	}
	return p.Err
}

func (p *QuerySplitResponse) GetNewPartitionCount_() int32 {
	return p.NewPartitionCount_
}

func (p *QuerySplitResponse) GetStatus() map[int32]SplitStatus {
	return p.Status
}

var QuerySplitResponse_HintMsg_DEFAULT string

func (p *QuerySplitResponse) GetHintMsg() string {
	if !p.IsSetHintMsg() {
		return QuerySplitResponse_HintMsg_DEFAULT
	}
	return *p.HintMsg
}
func (p *QuerySplitResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *QuerySplitResponse) IsSetHintMsg() bool {
	return p.HintMsg != nil
}

func (p *QuerySplitResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.MAP {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *QuerySplitResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *QuerySplitResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.NewPartitionCount_ = v
	}
	return nil
}

func (p *QuerySplitResponse) ReadField3(iprot thrift.TProtocol) error {
	_, _, size, err := iprot.ReadMapBegin()
	if err != nil {
		return thrift.PrependError("error reading map begin: ", err)
	}
	tMap := make(map[int32]SplitStatus, size)
	p.Status = tMap
	for i := 0; i < size; i++ {
		var _key0 int32
		if v, err := iprot.ReadI32(); err != nil {
			return thrift.PrependError("error reading field 0: ", err)
		} else {
			_key0 = v
		}
		var _val1 SplitStatus
		if v, err := iprot.ReadI32(); err != nil {
			return thrift.PrependError("error reading field 0: ", err)
		} else {
			temp := SplitStatus(v)
			_val1 = temp
		}
		p.Status[_key0] = _val1
	}
	if err := iprot.ReadMapEnd(); err != nil {
		return thrift.PrependError("error reading map end: ", err)
	}
	return nil
}

func (p *QuerySplitResponse) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.HintMsg = &v
	}
	return nil
}

func (p *QuerySplitResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("query_split_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *QuerySplitResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *QuerySplitResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("new_partition_count", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:new_partition_count: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.NewPartitionCount_)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.new_partition_count (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:new_partition_count: ", p), err)
	}
	return err
}

func (p *QuerySplitResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("status", thrift.MAP, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:status: ", p), err)
	}
	if err := oprot.WriteMapBegin(thrift.I32, thrift.I32, len(p.Status)); err != nil {
		return thrift.PrependError("error writing map begin: ", err)
	}
	for k, v := range p.Status {
		if err := oprot.WriteI32(int32(k)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
		if err := oprot.WriteI32(int32(v)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
		}
	}
	if err := oprot.WriteMapEnd(); err != nil {
		return thrift.PrependError("error writing map end: ", err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:status: ", p), err)
	}
	return err
}

func (p *QuerySplitResponse) writeField4(oprot thrift.TProtocol) (err error) {
	if p.IsSetHintMsg() {
		if err := oprot.WriteFieldBegin("hint_msg", thrift.STRING, 4); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:hint_msg: ", p), err)
		}
		if err := oprot.WriteString(string(*p.HintMsg)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.hint_msg (4) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 4:hint_msg: ", p), err)
		}
	}
	return err
}

func (p *QuerySplitResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("QuerySplitResponse(%+v)", *p)
}

// Attributes:
//  - ParentGpid
//  - ChildGpid
//  - ChildBallot
//  - Child
//  - HpChild
type NotifyCatchUpRequest struct {
	ParentGpid  *base.Gpid       `thrift:"parent_gpid,1" db:"parent_gpid" json:"parent_gpid"`
	ChildGpid   *base.Gpid       `thrift:"child_gpid,2" db:"child_gpid" json:"child_gpid"`
	ChildBallot int64            `thrift:"child_ballot,3" db:"child_ballot" json:"child_ballot"`
	Child       *base.RPCAddress `thrift:"child,4" db:"child" json:"child"`
	HpChild     *base.HostPort   `thrift:"hp_child,5" db:"hp_child" json:"hp_child,omitempty"`
}

func NewNotifyCatchUpRequest() *NotifyCatchUpRequest {
	return &NotifyCatchUpRequest{}
}

var NotifyCatchUpRequest_ParentGpid_DEFAULT *base.Gpid

func (p *NotifyCatchUpRequest) GetParentGpid() *base.Gpid {
	if !p.IsSetParentGpid() {
		return NotifyCatchUpRequest_ParentGpid_DEFAULT
	}
	return p.ParentGpid
}

var NotifyCatchUpRequest_ChildGpid_DEFAULT *base.Gpid

func (p *NotifyCatchUpRequest) GetChildGpid() *base.Gpid {
	if !p.IsSetChildGpid() {
		return NotifyCatchUpRequest_ChildGpid_DEFAULT
	}
	return p.ChildGpid
}

func (p *NotifyCatchUpRequest) GetChildBallot() int64 {
	return p.ChildBallot
}

var NotifyCatchUpRequest_Child_DEFAULT *base.RPCAddress

func (p *NotifyCatchUpRequest) GetChild() *base.RPCAddress {
	if !p.IsSetChild() {
		return NotifyCatchUpRequest_Child_DEFAULT
	}
	return p.Child
}

var NotifyCatchUpRequest_HpChild_DEFAULT *base.HostPort

func (p *NotifyCatchUpRequest) GetHpChild() *base.HostPort {
	if !p.IsSetHpChild() {
		return NotifyCatchUpRequest_HpChild_DEFAULT
	}
	return p.HpChild
}
func (p *NotifyCatchUpRequest) IsSetParentGpid() bool {
	return p.ParentGpid != nil
}

func (p *NotifyCatchUpRequest) IsSetChildGpid() bool {
	return p.ChildGpid != nil
}

func (p *NotifyCatchUpRequest) IsSetChild() bool {
	return p.Child != nil
}

func (p *NotifyCatchUpRequest) IsSetHpChild() bool {
	return p.HpChild != nil
}

func (p *NotifyCatchUpRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *NotifyCatchUpRequest) ReadField1(iprot thrift.TProtocol) error {
	p.ParentGpid = &base.Gpid{}
	if err := p.ParentGpid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ParentGpid), err)
	}
	return nil
}

func (p *NotifyCatchUpRequest) ReadField2(iprot thrift.TProtocol) error {
	p.ChildGpid = &base.Gpid{}
	if err := p.ChildGpid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ChildGpid), err)
	}
	return nil
}

func (p *NotifyCatchUpRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		p.ChildBallot = v
	}
	return nil
}

func (p *NotifyCatchUpRequest) ReadField4(iprot thrift.TProtocol) error {
	p.Child = &base.RPCAddress{}
	if err := p.Child.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Child), err)
	}
	return nil
}

func (p *NotifyCatchUpRequest) ReadField5(iprot thrift.TProtocol) error {
	p.HpChild = &base.HostPort{}
	if err := p.HpChild.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpChild), err)
	}
	return nil
}

func (p *NotifyCatchUpRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("notify_catch_up_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *NotifyCatchUpRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("parent_gpid", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:parent_gpid: ", p), err)
	}
	if err := p.ParentGpid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ParentGpid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:parent_gpid: ", p), err)
	}
	return err
}

func (p *NotifyCatchUpRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("child_gpid", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:child_gpid: ", p), err)
	}
	if err := p.ChildGpid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ChildGpid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:child_gpid: ", p), err)
	}
	return err
}

func (p *NotifyCatchUpRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("child_ballot", thrift.I64, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:child_ballot: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.ChildBallot)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.child_ballot (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:child_ballot: ", p), err)
	}
	return err
}

func (p *NotifyCatchUpRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("child", thrift.STRUCT, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:child: ", p), err)
	}
	if err := p.Child.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Child), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:child: ", p), err)
	}
	return err
}

func (p *NotifyCatchUpRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpChild() {
		if err := oprot.WriteFieldBegin("hp_child", thrift.STRUCT, 5); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:hp_child: ", p), err)
		}
		if err := p.HpChild.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpChild), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 5:hp_child: ", p), err)
		}
	}
	return err
}

func (p *NotifyCatchUpRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("NotifyCatchUpRequest(%+v)", *p)
}

// Attributes:
//  - Err
type NotifyCacthUpResponse struct {
	Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
}

func NewNotifyCacthUpResponse() *NotifyCacthUpResponse {
	return &NotifyCacthUpResponse{}
}

var NotifyCacthUpResponse_Err_DEFAULT *base.ErrorCode

func (p *NotifyCacthUpResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return NotifyCacthUpResponse_Err_DEFAULT
	}
	return p.Err
}
func (p *NotifyCacthUpResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *NotifyCacthUpResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *NotifyCacthUpResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *NotifyCacthUpResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("notify_cacth_up_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *NotifyCacthUpResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *NotifyCacthUpResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("NotifyCacthUpResponse(%+v)", *p)
}

// Attributes:
//  - Target
//  - NewPartitionCount_
//  - ChildPid
//  - Ballot
//  - HpTarget
type UpdateChildGroupPartitionCountRequest struct {
	Target             *base.RPCAddress `thrift:"target,1" db:"target" json:"target"`
	NewPartitionCount_ int32            `thrift:"new_partition_count,2" db:"new_partition_count" json:"new_partition_count"`
	ChildPid           *base.Gpid       `thrift:"child_pid,3" db:"child_pid" json:"child_pid"`
	Ballot             int64            `thrift:"ballot,4" db:"ballot" json:"ballot"`
	HpTarget           *base.HostPort   `thrift:"hp_target,5" db:"hp_target" json:"hp_target,omitempty"`
}

func NewUpdateChildGroupPartitionCountRequest() *UpdateChildGroupPartitionCountRequest {
	return &UpdateChildGroupPartitionCountRequest{}
}

var UpdateChildGroupPartitionCountRequest_Target_DEFAULT *base.RPCAddress

func (p *UpdateChildGroupPartitionCountRequest) GetTarget() *base.RPCAddress {
	if !p.IsSetTarget() {
		return UpdateChildGroupPartitionCountRequest_Target_DEFAULT
	}
	return p.Target
}

func (p *UpdateChildGroupPartitionCountRequest) GetNewPartitionCount_() int32 {
	return p.NewPartitionCount_
}

var UpdateChildGroupPartitionCountRequest_ChildPid_DEFAULT *base.Gpid

func (p *UpdateChildGroupPartitionCountRequest) GetChildPid() *base.Gpid {
	if !p.IsSetChildPid() {
		return UpdateChildGroupPartitionCountRequest_ChildPid_DEFAULT
	}
	return p.ChildPid
}

func (p *UpdateChildGroupPartitionCountRequest) GetBallot() int64 {
	return p.Ballot
}

var UpdateChildGroupPartitionCountRequest_HpTarget_DEFAULT *base.HostPort

func (p *UpdateChildGroupPartitionCountRequest) GetHpTarget() *base.HostPort {
	if !p.IsSetHpTarget() {
		return UpdateChildGroupPartitionCountRequest_HpTarget_DEFAULT
	}
	return p.HpTarget
}
func (p *UpdateChildGroupPartitionCountRequest) IsSetTarget() bool {
	return p.Target != nil
}

func (p *UpdateChildGroupPartitionCountRequest) IsSetChildPid() bool {
	return p.ChildPid != nil
}

func (p *UpdateChildGroupPartitionCountRequest) IsSetHpTarget() bool {
	return p.HpTarget != nil
}

func (p *UpdateChildGroupPartitionCountRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.I64 {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) ReadField1(iprot thrift.TProtocol) error {
	p.Target = &base.RPCAddress{}
	if err := p.Target.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Target), err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.NewPartitionCount_ = v
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) ReadField3(iprot thrift.TProtocol) error {
	p.ChildPid = &base.Gpid{}
	if err := p.ChildPid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ChildPid), err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI64(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.Ballot = v
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) ReadField5(iprot thrift.TProtocol) error {
	p.HpTarget = &base.HostPort{}
	if err := p.HpTarget.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpTarget), err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("update_child_group_partition_count_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("target", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:target: ", p), err)
	}
	if err := p.Target.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Target), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:target: ", p), err)
	}
	return err
}

func (p *UpdateChildGroupPartitionCountRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("new_partition_count", thrift.I32, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:new_partition_count: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.NewPartitionCount_)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.new_partition_count (2) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:new_partition_count: ", p), err)
	}
	return err
}

func (p *UpdateChildGroupPartitionCountRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("child_pid", thrift.STRUCT, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:child_pid: ", p), err)
	}
	if err := p.ChildPid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ChildPid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:child_pid: ", p), err)
	}
	return err
}

func (p *UpdateChildGroupPartitionCountRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("ballot", thrift.I64, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ballot: ", p), err)
	}
	if err := oprot.WriteI64(int64(p.Ballot)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.ballot (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ballot: ", p), err)
	}
	return err
}

func (p *UpdateChildGroupPartitionCountRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpTarget() {
		if err := oprot.WriteFieldBegin("hp_target", thrift.STRUCT, 5); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:hp_target: ", p), err)
		}
		if err := p.HpTarget.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpTarget), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 5:hp_target: ", p), err)
		}
	}
	return err
}

func (p *UpdateChildGroupPartitionCountRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("UpdateChildGroupPartitionCountRequest(%+v)", *p)
}

// Attributes:
//  - Err
type UpdateChildGroupPartitionCountResponse struct {
	Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
}

func NewUpdateChildGroupPartitionCountResponse() *UpdateChildGroupPartitionCountResponse {
	return &UpdateChildGroupPartitionCountResponse{}
}

var UpdateChildGroupPartitionCountResponse_Err_DEFAULT *base.ErrorCode

func (p *UpdateChildGroupPartitionCountResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return UpdateChildGroupPartitionCountResponse_Err_DEFAULT
	}
	return p.Err
}
func (p *UpdateChildGroupPartitionCountResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *UpdateChildGroupPartitionCountResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("update_child_group_partition_count_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *UpdateChildGroupPartitionCountResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *UpdateChildGroupPartitionCountResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("UpdateChildGroupPartitionCountResponse(%+v)", *p)
}

// Attributes:
//  - App
//  - ParentConfig
//  - ChildConfig
//  - Primary
//  - HpPrimary
type RegisterChildRequest struct {
	App          *replication.AppInfo                `thrift:"app,1" db:"app" json:"app"`
	ParentConfig *replication.PartitionConfiguration `thrift:"parent_config,2" db:"parent_config" json:"parent_config"`
	ChildConfig  *replication.PartitionConfiguration `thrift:"child_config,3" db:"child_config" json:"child_config"`
	Primary      *base.RPCAddress                    `thrift:"primary,4" db:"primary" json:"primary"`
	HpPrimary    *base.HostPort                      `thrift:"hp_primary,5" db:"hp_primary" json:"hp_primary,omitempty"`
}

func NewRegisterChildRequest() *RegisterChildRequest {
	return &RegisterChildRequest{}
}

var RegisterChildRequest_App_DEFAULT *replication.AppInfo

func (p *RegisterChildRequest) GetApp() *replication.AppInfo {
	if !p.IsSetApp() {
		return RegisterChildRequest_App_DEFAULT
	}
	return p.App
}

var RegisterChildRequest_ParentConfig_DEFAULT *replication.PartitionConfiguration

func (p *RegisterChildRequest) GetParentConfig() *replication.PartitionConfiguration {
	if !p.IsSetParentConfig() {
		return RegisterChildRequest_ParentConfig_DEFAULT
	}
	return p.ParentConfig
}

var RegisterChildRequest_ChildConfig_DEFAULT *replication.PartitionConfiguration

func (p *RegisterChildRequest) GetChildConfig() *replication.PartitionConfiguration {
	if !p.IsSetChildConfig() {
		return RegisterChildRequest_ChildConfig_DEFAULT
	}
	return p.ChildConfig
}

var RegisterChildRequest_Primary_DEFAULT *base.RPCAddress

func (p *RegisterChildRequest) GetPrimary() *base.RPCAddress {
	if !p.IsSetPrimary() {
		return RegisterChildRequest_Primary_DEFAULT
	}
	return p.Primary
}

var RegisterChildRequest_HpPrimary_DEFAULT *base.HostPort

func (p *RegisterChildRequest) GetHpPrimary() *base.HostPort {
	if !p.IsSetHpPrimary() {
		return RegisterChildRequest_HpPrimary_DEFAULT
	}
	return p.HpPrimary
}
func (p *RegisterChildRequest) IsSetApp() bool {
	return p.App != nil
}

func (p *RegisterChildRequest) IsSetParentConfig() bool {
	return p.ParentConfig != nil
}

func (p *RegisterChildRequest) IsSetChildConfig() bool {
	return p.ChildConfig != nil
}

func (p *RegisterChildRequest) IsSetPrimary() bool {
	return p.Primary != nil
}

func (p *RegisterChildRequest) IsSetHpPrimary() bool {
	return p.HpPrimary != nil
}

func (p *RegisterChildRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 5:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField5(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *RegisterChildRequest) ReadField1(iprot thrift.TProtocol) error {
	p.App = &replication.AppInfo{
		Status: 0,

		InitPartitionCount: -1,
	}
	if err := p.App.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.App), err)
	}
	return nil
}

func (p *RegisterChildRequest) ReadField2(iprot thrift.TProtocol) error {
	p.ParentConfig = &replication.PartitionConfiguration{}
	if err := p.ParentConfig.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ParentConfig), err)
	}
	return nil
}

func (p *RegisterChildRequest) ReadField3(iprot thrift.TProtocol) error {
	p.ChildConfig = &replication.PartitionConfiguration{}
	if err := p.ChildConfig.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ChildConfig), err)
	}
	return nil
}

func (p *RegisterChildRequest) ReadField4(iprot thrift.TProtocol) error {
	p.Primary = &base.RPCAddress{}
	if err := p.Primary.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Primary), err)
	}
	return nil
}

func (p *RegisterChildRequest) ReadField5(iprot thrift.TProtocol) error {
	p.HpPrimary = &base.HostPort{}
	if err := p.HpPrimary.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpPrimary), err)
	}
	return nil
}

func (p *RegisterChildRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("register_child_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
		if err := p.writeField5(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *RegisterChildRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app: ", p), err)
	}
	if err := p.App.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.App), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app: ", p), err)
	}
	return err
}

func (p *RegisterChildRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("parent_config", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:parent_config: ", p), err)
	}
	if err := p.ParentConfig.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ParentConfig), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:parent_config: ", p), err)
	}
	return err
}

func (p *RegisterChildRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("child_config", thrift.STRUCT, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:child_config: ", p), err)
	}
	if err := p.ChildConfig.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ChildConfig), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:child_config: ", p), err)
	}
	return err
}

func (p *RegisterChildRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("primary", thrift.STRUCT, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:primary: ", p), err)
	}
	if err := p.Primary.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Primary), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:primary: ", p), err)
	}
	return err
}

func (p *RegisterChildRequest) writeField5(oprot thrift.TProtocol) (err error) {
	if p.IsSetHpPrimary() {
		if err := oprot.WriteFieldBegin("hp_primary", thrift.STRUCT, 5); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:hp_primary: ", p), err)
		}
		if err := p.HpPrimary.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpPrimary), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 5:hp_primary: ", p), err)
		}
	}
	return err
}

func (p *RegisterChildRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("RegisterChildRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - App
//  - ParentConfig
//  - ChildConfig
type RegisterChildResponse struct {
	Err          *base.ErrorCode                     `thrift:"err,1" db:"err" json:"err"`
	App          *replication.AppInfo                `thrift:"app,2" db:"app" json:"app"`
	ParentConfig *replication.PartitionConfiguration `thrift:"parent_config,3" db:"parent_config" json:"parent_config"`
	ChildConfig  *replication.PartitionConfiguration `thrift:"child_config,4" db:"child_config" json:"child_config"`
}

func NewRegisterChildResponse() *RegisterChildResponse {
	return &RegisterChildResponse{}
}

var RegisterChildResponse_Err_DEFAULT *base.ErrorCode

func (p *RegisterChildResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return RegisterChildResponse_Err_DEFAULT
	}
	return p.Err
}

var RegisterChildResponse_App_DEFAULT *replication.AppInfo

func (p *RegisterChildResponse) GetApp() *replication.AppInfo {
	if !p.IsSetApp() {
		return RegisterChildResponse_App_DEFAULT
	}
	return p.App
}

var RegisterChildResponse_ParentConfig_DEFAULT *replication.PartitionConfiguration

func (p *RegisterChildResponse) GetParentConfig() *replication.PartitionConfiguration {
	if !p.IsSetParentConfig() {
		return RegisterChildResponse_ParentConfig_DEFAULT
	}
	return p.ParentConfig
}

var RegisterChildResponse_ChildConfig_DEFAULT *replication.PartitionConfiguration

func (p *RegisterChildResponse) GetChildConfig() *replication.PartitionConfiguration {
	if !p.IsSetChildConfig() {
		return RegisterChildResponse_ChildConfig_DEFAULT
	}
	return p.ChildConfig
}
func (p *RegisterChildResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *RegisterChildResponse) IsSetApp() bool {
	return p.App != nil
}

func (p *RegisterChildResponse) IsSetParentConfig() bool {
	return p.ParentConfig != nil
}

func (p *RegisterChildResponse) IsSetChildConfig() bool {
	return p.ChildConfig != nil
}

func (p *RegisterChildResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *RegisterChildResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *RegisterChildResponse) ReadField2(iprot thrift.TProtocol) error {
	p.App = &replication.AppInfo{
		Status: 0,

		InitPartitionCount: -1,
	}
	if err := p.App.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.App), err)
	}
	return nil
}

func (p *RegisterChildResponse) ReadField3(iprot thrift.TProtocol) error {
	p.ParentConfig = &replication.PartitionConfiguration{}
	if err := p.ParentConfig.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ParentConfig), err)
	}
	return nil
}

func (p *RegisterChildResponse) ReadField4(iprot thrift.TProtocol) error {
	p.ChildConfig = &replication.PartitionConfiguration{}
	if err := p.ChildConfig.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ChildConfig), err)
	}
	return nil
}

func (p *RegisterChildResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("register_child_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *RegisterChildResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *RegisterChildResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:app: ", p), err)
	}
	if err := p.App.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.App), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:app: ", p), err)
	}
	return err
}

func (p *RegisterChildResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("parent_config", thrift.STRUCT, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:parent_config: ", p), err)
	}
	if err := p.ParentConfig.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ParentConfig), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:parent_config: ", p), err)
	}
	return err
}

func (p *RegisterChildResponse) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("child_config", thrift.STRUCT, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:child_config: ", p), err)
	}
	if err := p.ChildConfig.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ChildConfig), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:child_config: ", p), err)
	}
	return err
}

func (p *RegisterChildResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("RegisterChildResponse(%+v)", *p)
}

// Attributes:
//  - AppName
//  - ParentGpid
//  - MetaSplitStatus
//  - PartitionCount
type NotifyStopSplitRequest struct {
	AppName         string      `thrift:"app_name,1" db:"app_name" json:"app_name"`
	ParentGpid      *base.Gpid  `thrift:"parent_gpid,2" db:"parent_gpid" json:"parent_gpid"`
	MetaSplitStatus SplitStatus `thrift:"meta_split_status,3" db:"meta_split_status" json:"meta_split_status"`
	PartitionCount  int32       `thrift:"partition_count,4" db:"partition_count" json:"partition_count"`
}

func NewNotifyStopSplitRequest() *NotifyStopSplitRequest {
	return &NotifyStopSplitRequest{}
}

func (p *NotifyStopSplitRequest) GetAppName() string {
	return p.AppName
}

var NotifyStopSplitRequest_ParentGpid_DEFAULT *base.Gpid

func (p *NotifyStopSplitRequest) GetParentGpid() *base.Gpid {
	if !p.IsSetParentGpid() {
		return NotifyStopSplitRequest_ParentGpid_DEFAULT
	}
	return p.ParentGpid
}

func (p *NotifyStopSplitRequest) GetMetaSplitStatus() SplitStatus {
	return p.MetaSplitStatus
}

func (p *NotifyStopSplitRequest) GetPartitionCount() int32 {
	return p.PartitionCount
}
func (p *NotifyStopSplitRequest) IsSetParentGpid() bool {
	return p.ParentGpid != nil
}

func (p *NotifyStopSplitRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 4:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField4(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *NotifyStopSplitRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *NotifyStopSplitRequest) ReadField2(iprot thrift.TProtocol) error {
	p.ParentGpid = &base.Gpid{}
	if err := p.ParentGpid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ParentGpid), err)
	}
	return nil
}

func (p *NotifyStopSplitRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		temp := SplitStatus(v)
		p.MetaSplitStatus = temp
	}
	return nil
}

func (p *NotifyStopSplitRequest) ReadField4(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 4: ", err)
	} else {
		p.PartitionCount = v
	}
	return nil
}

func (p *NotifyStopSplitRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("notify_stop_split_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
		if err := p.writeField4(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *NotifyStopSplitRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *NotifyStopSplitRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("parent_gpid", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:parent_gpid: ", p), err)
	}
	if err := p.ParentGpid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ParentGpid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:parent_gpid: ", p), err)
	}
	return err
}

func (p *NotifyStopSplitRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("meta_split_status", thrift.I32, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:meta_split_status: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.MetaSplitStatus)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.meta_split_status (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:meta_split_status: ", p), err)
	}
	return err
}

func (p *NotifyStopSplitRequest) writeField4(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("partition_count", thrift.I32, 4); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:partition_count: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.PartitionCount)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.partition_count (4) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 4:partition_count: ", p), err)
	}
	return err
}

func (p *NotifyStopSplitRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("NotifyStopSplitRequest(%+v)", *p)
}

// Attributes:
//  - Err
type NotifyStopSplitResponse struct {
	Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
}

func NewNotifyStopSplitResponse() *NotifyStopSplitResponse {
	return &NotifyStopSplitResponse{}
}

var NotifyStopSplitResponse_Err_DEFAULT *base.ErrorCode

func (p *NotifyStopSplitResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return NotifyStopSplitResponse_Err_DEFAULT
	}
	return p.Err
}
func (p *NotifyStopSplitResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *NotifyStopSplitResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *NotifyStopSplitResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *NotifyStopSplitResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("notify_stop_split_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *NotifyStopSplitResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *NotifyStopSplitResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("NotifyStopSplitResponse(%+v)", *p)
}

// Attributes:
//  - AppName
//  - Pid
//  - PartitionCount
type QueryChildStateRequest struct {
	AppName        string     `thrift:"app_name,1" db:"app_name" json:"app_name"`
	Pid            *base.Gpid `thrift:"pid,2" db:"pid" json:"pid"`
	PartitionCount int32      `thrift:"partition_count,3" db:"partition_count" json:"partition_count"`
}

func NewQueryChildStateRequest() *QueryChildStateRequest {
	return &QueryChildStateRequest{}
}

func (p *QueryChildStateRequest) GetAppName() string {
	return p.AppName
}

var QueryChildStateRequest_Pid_DEFAULT *base.Gpid

func (p *QueryChildStateRequest) GetPid() *base.Gpid {
	if !p.IsSetPid() {
		return QueryChildStateRequest_Pid_DEFAULT
	}
	return p.Pid
}

func (p *QueryChildStateRequest) GetPartitionCount() int32 {
	return p.PartitionCount
}
func (p *QueryChildStateRequest) IsSetPid() bool {
	return p.Pid != nil
}

func (p *QueryChildStateRequest) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRING {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *QueryChildStateRequest) ReadField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.AppName = v
	}
	return nil
}

func (p *QueryChildStateRequest) ReadField2(iprot thrift.TProtocol) error {
	p.Pid = &base.Gpid{}
	if err := p.Pid.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Pid), err)
	}
	return nil
}

func (p *QueryChildStateRequest) ReadField3(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 3: ", err)
	} else {
		p.PartitionCount = v
	}
	return nil
}

func (p *QueryChildStateRequest) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("query_child_state_request"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *QueryChildStateRequest) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:app_name: ", p), err)
	}
	if err := oprot.WriteString(string(p.AppName)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.app_name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:app_name: ", p), err)
	}
	return err
}

func (p *QueryChildStateRequest) writeField2(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("pid", thrift.STRUCT, 2); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:pid: ", p), err)
	}
	if err := p.Pid.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Pid), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 2:pid: ", p), err)
	}
	return err
}

func (p *QueryChildStateRequest) writeField3(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("partition_count", thrift.I32, 3); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:partition_count: ", p), err)
	}
	if err := oprot.WriteI32(int32(p.PartitionCount)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.partition_count (3) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 3:partition_count: ", p), err)
	}
	return err
}

func (p *QueryChildStateRequest) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("QueryChildStateRequest(%+v)", *p)
}

// Attributes:
//  - Err
//  - PartitionCount
//  - ChildConfig
type QueryChildStateResponse struct {
	Err            *base.ErrorCode                     `thrift:"err,1" db:"err" json:"err"`
	PartitionCount *int32                              `thrift:"partition_count,2" db:"partition_count" json:"partition_count,omitempty"`
	ChildConfig    *replication.PartitionConfiguration `thrift:"child_config,3" db:"child_config" json:"child_config,omitempty"`
}

func NewQueryChildStateResponse() *QueryChildStateResponse {
	return &QueryChildStateResponse{}
}

var QueryChildStateResponse_Err_DEFAULT *base.ErrorCode

func (p *QueryChildStateResponse) GetErr() *base.ErrorCode {
	if !p.IsSetErr() {
		return QueryChildStateResponse_Err_DEFAULT
	}
	return p.Err
}

var QueryChildStateResponse_PartitionCount_DEFAULT int32

func (p *QueryChildStateResponse) GetPartitionCount() int32 {
	if !p.IsSetPartitionCount() {
		return QueryChildStateResponse_PartitionCount_DEFAULT
	}
	return *p.PartitionCount
}

var QueryChildStateResponse_ChildConfig_DEFAULT *replication.PartitionConfiguration

func (p *QueryChildStateResponse) GetChildConfig() *replication.PartitionConfiguration {
	if !p.IsSetChildConfig() {
		return QueryChildStateResponse_ChildConfig_DEFAULT
	}
	return p.ChildConfig
}
func (p *QueryChildStateResponse) IsSetErr() bool {
	return p.Err != nil
}

func (p *QueryChildStateResponse) IsSetPartitionCount() bool {
	return p.PartitionCount != nil
}

func (p *QueryChildStateResponse) IsSetChildConfig() bool {
	return p.ChildConfig != nil
}

func (p *QueryChildStateResponse) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField1(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 2:
			if fieldTypeId == thrift.I32 {
				if err := p.ReadField2(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		case 3:
			if fieldTypeId == thrift.STRUCT {
				if err := p.ReadField3(iprot); err != nil {
					return err
				}
			} else {
				if err := iprot.Skip(fieldTypeId); err != nil {
					return err
				}
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *QueryChildStateResponse) ReadField1(iprot thrift.TProtocol) error {
	p.Err = &base.ErrorCode{}
	if err := p.Err.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Err), err)
	}
	return nil
}

func (p *QueryChildStateResponse) ReadField2(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadI32(); err != nil {
		return thrift.PrependError("error reading field 2: ", err)
	} else {
		p.PartitionCount = &v
	}
	return nil
}

func (p *QueryChildStateResponse) ReadField3(iprot thrift.TProtocol) error {
	p.ChildConfig = &replication.PartitionConfiguration{}
	if err := p.ChildConfig.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.ChildConfig), err)
	}
	return nil
}

func (p *QueryChildStateResponse) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("query_child_state_response"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if p != nil {
		if err := p.writeField1(oprot); err != nil {
			return err
		}
		if err := p.writeField2(oprot); err != nil {
			return err
		}
		if err := p.writeField3(oprot); err != nil {
			return err
		}
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *QueryChildStateResponse) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("err", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:err: ", p), err)
	}
	if err := p.Err.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Err), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:err: ", p), err)
	}
	return err
}

func (p *QueryChildStateResponse) writeField2(oprot thrift.TProtocol) (err error) {
	if p.IsSetPartitionCount() {
		if err := oprot.WriteFieldBegin("partition_count", thrift.I32, 2); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:partition_count: ", p), err)
		}
		if err := oprot.WriteI32(int32(*p.PartitionCount)); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T.partition_count (2) field write error: ", p), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 2:partition_count: ", p), err)
		}
	}
	return err
}

func (p *QueryChildStateResponse) writeField3(oprot thrift.TProtocol) (err error) {
	if p.IsSetChildConfig() {
		if err := oprot.WriteFieldBegin("child_config", thrift.STRUCT, 3); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:child_config: ", p), err)
		}
		if err := p.ChildConfig.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.ChildConfig), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 3:child_config: ", p), err)
		}
	}
	return err
}

func (p *QueryChildStateResponse) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("QueryChildStateResponse(%+v)", *p)
}
