go-client/idl/admin/duplication.go (2,333 lines of code) (raw):
// 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 DuplicationStatus int64
const (
DuplicationStatus_DS_INIT DuplicationStatus = 0
DuplicationStatus_DS_PREPARE DuplicationStatus = 1
DuplicationStatus_DS_APP DuplicationStatus = 2
DuplicationStatus_DS_LOG DuplicationStatus = 3
DuplicationStatus_DS_PAUSE DuplicationStatus = 4
DuplicationStatus_DS_REMOVED DuplicationStatus = 5
)
func (p DuplicationStatus) String() string {
switch p {
case DuplicationStatus_DS_INIT:
return "DS_INIT"
case DuplicationStatus_DS_PREPARE:
return "DS_PREPARE"
case DuplicationStatus_DS_APP:
return "DS_APP"
case DuplicationStatus_DS_LOG:
return "DS_LOG"
case DuplicationStatus_DS_PAUSE:
return "DS_PAUSE"
case DuplicationStatus_DS_REMOVED:
return "DS_REMOVED"
}
return "<UNSET>"
}
func DuplicationStatusFromString(s string) (DuplicationStatus, error) {
switch s {
case "DS_INIT":
return DuplicationStatus_DS_INIT, nil
case "DS_PREPARE":
return DuplicationStatus_DS_PREPARE, nil
case "DS_APP":
return DuplicationStatus_DS_APP, nil
case "DS_LOG":
return DuplicationStatus_DS_LOG, nil
case "DS_PAUSE":
return DuplicationStatus_DS_PAUSE, nil
case "DS_REMOVED":
return DuplicationStatus_DS_REMOVED, nil
}
return DuplicationStatus(0), fmt.Errorf("not a valid DuplicationStatus string")
}
func DuplicationStatusPtr(v DuplicationStatus) *DuplicationStatus { return &v }
func (p DuplicationStatus) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
func (p *DuplicationStatus) UnmarshalText(text []byte) error {
q, err := DuplicationStatusFromString(string(text))
if err != nil {
return err
}
*p = q
return nil
}
func (p *DuplicationStatus) Scan(value interface{}) error {
v, ok := value.(int64)
if !ok {
return errors.New("Scan value is not int64")
}
*p = DuplicationStatus(v)
return nil
}
func (p *DuplicationStatus) Value() (driver.Value, error) {
if p == nil {
return nil, nil
}
return int64(*p), nil
}
type DuplicationFailMode int64
const (
DuplicationFailMode_FAIL_SLOW DuplicationFailMode = 0
DuplicationFailMode_FAIL_SKIP DuplicationFailMode = 1
DuplicationFailMode_FAIL_FAST DuplicationFailMode = 2
)
func (p DuplicationFailMode) String() string {
switch p {
case DuplicationFailMode_FAIL_SLOW:
return "FAIL_SLOW"
case DuplicationFailMode_FAIL_SKIP:
return "FAIL_SKIP"
case DuplicationFailMode_FAIL_FAST:
return "FAIL_FAST"
}
return "<UNSET>"
}
func DuplicationFailModeFromString(s string) (DuplicationFailMode, error) {
switch s {
case "FAIL_SLOW":
return DuplicationFailMode_FAIL_SLOW, nil
case "FAIL_SKIP":
return DuplicationFailMode_FAIL_SKIP, nil
case "FAIL_FAST":
return DuplicationFailMode_FAIL_FAST, nil
}
return DuplicationFailMode(0), fmt.Errorf("not a valid DuplicationFailMode string")
}
func DuplicationFailModePtr(v DuplicationFailMode) *DuplicationFailMode { return &v }
func (p DuplicationFailMode) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
func (p *DuplicationFailMode) UnmarshalText(text []byte) error {
q, err := DuplicationFailModeFromString(string(text))
if err != nil {
return err
}
*p = q
return nil
}
func (p *DuplicationFailMode) Scan(value interface{}) error {
v, ok := value.(int64)
if !ok {
return errors.New("Scan value is not int64")
}
*p = DuplicationFailMode(v)
return nil
}
func (p *DuplicationFailMode) Value() (driver.Value, error) {
if p == nil {
return nil, nil
}
return int64(*p), nil
}
// Attributes:
// - AppName
// - RemoteClusterName
// - IsDuplicatingCheckpoint
// - RemoteAppName
// - RemoteReplicaCount
type DuplicationAddRequest struct {
AppName string `thrift:"app_name,1" db:"app_name" json:"app_name"`
RemoteClusterName string `thrift:"remote_cluster_name,2" db:"remote_cluster_name" json:"remote_cluster_name"`
IsDuplicatingCheckpoint bool `thrift:"is_duplicating_checkpoint,3" db:"is_duplicating_checkpoint" json:"is_duplicating_checkpoint"`
RemoteAppName *string `thrift:"remote_app_name,4" db:"remote_app_name" json:"remote_app_name,omitempty"`
RemoteReplicaCount *int32 `thrift:"remote_replica_count,5" db:"remote_replica_count" json:"remote_replica_count,omitempty"`
}
func NewDuplicationAddRequest() *DuplicationAddRequest {
return &DuplicationAddRequest{
IsDuplicatingCheckpoint: true,
}
}
func (p *DuplicationAddRequest) GetAppName() string {
return p.AppName
}
func (p *DuplicationAddRequest) GetRemoteClusterName() string {
return p.RemoteClusterName
}
var DuplicationAddRequest_IsDuplicatingCheckpoint_DEFAULT bool = true
func (p *DuplicationAddRequest) GetIsDuplicatingCheckpoint() bool {
return p.IsDuplicatingCheckpoint
}
var DuplicationAddRequest_RemoteAppName_DEFAULT string
func (p *DuplicationAddRequest) GetRemoteAppName() string {
if !p.IsSetRemoteAppName() {
return DuplicationAddRequest_RemoteAppName_DEFAULT
}
return *p.RemoteAppName
}
var DuplicationAddRequest_RemoteReplicaCount_DEFAULT int32
func (p *DuplicationAddRequest) GetRemoteReplicaCount() int32 {
if !p.IsSetRemoteReplicaCount() {
return DuplicationAddRequest_RemoteReplicaCount_DEFAULT
}
return *p.RemoteReplicaCount
}
func (p *DuplicationAddRequest) IsSetIsDuplicatingCheckpoint() bool {
return p.IsDuplicatingCheckpoint != DuplicationAddRequest_IsDuplicatingCheckpoint_DEFAULT
}
func (p *DuplicationAddRequest) IsSetRemoteAppName() bool {
return p.RemoteAppName != nil
}
func (p *DuplicationAddRequest) IsSetRemoteReplicaCount() bool {
return p.RemoteReplicaCount != nil
}
func (p *DuplicationAddRequest) 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.STRING {
if err := p.ReadField2(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 3:
if fieldTypeId == thrift.BOOL {
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
}
}
case 5:
if fieldTypeId == thrift.I32 {
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 *DuplicationAddRequest) 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 *DuplicationAddRequest) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.RemoteClusterName = v
}
return nil
}
func (p *DuplicationAddRequest) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadBool(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.IsDuplicatingCheckpoint = v
}
return nil
}
func (p *DuplicationAddRequest) ReadField4(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 4: ", err)
} else {
p.RemoteAppName = &v
}
return nil
}
func (p *DuplicationAddRequest) ReadField5(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 5: ", err)
} else {
p.RemoteReplicaCount = &v
}
return nil
}
func (p *DuplicationAddRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_add_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 *DuplicationAddRequest) 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 *DuplicationAddRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("remote_cluster_name", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:remote_cluster_name: ", p), err)
}
if err := oprot.WriteString(string(p.RemoteClusterName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_cluster_name (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:remote_cluster_name: ", p), err)
}
return err
}
func (p *DuplicationAddRequest) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetIsDuplicatingCheckpoint() {
if err := oprot.WriteFieldBegin("is_duplicating_checkpoint", thrift.BOOL, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:is_duplicating_checkpoint: ", p), err)
}
if err := oprot.WriteBool(bool(p.IsDuplicatingCheckpoint)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.is_duplicating_checkpoint (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:is_duplicating_checkpoint: ", p), err)
}
}
return err
}
func (p *DuplicationAddRequest) writeField4(oprot thrift.TProtocol) (err error) {
if p.IsSetRemoteAppName() {
if err := oprot.WriteFieldBegin("remote_app_name", thrift.STRING, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:remote_app_name: ", p), err)
}
if err := oprot.WriteString(string(*p.RemoteAppName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_app_name (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:remote_app_name: ", p), err)
}
}
return err
}
func (p *DuplicationAddRequest) writeField5(oprot thrift.TProtocol) (err error) {
if p.IsSetRemoteReplicaCount() {
if err := oprot.WriteFieldBegin("remote_replica_count", thrift.I32, 5); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:remote_replica_count: ", p), err)
}
if err := oprot.WriteI32(int32(*p.RemoteReplicaCount)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_replica_count (5) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 5:remote_replica_count: ", p), err)
}
}
return err
}
func (p *DuplicationAddRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationAddRequest(%+v)", *p)
}
// Attributes:
// - Err
// - Appid
// - Dupid
// - Hint
// - RemoteAppName
// - RemoteReplicaCount
type DuplicationAddResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
Appid int32 `thrift:"appid,2" db:"appid" json:"appid"`
Dupid int32 `thrift:"dupid,3" db:"dupid" json:"dupid"`
Hint *string `thrift:"hint,4" db:"hint" json:"hint,omitempty"`
RemoteAppName *string `thrift:"remote_app_name,5" db:"remote_app_name" json:"remote_app_name,omitempty"`
RemoteReplicaCount *int32 `thrift:"remote_replica_count,6" db:"remote_replica_count" json:"remote_replica_count,omitempty"`
}
func NewDuplicationAddResponse() *DuplicationAddResponse {
return &DuplicationAddResponse{}
}
var DuplicationAddResponse_Err_DEFAULT *base.ErrorCode
func (p *DuplicationAddResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return DuplicationAddResponse_Err_DEFAULT
}
return p.Err
}
func (p *DuplicationAddResponse) GetAppid() int32 {
return p.Appid
}
func (p *DuplicationAddResponse) GetDupid() int32 {
return p.Dupid
}
var DuplicationAddResponse_Hint_DEFAULT string
func (p *DuplicationAddResponse) GetHint() string {
if !p.IsSetHint() {
return DuplicationAddResponse_Hint_DEFAULT
}
return *p.Hint
}
var DuplicationAddResponse_RemoteAppName_DEFAULT string
func (p *DuplicationAddResponse) GetRemoteAppName() string {
if !p.IsSetRemoteAppName() {
return DuplicationAddResponse_RemoteAppName_DEFAULT
}
return *p.RemoteAppName
}
var DuplicationAddResponse_RemoteReplicaCount_DEFAULT int32
func (p *DuplicationAddResponse) GetRemoteReplicaCount() int32 {
if !p.IsSetRemoteReplicaCount() {
return DuplicationAddResponse_RemoteReplicaCount_DEFAULT
}
return *p.RemoteReplicaCount
}
func (p *DuplicationAddResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *DuplicationAddResponse) IsSetHint() bool {
return p.Hint != nil
}
func (p *DuplicationAddResponse) IsSetRemoteAppName() bool {
return p.RemoteAppName != nil
}
func (p *DuplicationAddResponse) IsSetRemoteReplicaCount() bool {
return p.RemoteReplicaCount != nil
}
func (p *DuplicationAddResponse) 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.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.STRING {
if err := p.ReadField4(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 5:
if fieldTypeId == thrift.STRING {
if err := p.ReadField5(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 6:
if fieldTypeId == thrift.I32 {
if err := p.ReadField6(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 *DuplicationAddResponse) 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 *DuplicationAddResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.Appid = v
}
return nil
}
func (p *DuplicationAddResponse) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.Dupid = v
}
return nil
}
func (p *DuplicationAddResponse) ReadField4(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 4: ", err)
} else {
p.Hint = &v
}
return nil
}
func (p *DuplicationAddResponse) ReadField5(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 5: ", err)
} else {
p.RemoteAppName = &v
}
return nil
}
func (p *DuplicationAddResponse) ReadField6(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 6: ", err)
} else {
p.RemoteReplicaCount = &v
}
return nil
}
func (p *DuplicationAddResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_add_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 := p.writeField5(oprot); err != nil {
return err
}
if err := p.writeField6(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 *DuplicationAddResponse) 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 *DuplicationAddResponse) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("appid", thrift.I32, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:appid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Appid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.appid (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:appid: ", p), err)
}
return err
}
func (p *DuplicationAddResponse) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("dupid", thrift.I32, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:dupid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Dupid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.dupid (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:dupid: ", p), err)
}
return err
}
func (p *DuplicationAddResponse) writeField4(oprot thrift.TProtocol) (err error) {
if p.IsSetHint() {
if err := oprot.WriteFieldBegin("hint", thrift.STRING, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:hint: ", p), err)
}
if err := oprot.WriteString(string(*p.Hint)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.hint (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:hint: ", p), err)
}
}
return err
}
func (p *DuplicationAddResponse) writeField5(oprot thrift.TProtocol) (err error) {
if p.IsSetRemoteAppName() {
if err := oprot.WriteFieldBegin("remote_app_name", thrift.STRING, 5); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:remote_app_name: ", p), err)
}
if err := oprot.WriteString(string(*p.RemoteAppName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_app_name (5) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 5:remote_app_name: ", p), err)
}
}
return err
}
func (p *DuplicationAddResponse) writeField6(oprot thrift.TProtocol) (err error) {
if p.IsSetRemoteReplicaCount() {
if err := oprot.WriteFieldBegin("remote_replica_count", thrift.I32, 6); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:remote_replica_count: ", p), err)
}
if err := oprot.WriteI32(int32(*p.RemoteReplicaCount)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_replica_count (6) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 6:remote_replica_count: ", p), err)
}
}
return err
}
func (p *DuplicationAddResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationAddResponse(%+v)", *p)
}
// Attributes:
// - AppName
// - Dupid
// - Status
// - FailMode
type DuplicationModifyRequest struct {
AppName string `thrift:"app_name,1" db:"app_name" json:"app_name"`
Dupid int32 `thrift:"dupid,2" db:"dupid" json:"dupid"`
Status *DuplicationStatus `thrift:"status,3" db:"status" json:"status,omitempty"`
FailMode *DuplicationFailMode `thrift:"fail_mode,4" db:"fail_mode" json:"fail_mode,omitempty"`
}
func NewDuplicationModifyRequest() *DuplicationModifyRequest {
return &DuplicationModifyRequest{}
}
func (p *DuplicationModifyRequest) GetAppName() string {
return p.AppName
}
func (p *DuplicationModifyRequest) GetDupid() int32 {
return p.Dupid
}
var DuplicationModifyRequest_Status_DEFAULT DuplicationStatus
func (p *DuplicationModifyRequest) GetStatus() DuplicationStatus {
if !p.IsSetStatus() {
return DuplicationModifyRequest_Status_DEFAULT
}
return *p.Status
}
var DuplicationModifyRequest_FailMode_DEFAULT DuplicationFailMode
func (p *DuplicationModifyRequest) GetFailMode() DuplicationFailMode {
if !p.IsSetFailMode() {
return DuplicationModifyRequest_FailMode_DEFAULT
}
return *p.FailMode
}
func (p *DuplicationModifyRequest) IsSetStatus() bool {
return p.Status != nil
}
func (p *DuplicationModifyRequest) IsSetFailMode() bool {
return p.FailMode != nil
}
func (p *DuplicationModifyRequest) 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 *DuplicationModifyRequest) 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 *DuplicationModifyRequest) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.Dupid = v
}
return nil
}
func (p *DuplicationModifyRequest) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
temp := DuplicationStatus(v)
p.Status = &temp
}
return nil
}
func (p *DuplicationModifyRequest) ReadField4(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 4: ", err)
} else {
temp := DuplicationFailMode(v)
p.FailMode = &temp
}
return nil
}
func (p *DuplicationModifyRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_modify_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 *DuplicationModifyRequest) 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 *DuplicationModifyRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("dupid", thrift.I32, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:dupid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Dupid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.dupid (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:dupid: ", p), err)
}
return err
}
func (p *DuplicationModifyRequest) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetStatus() {
if err := oprot.WriteFieldBegin("status", thrift.I32, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:status: ", p), err)
}
if err := oprot.WriteI32(int32(*p.Status)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.status (3) field write error: ", p), 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 *DuplicationModifyRequest) writeField4(oprot thrift.TProtocol) (err error) {
if p.IsSetFailMode() {
if err := oprot.WriteFieldBegin("fail_mode", thrift.I32, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:fail_mode: ", p), err)
}
if err := oprot.WriteI32(int32(*p.FailMode)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.fail_mode (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:fail_mode: ", p), err)
}
}
return err
}
func (p *DuplicationModifyRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationModifyRequest(%+v)", *p)
}
// Attributes:
// - Err
// - Appid
type DuplicationModifyResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
Appid int32 `thrift:"appid,2" db:"appid" json:"appid"`
}
func NewDuplicationModifyResponse() *DuplicationModifyResponse {
return &DuplicationModifyResponse{}
}
var DuplicationModifyResponse_Err_DEFAULT *base.ErrorCode
func (p *DuplicationModifyResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return DuplicationModifyResponse_Err_DEFAULT
}
return p.Err
}
func (p *DuplicationModifyResponse) GetAppid() int32 {
return p.Appid
}
func (p *DuplicationModifyResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *DuplicationModifyResponse) 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
}
}
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 *DuplicationModifyResponse) 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 *DuplicationModifyResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.Appid = v
}
return nil
}
func (p *DuplicationModifyResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_modify_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 *DuplicationModifyResponse) 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 *DuplicationModifyResponse) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("appid", thrift.I32, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:appid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Appid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.appid (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:appid: ", p), err)
}
return err
}
func (p *DuplicationModifyResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationModifyResponse(%+v)", *p)
}
// Attributes:
// - Dupid
// - Status
// - Remote
// - CreateTs
// - Progress
// - FailMode
// - RemoteAppName
// - RemoteReplicaCount
type DuplicationEntry struct {
Dupid int32 `thrift:"dupid,1" db:"dupid" json:"dupid"`
Status DuplicationStatus `thrift:"status,2" db:"status" json:"status"`
Remote string `thrift:"remote,3" db:"remote" json:"remote"`
CreateTs int64 `thrift:"create_ts,4" db:"create_ts" json:"create_ts"`
Progress map[int32]int64 `thrift:"progress,5" db:"progress" json:"progress,omitempty"`
// unused field # 6
FailMode *DuplicationFailMode `thrift:"fail_mode,7" db:"fail_mode" json:"fail_mode,omitempty"`
RemoteAppName *string `thrift:"remote_app_name,8" db:"remote_app_name" json:"remote_app_name,omitempty"`
RemoteReplicaCount *int32 `thrift:"remote_replica_count,9" db:"remote_replica_count" json:"remote_replica_count,omitempty"`
}
func NewDuplicationEntry() *DuplicationEntry {
return &DuplicationEntry{}
}
func (p *DuplicationEntry) GetDupid() int32 {
return p.Dupid
}
func (p *DuplicationEntry) GetStatus() DuplicationStatus {
return p.Status
}
func (p *DuplicationEntry) GetRemote() string {
return p.Remote
}
func (p *DuplicationEntry) GetCreateTs() int64 {
return p.CreateTs
}
var DuplicationEntry_Progress_DEFAULT map[int32]int64
func (p *DuplicationEntry) GetProgress() map[int32]int64 {
return p.Progress
}
var DuplicationEntry_FailMode_DEFAULT DuplicationFailMode
func (p *DuplicationEntry) GetFailMode() DuplicationFailMode {
if !p.IsSetFailMode() {
return DuplicationEntry_FailMode_DEFAULT
}
return *p.FailMode
}
var DuplicationEntry_RemoteAppName_DEFAULT string
func (p *DuplicationEntry) GetRemoteAppName() string {
if !p.IsSetRemoteAppName() {
return DuplicationEntry_RemoteAppName_DEFAULT
}
return *p.RemoteAppName
}
var DuplicationEntry_RemoteReplicaCount_DEFAULT int32
func (p *DuplicationEntry) GetRemoteReplicaCount() int32 {
if !p.IsSetRemoteReplicaCount() {
return DuplicationEntry_RemoteReplicaCount_DEFAULT
}
return *p.RemoteReplicaCount
}
func (p *DuplicationEntry) IsSetProgress() bool {
return p.Progress != nil
}
func (p *DuplicationEntry) IsSetFailMode() bool {
return p.FailMode != nil
}
func (p *DuplicationEntry) IsSetRemoteAppName() bool {
return p.RemoteAppName != nil
}
func (p *DuplicationEntry) IsSetRemoteReplicaCount() bool {
return p.RemoteReplicaCount != nil
}
func (p *DuplicationEntry) 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.I32 {
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.STRING {
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.MAP {
if err := p.ReadField5(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 7:
if fieldTypeId == thrift.I32 {
if err := p.ReadField7(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 8:
if fieldTypeId == thrift.STRING {
if err := p.ReadField8(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 9:
if fieldTypeId == thrift.I32 {
if err := p.ReadField9(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 *DuplicationEntry) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Dupid = v
}
return nil
}
func (p *DuplicationEntry) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
temp := DuplicationStatus(v)
p.Status = temp
}
return nil
}
func (p *DuplicationEntry) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.Remote = v
}
return nil
}
func (p *DuplicationEntry) ReadField4(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 4: ", err)
} else {
p.CreateTs = v
}
return nil
}
func (p *DuplicationEntry) ReadField5(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[int32]int64, size)
p.Progress = 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 int64
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_val1 = v
}
p.Progress[_key0] = _val1
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
func (p *DuplicationEntry) ReadField7(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 7: ", err)
} else {
temp := DuplicationFailMode(v)
p.FailMode = &temp
}
return nil
}
func (p *DuplicationEntry) ReadField8(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 8: ", err)
} else {
p.RemoteAppName = &v
}
return nil
}
func (p *DuplicationEntry) ReadField9(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 9: ", err)
} else {
p.RemoteReplicaCount = &v
}
return nil
}
func (p *DuplicationEntry) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_entry"); 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 := p.writeField7(oprot); err != nil {
return err
}
if err := p.writeField8(oprot); err != nil {
return err
}
if err := p.writeField9(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 *DuplicationEntry) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("dupid", thrift.I32, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:dupid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Dupid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.dupid (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:dupid: ", p), err)
}
return err
}
func (p *DuplicationEntry) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("status", thrift.I32, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:status: ", p), err)
}
if err := oprot.WriteI32(int32(p.Status)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.status (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:status: ", p), err)
}
return err
}
func (p *DuplicationEntry) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("remote", thrift.STRING, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:remote: ", p), err)
}
if err := oprot.WriteString(string(p.Remote)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:remote: ", p), err)
}
return err
}
func (p *DuplicationEntry) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("create_ts", thrift.I64, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:create_ts: ", p), err)
}
if err := oprot.WriteI64(int64(p.CreateTs)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.create_ts (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:create_ts: ", p), err)
}
return err
}
func (p *DuplicationEntry) writeField5(oprot thrift.TProtocol) (err error) {
if p.IsSetProgress() {
if err := oprot.WriteFieldBegin("progress", thrift.MAP, 5); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:progress: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.I32, thrift.I64, len(p.Progress)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.Progress {
if err := oprot.WriteI32(int32(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := oprot.WriteI64(int64(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 5:progress: ", p), err)
}
}
return err
}
func (p *DuplicationEntry) writeField7(oprot thrift.TProtocol) (err error) {
if p.IsSetFailMode() {
if err := oprot.WriteFieldBegin("fail_mode", thrift.I32, 7); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:fail_mode: ", p), err)
}
if err := oprot.WriteI32(int32(*p.FailMode)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.fail_mode (7) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 7:fail_mode: ", p), err)
}
}
return err
}
func (p *DuplicationEntry) writeField8(oprot thrift.TProtocol) (err error) {
if p.IsSetRemoteAppName() {
if err := oprot.WriteFieldBegin("remote_app_name", thrift.STRING, 8); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:remote_app_name: ", p), err)
}
if err := oprot.WriteString(string(*p.RemoteAppName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_app_name (8) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 8:remote_app_name: ", p), err)
}
}
return err
}
func (p *DuplicationEntry) writeField9(oprot thrift.TProtocol) (err error) {
if p.IsSetRemoteReplicaCount() {
if err := oprot.WriteFieldBegin("remote_replica_count", thrift.I32, 9); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:remote_replica_count: ", p), err)
}
if err := oprot.WriteI32(int32(*p.RemoteReplicaCount)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.remote_replica_count (9) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 9:remote_replica_count: ", p), err)
}
}
return err
}
func (p *DuplicationEntry) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationEntry(%+v)", *p)
}
// Attributes:
// - AppName
type DuplicationQueryRequest struct {
AppName string `thrift:"app_name,1" db:"app_name" json:"app_name"`
}
func NewDuplicationQueryRequest() *DuplicationQueryRequest {
return &DuplicationQueryRequest{}
}
func (p *DuplicationQueryRequest) GetAppName() string {
return p.AppName
}
func (p *DuplicationQueryRequest) 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 *DuplicationQueryRequest) 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 *DuplicationQueryRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_query_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 *DuplicationQueryRequest) 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 *DuplicationQueryRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationQueryRequest(%+v)", *p)
}
// Attributes:
// - Err
// - Appid
// - EntryList
type DuplicationQueryResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
// unused field # 2
Appid int32 `thrift:"appid,3" db:"appid" json:"appid"`
EntryList []*DuplicationEntry `thrift:"entry_list,4" db:"entry_list" json:"entry_list"`
}
func NewDuplicationQueryResponse() *DuplicationQueryResponse {
return &DuplicationQueryResponse{}
}
var DuplicationQueryResponse_Err_DEFAULT *base.ErrorCode
func (p *DuplicationQueryResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return DuplicationQueryResponse_Err_DEFAULT
}
return p.Err
}
func (p *DuplicationQueryResponse) GetAppid() int32 {
return p.Appid
}
func (p *DuplicationQueryResponse) GetEntryList() []*DuplicationEntry {
return p.EntryList
}
func (p *DuplicationQueryResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *DuplicationQueryResponse) 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 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.LIST {
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 *DuplicationQueryResponse) 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 *DuplicationQueryResponse) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.Appid = v
}
return nil
}
func (p *DuplicationQueryResponse) ReadField4(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return thrift.PrependError("error reading list begin: ", err)
}
tSlice := make([]*DuplicationEntry, 0, size)
p.EntryList = tSlice
for i := 0; i < size; i++ {
_elem2 := &DuplicationEntry{}
if err := _elem2.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err)
}
p.EntryList = append(p.EntryList, _elem2)
}
if err := iprot.ReadListEnd(); err != nil {
return thrift.PrependError("error reading list end: ", err)
}
return nil
}
func (p *DuplicationQueryResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_query_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.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 *DuplicationQueryResponse) 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 *DuplicationQueryResponse) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("appid", thrift.I32, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:appid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Appid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.appid (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:appid: ", p), err)
}
return err
}
func (p *DuplicationQueryResponse) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("entry_list", thrift.LIST, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:entry_list: ", p), err)
}
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.EntryList)); err != nil {
return thrift.PrependError("error writing list begin: ", err)
}
for _, v := range p.EntryList {
if err := v.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
}
}
if err := oprot.WriteListEnd(); err != nil {
return thrift.PrependError("error writing list end: ", err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:entry_list: ", p), err)
}
return err
}
func (p *DuplicationQueryResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationQueryResponse(%+v)", *p)
}
// Attributes:
// - Dupid
// - ConfirmedDecree
// - CheckpointPrepared
type DuplicationConfirmEntry struct {
Dupid int32 `thrift:"dupid,1" db:"dupid" json:"dupid"`
ConfirmedDecree int64 `thrift:"confirmed_decree,2" db:"confirmed_decree" json:"confirmed_decree"`
CheckpointPrepared bool `thrift:"checkpoint_prepared,3" db:"checkpoint_prepared" json:"checkpoint_prepared"`
}
func NewDuplicationConfirmEntry() *DuplicationConfirmEntry {
return &DuplicationConfirmEntry{}
}
func (p *DuplicationConfirmEntry) GetDupid() int32 {
return p.Dupid
}
func (p *DuplicationConfirmEntry) GetConfirmedDecree() int64 {
return p.ConfirmedDecree
}
var DuplicationConfirmEntry_CheckpointPrepared_DEFAULT bool = false
func (p *DuplicationConfirmEntry) GetCheckpointPrepared() bool {
return p.CheckpointPrepared
}
func (p *DuplicationConfirmEntry) IsSetCheckpointPrepared() bool {
return p.CheckpointPrepared != DuplicationConfirmEntry_CheckpointPrepared_DEFAULT
}
func (p *DuplicationConfirmEntry) 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.I32 {
if err := p.ReadField1(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 2:
if fieldTypeId == thrift.I64 {
if err := p.ReadField2(iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(fieldTypeId); err != nil {
return err
}
}
case 3:
if fieldTypeId == thrift.BOOL {
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 *DuplicationConfirmEntry) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Dupid = v
}
return nil
}
func (p *DuplicationConfirmEntry) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.ConfirmedDecree = v
}
return nil
}
func (p *DuplicationConfirmEntry) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadBool(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.CheckpointPrepared = v
}
return nil
}
func (p *DuplicationConfirmEntry) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_confirm_entry"); 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 *DuplicationConfirmEntry) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("dupid", thrift.I32, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:dupid: ", p), err)
}
if err := oprot.WriteI32(int32(p.Dupid)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.dupid (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:dupid: ", p), err)
}
return err
}
func (p *DuplicationConfirmEntry) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("confirmed_decree", thrift.I64, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:confirmed_decree: ", p), err)
}
if err := oprot.WriteI64(int64(p.ConfirmedDecree)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.confirmed_decree (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:confirmed_decree: ", p), err)
}
return err
}
func (p *DuplicationConfirmEntry) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetCheckpointPrepared() {
if err := oprot.WriteFieldBegin("checkpoint_prepared", thrift.BOOL, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:checkpoint_prepared: ", p), err)
}
if err := oprot.WriteBool(bool(p.CheckpointPrepared)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.checkpoint_prepared (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:checkpoint_prepared: ", p), err)
}
}
return err
}
func (p *DuplicationConfirmEntry) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationConfirmEntry(%+v)", *p)
}
// Attributes:
// - Node
// - ConfirmList
// - HpNode
type DuplicationSyncRequest struct {
Node *base.RPCAddress `thrift:"node,1" db:"node" json:"node"`
ConfirmList map[*base.Gpid][]*DuplicationConfirmEntry `thrift:"confirm_list,2" db:"confirm_list" json:"confirm_list"`
HpNode *base.HostPort `thrift:"hp_node,3" db:"hp_node" json:"hp_node"`
}
func NewDuplicationSyncRequest() *DuplicationSyncRequest {
return &DuplicationSyncRequest{}
}
var DuplicationSyncRequest_Node_DEFAULT *base.RPCAddress
func (p *DuplicationSyncRequest) GetNode() *base.RPCAddress {
if !p.IsSetNode() {
return DuplicationSyncRequest_Node_DEFAULT
}
return p.Node
}
func (p *DuplicationSyncRequest) GetConfirmList() map[*base.Gpid][]*DuplicationConfirmEntry {
return p.ConfirmList
}
var DuplicationSyncRequest_HpNode_DEFAULT *base.HostPort
func (p *DuplicationSyncRequest) GetHpNode() *base.HostPort {
if !p.IsSetHpNode() {
return DuplicationSyncRequest_HpNode_DEFAULT
}
return p.HpNode
}
func (p *DuplicationSyncRequest) IsSetNode() bool {
return p.Node != nil
}
func (p *DuplicationSyncRequest) IsSetHpNode() bool {
return p.HpNode != nil
}
func (p *DuplicationSyncRequest) 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.MAP {
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 *DuplicationSyncRequest) ReadField1(iprot thrift.TProtocol) error {
p.Node = &base.RPCAddress{}
if err := p.Node.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Node), err)
}
return nil
}
func (p *DuplicationSyncRequest) ReadField2(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[*base.Gpid][]*DuplicationConfirmEntry, size)
p.ConfirmList = tMap
for i := 0; i < size; i++ {
_key3 := &base.Gpid{}
if err := _key3.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _key3), err)
}
_, size, err := iprot.ReadListBegin()
if err != nil {
return thrift.PrependError("error reading list begin: ", err)
}
tSlice := make([]*DuplicationConfirmEntry, 0, size)
_val4 := tSlice
for i := 0; i < size; i++ {
_elem5 := &DuplicationConfirmEntry{}
if err := _elem5.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem5), err)
}
_val4 = append(_val4, _elem5)
}
if err := iprot.ReadListEnd(); err != nil {
return thrift.PrependError("error reading list end: ", err)
}
p.ConfirmList[_key3] = _val4
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
func (p *DuplicationSyncRequest) ReadField3(iprot thrift.TProtocol) error {
p.HpNode = &base.HostPort{}
if err := p.HpNode.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpNode), err)
}
return nil
}
func (p *DuplicationSyncRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_sync_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 *DuplicationSyncRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("node", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:node: ", p), err)
}
if err := p.Node.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Node), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:node: ", p), err)
}
return err
}
func (p *DuplicationSyncRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("confirm_list", thrift.MAP, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:confirm_list: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.STRUCT, thrift.LIST, len(p.ConfirmList)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.ConfirmList {
if err := k.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", k), err)
}
if err := oprot.WriteListBegin(thrift.STRUCT, len(v)); err != nil {
return thrift.PrependError("error writing list begin: ", err)
}
for _, v := range v {
if err := v.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
}
}
if err := oprot.WriteListEnd(); err != nil {
return thrift.PrependError("error writing list end: ", 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 2:confirm_list: ", p), err)
}
return err
}
func (p *DuplicationSyncRequest) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("hp_node", thrift.STRUCT, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:hp_node: ", p), err)
}
if err := p.HpNode.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpNode), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:hp_node: ", p), err)
}
return err
}
func (p *DuplicationSyncRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationSyncRequest(%+v)", *p)
}
// Attributes:
// - Err
// - DupMap
type DuplicationSyncResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
DupMap map[int32]map[int32]*DuplicationEntry `thrift:"dup_map,2" db:"dup_map" json:"dup_map"`
}
func NewDuplicationSyncResponse() *DuplicationSyncResponse {
return &DuplicationSyncResponse{}
}
var DuplicationSyncResponse_Err_DEFAULT *base.ErrorCode
func (p *DuplicationSyncResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return DuplicationSyncResponse_Err_DEFAULT
}
return p.Err
}
func (p *DuplicationSyncResponse) GetDupMap() map[int32]map[int32]*DuplicationEntry {
return p.DupMap
}
func (p *DuplicationSyncResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *DuplicationSyncResponse) 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.MAP {
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 *DuplicationSyncResponse) 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 *DuplicationSyncResponse) ReadField2(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[int32]map[int32]*DuplicationEntry, size)
p.DupMap = tMap
for i := 0; i < size; i++ {
var _key6 int32
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key6 = v
}
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[int32]*DuplicationEntry, size)
_val7 := tMap
for i := 0; i < size; i++ {
var _key8 int32
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key8 = v
}
_val9 := &DuplicationEntry{}
if err := _val9.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val9), err)
}
_val7[_key8] = _val9
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
p.DupMap[_key6] = _val7
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
func (p *DuplicationSyncResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("duplication_sync_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 *DuplicationSyncResponse) 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 *DuplicationSyncResponse) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("dup_map", thrift.MAP, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:dup_map: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.I32, thrift.MAP, len(p.DupMap)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.DupMap {
if err := oprot.WriteI32(int32(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.I32, thrift.STRUCT, len(v)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range v {
if err := oprot.WriteI32(int32(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := v.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err)
}
}
if err := oprot.WriteMapEnd(); err != nil {
return thrift.PrependError("error writing map end: ", 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 2:dup_map: ", p), err)
}
return err
}
func (p *DuplicationSyncResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DuplicationSyncResponse(%+v)", *p)
}