go-client/idl/radmin/replica_admin.go (3,275 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 radmin
import (
"bytes"
"context"
"database/sql/driver"
"errors"
"fmt"
"github.com/apache/incubator-pegasus/go-client/idl/admin"
"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__
var _ = admin.GoUnusedProtection__
type DiskMigrationStatus int64
const (
DiskMigrationStatus_IDLE DiskMigrationStatus = 0
DiskMigrationStatus_MOVING DiskMigrationStatus = 1
DiskMigrationStatus_MOVED DiskMigrationStatus = 2
DiskMigrationStatus_CLOSED DiskMigrationStatus = 3
)
func (p DiskMigrationStatus) String() string {
switch p {
case DiskMigrationStatus_IDLE:
return "IDLE"
case DiskMigrationStatus_MOVING:
return "MOVING"
case DiskMigrationStatus_MOVED:
return "MOVED"
case DiskMigrationStatus_CLOSED:
return "CLOSED"
}
return "<UNSET>"
}
func DiskMigrationStatusFromString(s string) (DiskMigrationStatus, error) {
switch s {
case "IDLE":
return DiskMigrationStatus_IDLE, nil
case "MOVING":
return DiskMigrationStatus_MOVING, nil
case "MOVED":
return DiskMigrationStatus_MOVED, nil
case "CLOSED":
return DiskMigrationStatus_CLOSED, nil
}
return DiskMigrationStatus(0), fmt.Errorf("not a valid DiskMigrationStatus string")
}
func DiskMigrationStatusPtr(v DiskMigrationStatus) *DiskMigrationStatus { return &v }
func (p DiskMigrationStatus) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
func (p *DiskMigrationStatus) UnmarshalText(text []byte) error {
q, err := DiskMigrationStatusFromString(string(text))
if err != nil {
return err
}
*p = q
return nil
}
func (p *DiskMigrationStatus) Scan(value interface{}) error {
v, ok := value.(int64)
if !ok {
return errors.New("Scan value is not int64")
}
*p = DiskMigrationStatus(v)
return nil
}
func (p *DiskMigrationStatus) Value() (driver.Value, error) {
if p == nil {
return nil, nil
}
return int64(*p), nil
}
type HotkeyType int64
const (
HotkeyType_READ HotkeyType = 0
HotkeyType_WRITE HotkeyType = 1
)
func (p HotkeyType) String() string {
switch p {
case HotkeyType_READ:
return "READ"
case HotkeyType_WRITE:
return "WRITE"
}
return "<UNSET>"
}
func HotkeyTypeFromString(s string) (HotkeyType, error) {
switch s {
case "READ":
return HotkeyType_READ, nil
case "WRITE":
return HotkeyType_WRITE, nil
}
return HotkeyType(0), fmt.Errorf("not a valid HotkeyType string")
}
func HotkeyTypePtr(v HotkeyType) *HotkeyType { return &v }
func (p HotkeyType) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
func (p *HotkeyType) UnmarshalText(text []byte) error {
q, err := HotkeyTypeFromString(string(text))
if err != nil {
return err
}
*p = q
return nil
}
func (p *HotkeyType) Scan(value interface{}) error {
v, ok := value.(int64)
if !ok {
return errors.New("Scan value is not int64")
}
*p = HotkeyType(v)
return nil
}
func (p *HotkeyType) Value() (driver.Value, error) {
if p == nil {
return nil, nil
}
return int64(*p), nil
}
type DetectAction int64
const (
DetectAction_START DetectAction = 0
DetectAction_STOP DetectAction = 1
DetectAction_QUERY DetectAction = 2
)
func (p DetectAction) String() string {
switch p {
case DetectAction_START:
return "START"
case DetectAction_STOP:
return "STOP"
case DetectAction_QUERY:
return "QUERY"
}
return "<UNSET>"
}
func DetectActionFromString(s string) (DetectAction, error) {
switch s {
case "START":
return DetectAction_START, nil
case "STOP":
return DetectAction_STOP, nil
case "QUERY":
return DetectAction_QUERY, nil
}
return DetectAction(0), fmt.Errorf("not a valid DetectAction string")
}
func DetectActionPtr(v DetectAction) *DetectAction { return &v }
func (p DetectAction) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
func (p *DetectAction) UnmarshalText(text []byte) error {
q, err := DetectActionFromString(string(text))
if err != nil {
return err
}
*p = q
return nil
}
func (p *DetectAction) Scan(value interface{}) error {
v, ok := value.(int64)
if !ok {
return errors.New("Scan value is not int64")
}
*p = DetectAction(v)
return nil
}
func (p *DetectAction) Value() (driver.Value, error) {
if p == nil {
return nil, nil
}
return int64(*p), nil
}
// Attributes:
// - Pid
// - Node1
// - HpNode1
type QueryReplicaDecreeRequest struct {
Pid *base.Gpid `thrift:"pid,1" db:"pid" json:"pid"`
Node1 *base.RPCAddress `thrift:"node1,2" db:"node1" json:"node1"`
HpNode1 *base.HostPort `thrift:"hp_node1,3" db:"hp_node1" json:"hp_node1,omitempty"`
}
func NewQueryReplicaDecreeRequest() *QueryReplicaDecreeRequest {
return &QueryReplicaDecreeRequest{}
}
var QueryReplicaDecreeRequest_Pid_DEFAULT *base.Gpid
func (p *QueryReplicaDecreeRequest) GetPid() *base.Gpid {
if !p.IsSetPid() {
return QueryReplicaDecreeRequest_Pid_DEFAULT
}
return p.Pid
}
var QueryReplicaDecreeRequest_Node1_DEFAULT *base.RPCAddress
func (p *QueryReplicaDecreeRequest) GetNode1() *base.RPCAddress {
if !p.IsSetNode1() {
return QueryReplicaDecreeRequest_Node1_DEFAULT
}
return p.Node1
}
var QueryReplicaDecreeRequest_HpNode1_DEFAULT *base.HostPort
func (p *QueryReplicaDecreeRequest) GetHpNode1() *base.HostPort {
if !p.IsSetHpNode1() {
return QueryReplicaDecreeRequest_HpNode1_DEFAULT
}
return p.HpNode1
}
func (p *QueryReplicaDecreeRequest) IsSetPid() bool {
return p.Pid != nil
}
func (p *QueryReplicaDecreeRequest) IsSetNode1() bool {
return p.Node1 != nil
}
func (p *QueryReplicaDecreeRequest) IsSetHpNode1() bool {
return p.HpNode1 != nil
}
func (p *QueryReplicaDecreeRequest) 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
}
}
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 *QueryReplicaDecreeRequest) ReadField1(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 *QueryReplicaDecreeRequest) ReadField2(iprot thrift.TProtocol) error {
p.Node1 = &base.RPCAddress{}
if err := p.Node1.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Node1), err)
}
return nil
}
func (p *QueryReplicaDecreeRequest) ReadField3(iprot thrift.TProtocol) error {
p.HpNode1 = &base.HostPort{}
if err := p.HpNode1.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpNode1), err)
}
return nil
}
func (p *QueryReplicaDecreeRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_replica_decree_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 *QueryReplicaDecreeRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("pid", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1: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 1:pid: ", p), err)
}
return err
}
func (p *QueryReplicaDecreeRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("node1", thrift.STRUCT, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:node1: ", p), err)
}
if err := p.Node1.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Node1), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:node1: ", p), err)
}
return err
}
func (p *QueryReplicaDecreeRequest) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetHpNode1() {
if err := oprot.WriteFieldBegin("hp_node1", thrift.STRUCT, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:hp_node1: ", p), err)
}
if err := p.HpNode1.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpNode1), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:hp_node1: ", p), err)
}
}
return err
}
func (p *QueryReplicaDecreeRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("QueryReplicaDecreeRequest(%+v)", *p)
}
// Attributes:
// - Err
// - LastDecree
type QueryReplicaDecreeResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
LastDecree int64 `thrift:"last_decree,2" db:"last_decree" json:"last_decree"`
}
func NewQueryReplicaDecreeResponse() *QueryReplicaDecreeResponse {
return &QueryReplicaDecreeResponse{}
}
var QueryReplicaDecreeResponse_Err_DEFAULT *base.ErrorCode
func (p *QueryReplicaDecreeResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return QueryReplicaDecreeResponse_Err_DEFAULT
}
return p.Err
}
func (p *QueryReplicaDecreeResponse) GetLastDecree() int64 {
return p.LastDecree
}
func (p *QueryReplicaDecreeResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *QueryReplicaDecreeResponse) 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.I64 {
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 *QueryReplicaDecreeResponse) 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 *QueryReplicaDecreeResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.LastDecree = v
}
return nil
}
func (p *QueryReplicaDecreeResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_replica_decree_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 *QueryReplicaDecreeResponse) 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 *QueryReplicaDecreeResponse) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("last_decree", thrift.I64, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:last_decree: ", p), err)
}
if err := oprot.WriteI64(int64(p.LastDecree)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.last_decree (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:last_decree: ", p), err)
}
return err
}
func (p *QueryReplicaDecreeResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("QueryReplicaDecreeResponse(%+v)", *p)
}
// Attributes:
// - Node1
// - HpNode1
type QueryReplicaInfoRequest struct {
Node1 *base.RPCAddress `thrift:"node1,1" db:"node1" json:"node1"`
HpNode1 *base.HostPort `thrift:"hp_node1,2" db:"hp_node1" json:"hp_node1,omitempty"`
}
func NewQueryReplicaInfoRequest() *QueryReplicaInfoRequest {
return &QueryReplicaInfoRequest{}
}
var QueryReplicaInfoRequest_Node1_DEFAULT *base.RPCAddress
func (p *QueryReplicaInfoRequest) GetNode1() *base.RPCAddress {
if !p.IsSetNode1() {
return QueryReplicaInfoRequest_Node1_DEFAULT
}
return p.Node1
}
var QueryReplicaInfoRequest_HpNode1_DEFAULT *base.HostPort
func (p *QueryReplicaInfoRequest) GetHpNode1() *base.HostPort {
if !p.IsSetHpNode1() {
return QueryReplicaInfoRequest_HpNode1_DEFAULT
}
return p.HpNode1
}
func (p *QueryReplicaInfoRequest) IsSetNode1() bool {
return p.Node1 != nil
}
func (p *QueryReplicaInfoRequest) IsSetHpNode1() bool {
return p.HpNode1 != nil
}
func (p *QueryReplicaInfoRequest) 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
}
}
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 *QueryReplicaInfoRequest) ReadField1(iprot thrift.TProtocol) error {
p.Node1 = &base.RPCAddress{}
if err := p.Node1.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Node1), err)
}
return nil
}
func (p *QueryReplicaInfoRequest) ReadField2(iprot thrift.TProtocol) error {
p.HpNode1 = &base.HostPort{}
if err := p.HpNode1.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpNode1), err)
}
return nil
}
func (p *QueryReplicaInfoRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_replica_info_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 *QueryReplicaInfoRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("node1", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:node1: ", p), err)
}
if err := p.Node1.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Node1), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:node1: ", p), err)
}
return err
}
func (p *QueryReplicaInfoRequest) writeField2(oprot thrift.TProtocol) (err error) {
if p.IsSetHpNode1() {
if err := oprot.WriteFieldBegin("hp_node1", thrift.STRUCT, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hp_node1: ", p), err)
}
if err := p.HpNode1.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpNode1), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hp_node1: ", p), err)
}
}
return err
}
func (p *QueryReplicaInfoRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("QueryReplicaInfoRequest(%+v)", *p)
}
// Attributes:
// - Err
// - Replicas
type QueryReplicaInfoResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
Replicas []*admin.ReplicaInfo `thrift:"replicas,2" db:"replicas" json:"replicas"`
}
func NewQueryReplicaInfoResponse() *QueryReplicaInfoResponse {
return &QueryReplicaInfoResponse{}
}
var QueryReplicaInfoResponse_Err_DEFAULT *base.ErrorCode
func (p *QueryReplicaInfoResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return QueryReplicaInfoResponse_Err_DEFAULT
}
return p.Err
}
func (p *QueryReplicaInfoResponse) GetReplicas() []*admin.ReplicaInfo {
return p.Replicas
}
func (p *QueryReplicaInfoResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *QueryReplicaInfoResponse) 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.LIST {
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 *QueryReplicaInfoResponse) 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 *QueryReplicaInfoResponse) ReadField2(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return thrift.PrependError("error reading list begin: ", err)
}
tSlice := make([]*admin.ReplicaInfo, 0, size)
p.Replicas = tSlice
for i := 0; i < size; i++ {
_elem0 := &admin.ReplicaInfo{}
if err := _elem0.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err)
}
p.Replicas = append(p.Replicas, _elem0)
}
if err := iprot.ReadListEnd(); err != nil {
return thrift.PrependError("error reading list end: ", err)
}
return nil
}
func (p *QueryReplicaInfoResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_replica_info_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 *QueryReplicaInfoResponse) 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 *QueryReplicaInfoResponse) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("replicas", thrift.LIST, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:replicas: ", p), err)
}
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Replicas)); err != nil {
return thrift.PrependError("error writing list begin: ", err)
}
for _, v := range p.Replicas {
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 2:replicas: ", p), err)
}
return err
}
func (p *QueryReplicaInfoResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("QueryReplicaInfoResponse(%+v)", *p)
}
// Attributes:
// - Tag
// - FullDir
// - DiskCapacityMb
// - DiskAvailableMb
// - HoldingPrimaryReplicas
// - HoldingSecondaryReplicas
type DiskInfo struct {
Tag string `thrift:"tag,1" db:"tag" json:"tag"`
FullDir string `thrift:"full_dir,2" db:"full_dir" json:"full_dir"`
DiskCapacityMb int64 `thrift:"disk_capacity_mb,3" db:"disk_capacity_mb" json:"disk_capacity_mb"`
DiskAvailableMb int64 `thrift:"disk_available_mb,4" db:"disk_available_mb" json:"disk_available_mb"`
HoldingPrimaryReplicas map[int32][]*base.Gpid `thrift:"holding_primary_replicas,5" db:"holding_primary_replicas" json:"holding_primary_replicas"`
HoldingSecondaryReplicas map[int32][]*base.Gpid `thrift:"holding_secondary_replicas,6" db:"holding_secondary_replicas" json:"holding_secondary_replicas"`
}
func NewDiskInfo() *DiskInfo {
return &DiskInfo{}
}
func (p *DiskInfo) GetTag() string {
return p.Tag
}
func (p *DiskInfo) GetFullDir() string {
return p.FullDir
}
func (p *DiskInfo) GetDiskCapacityMb() int64 {
return p.DiskCapacityMb
}
func (p *DiskInfo) GetDiskAvailableMb() int64 {
return p.DiskAvailableMb
}
func (p *DiskInfo) GetHoldingPrimaryReplicas() map[int32][]*base.Gpid {
return p.HoldingPrimaryReplicas
}
func (p *DiskInfo) GetHoldingSecondaryReplicas() map[int32][]*base.Gpid {
return p.HoldingSecondaryReplicas
}
func (p *DiskInfo) 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.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.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 6:
if fieldTypeId == thrift.MAP {
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 *DiskInfo) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Tag = v
}
return nil
}
func (p *DiskInfo) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.FullDir = v
}
return nil
}
func (p *DiskInfo) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.DiskCapacityMb = v
}
return nil
}
func (p *DiskInfo) ReadField4(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 4: ", err)
} else {
p.DiskAvailableMb = v
}
return nil
}
func (p *DiskInfo) ReadField5(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[int32][]*base.Gpid, size)
p.HoldingPrimaryReplicas = tMap
for i := 0; i < size; i++ {
var _key1 int32
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key1 = v
}
_, size, err := iprot.ReadSetBegin()
if err != nil {
return thrift.PrependError("error reading set begin: ", err)
}
tSet := make([]*base.Gpid, 0, size)
_val2 := tSet
for i := 0; i < size; i++ {
_elem3 := &base.Gpid{}
if err := _elem3.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err)
}
_val2 = append(_val2, _elem3)
}
if err := iprot.ReadSetEnd(); err != nil {
return thrift.PrependError("error reading set end: ", err)
}
p.HoldingPrimaryReplicas[_key1] = _val2
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
func (p *DiskInfo) ReadField6(iprot thrift.TProtocol) error {
_, _, size, err := iprot.ReadMapBegin()
if err != nil {
return thrift.PrependError("error reading map begin: ", err)
}
tMap := make(map[int32][]*base.Gpid, size)
p.HoldingSecondaryReplicas = tMap
for i := 0; i < size; i++ {
var _key4 int32
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 0: ", err)
} else {
_key4 = v
}
_, size, err := iprot.ReadSetBegin()
if err != nil {
return thrift.PrependError("error reading set begin: ", err)
}
tSet := make([]*base.Gpid, 0, size)
_val5 := tSet
for i := 0; i < size; i++ {
_elem6 := &base.Gpid{}
if err := _elem6.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem6), err)
}
_val5 = append(_val5, _elem6)
}
if err := iprot.ReadSetEnd(); err != nil {
return thrift.PrependError("error reading set end: ", err)
}
p.HoldingSecondaryReplicas[_key4] = _val5
}
if err := iprot.ReadMapEnd(); err != nil {
return thrift.PrependError("error reading map end: ", err)
}
return nil
}
func (p *DiskInfo) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("disk_info"); 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 *DiskInfo) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("tag", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:tag: ", p), err)
}
if err := oprot.WriteString(string(p.Tag)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.tag (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:tag: ", p), err)
}
return err
}
func (p *DiskInfo) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("full_dir", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:full_dir: ", p), err)
}
if err := oprot.WriteString(string(p.FullDir)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.full_dir (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:full_dir: ", p), err)
}
return err
}
func (p *DiskInfo) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("disk_capacity_mb", thrift.I64, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:disk_capacity_mb: ", p), err)
}
if err := oprot.WriteI64(int64(p.DiskCapacityMb)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.disk_capacity_mb (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:disk_capacity_mb: ", p), err)
}
return err
}
func (p *DiskInfo) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("disk_available_mb", thrift.I64, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:disk_available_mb: ", p), err)
}
if err := oprot.WriteI64(int64(p.DiskAvailableMb)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.disk_available_mb (4) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:disk_available_mb: ", p), err)
}
return err
}
func (p *DiskInfo) writeField5(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("holding_primary_replicas", thrift.MAP, 5); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:holding_primary_replicas: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.I32, thrift.SET, len(p.HoldingPrimaryReplicas)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.HoldingPrimaryReplicas {
if err := oprot.WriteI32(int32(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := oprot.WriteSetBegin(thrift.STRUCT, len(v)); err != nil {
return thrift.PrependError("error writing set begin: ", err)
}
for i := 0; i < len(v); i++ {
for j := i + 1; j < len(v); j++ {
if reflect.DeepEqual(v[i], v[j]) {
return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", v[i]))
}
}
}
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.WriteSetEnd(); err != nil {
return thrift.PrependError("error writing set 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 5:holding_primary_replicas: ", p), err)
}
return err
}
func (p *DiskInfo) writeField6(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("holding_secondary_replicas", thrift.MAP, 6); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:holding_secondary_replicas: ", p), err)
}
if err := oprot.WriteMapBegin(thrift.I32, thrift.SET, len(p.HoldingSecondaryReplicas)); err != nil {
return thrift.PrependError("error writing map begin: ", err)
}
for k, v := range p.HoldingSecondaryReplicas {
if err := oprot.WriteI32(int32(k)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err)
}
if err := oprot.WriteSetBegin(thrift.STRUCT, len(v)); err != nil {
return thrift.PrependError("error writing set begin: ", err)
}
for i := 0; i < len(v); i++ {
for j := i + 1; j < len(v); j++ {
if reflect.DeepEqual(v[i], v[j]) {
return thrift.PrependError("", fmt.Errorf("%T error writing set field: slice is not unique", v[i]))
}
}
}
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.WriteSetEnd(); err != nil {
return thrift.PrependError("error writing set 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 6:holding_secondary_replicas: ", p), err)
}
return err
}
func (p *DiskInfo) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DiskInfo(%+v)", *p)
}
// Attributes:
// - Node1
// - AppName
// - HpNode1
type QueryDiskInfoRequest struct {
Node1 *base.RPCAddress `thrift:"node1,1" db:"node1" json:"node1"`
AppName string `thrift:"app_name,2" db:"app_name" json:"app_name"`
HpNode1 *base.HostPort `thrift:"hp_node1,3" db:"hp_node1" json:"hp_node1,omitempty"`
}
func NewQueryDiskInfoRequest() *QueryDiskInfoRequest {
return &QueryDiskInfoRequest{}
}
var QueryDiskInfoRequest_Node1_DEFAULT *base.RPCAddress
func (p *QueryDiskInfoRequest) GetNode1() *base.RPCAddress {
if !p.IsSetNode1() {
return QueryDiskInfoRequest_Node1_DEFAULT
}
return p.Node1
}
func (p *QueryDiskInfoRequest) GetAppName() string {
return p.AppName
}
var QueryDiskInfoRequest_HpNode1_DEFAULT *base.HostPort
func (p *QueryDiskInfoRequest) GetHpNode1() *base.HostPort {
if !p.IsSetHpNode1() {
return QueryDiskInfoRequest_HpNode1_DEFAULT
}
return p.HpNode1
}
func (p *QueryDiskInfoRequest) IsSetNode1() bool {
return p.Node1 != nil
}
func (p *QueryDiskInfoRequest) IsSetHpNode1() bool {
return p.HpNode1 != nil
}
func (p *QueryDiskInfoRequest) 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
}
}
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 *QueryDiskInfoRequest) ReadField1(iprot thrift.TProtocol) error {
p.Node1 = &base.RPCAddress{}
if err := p.Node1.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Node1), err)
}
return nil
}
func (p *QueryDiskInfoRequest) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.AppName = v
}
return nil
}
func (p *QueryDiskInfoRequest) ReadField3(iprot thrift.TProtocol) error {
p.HpNode1 = &base.HostPort{}
if err := p.HpNode1.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.HpNode1), err)
}
return nil
}
func (p *QueryDiskInfoRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_disk_info_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 *QueryDiskInfoRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("node1", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:node1: ", p), err)
}
if err := p.Node1.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Node1), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:node1: ", p), err)
}
return err
}
func (p *QueryDiskInfoRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("app_name", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:app_name: ", p), err)
}
if err := oprot.WriteString(string(p.AppName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.app_name (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:app_name: ", p), err)
}
return err
}
func (p *QueryDiskInfoRequest) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetHpNode1() {
if err := oprot.WriteFieldBegin("hp_node1", thrift.STRUCT, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:hp_node1: ", p), err)
}
if err := p.HpNode1.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.HpNode1), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:hp_node1: ", p), err)
}
}
return err
}
func (p *QueryDiskInfoRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("QueryDiskInfoRequest(%+v)", *p)
}
// Attributes:
// - Err
// - TotalCapacityMb
// - TotalAvailableMb
// - DiskInfos
type QueryDiskInfoResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
TotalCapacityMb int64 `thrift:"total_capacity_mb,2" db:"total_capacity_mb" json:"total_capacity_mb"`
TotalAvailableMb int64 `thrift:"total_available_mb,3" db:"total_available_mb" json:"total_available_mb"`
DiskInfos []*DiskInfo `thrift:"disk_infos,4" db:"disk_infos" json:"disk_infos"`
}
func NewQueryDiskInfoResponse() *QueryDiskInfoResponse {
return &QueryDiskInfoResponse{}
}
var QueryDiskInfoResponse_Err_DEFAULT *base.ErrorCode
func (p *QueryDiskInfoResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return QueryDiskInfoResponse_Err_DEFAULT
}
return p.Err
}
func (p *QueryDiskInfoResponse) GetTotalCapacityMb() int64 {
return p.TotalCapacityMb
}
func (p *QueryDiskInfoResponse) GetTotalAvailableMb() int64 {
return p.TotalAvailableMb
}
func (p *QueryDiskInfoResponse) GetDiskInfos() []*DiskInfo {
return p.DiskInfos
}
func (p *QueryDiskInfoResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *QueryDiskInfoResponse) 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.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.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.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 *QueryDiskInfoResponse) 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 *QueryDiskInfoResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.TotalCapacityMb = v
}
return nil
}
func (p *QueryDiskInfoResponse) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.TotalAvailableMb = v
}
return nil
}
func (p *QueryDiskInfoResponse) ReadField4(iprot thrift.TProtocol) error {
_, size, err := iprot.ReadListBegin()
if err != nil {
return thrift.PrependError("error reading list begin: ", err)
}
tSlice := make([]*DiskInfo, 0, size)
p.DiskInfos = tSlice
for i := 0; i < size; i++ {
_elem7 := &DiskInfo{}
if err := _elem7.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem7), err)
}
p.DiskInfos = append(p.DiskInfos, _elem7)
}
if err := iprot.ReadListEnd(); err != nil {
return thrift.PrependError("error reading list end: ", err)
}
return nil
}
func (p *QueryDiskInfoResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_disk_info_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 *QueryDiskInfoResponse) 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 *QueryDiskInfoResponse) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("total_capacity_mb", thrift.I64, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:total_capacity_mb: ", p), err)
}
if err := oprot.WriteI64(int64(p.TotalCapacityMb)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.total_capacity_mb (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:total_capacity_mb: ", p), err)
}
return err
}
func (p *QueryDiskInfoResponse) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("total_available_mb", thrift.I64, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:total_available_mb: ", p), err)
}
if err := oprot.WriteI64(int64(p.TotalAvailableMb)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.total_available_mb (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:total_available_mb: ", p), err)
}
return err
}
func (p *QueryDiskInfoResponse) writeField4(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("disk_infos", thrift.LIST, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:disk_infos: ", p), err)
}
if err := oprot.WriteListBegin(thrift.STRUCT, len(p.DiskInfos)); err != nil {
return thrift.PrependError("error writing list begin: ", err)
}
for _, v := range p.DiskInfos {
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:disk_infos: ", p), err)
}
return err
}
func (p *QueryDiskInfoResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("QueryDiskInfoResponse(%+v)", *p)
}
// Attributes:
// - Pid
// - OriginDisk
// - TargetDisk
type ReplicaDiskMigrateRequest struct {
Pid *base.Gpid `thrift:"pid,1" db:"pid" json:"pid"`
OriginDisk string `thrift:"origin_disk,2" db:"origin_disk" json:"origin_disk"`
TargetDisk string `thrift:"target_disk,3" db:"target_disk" json:"target_disk"`
}
func NewReplicaDiskMigrateRequest() *ReplicaDiskMigrateRequest {
return &ReplicaDiskMigrateRequest{}
}
var ReplicaDiskMigrateRequest_Pid_DEFAULT *base.Gpid
func (p *ReplicaDiskMigrateRequest) GetPid() *base.Gpid {
if !p.IsSetPid() {
return ReplicaDiskMigrateRequest_Pid_DEFAULT
}
return p.Pid
}
func (p *ReplicaDiskMigrateRequest) GetOriginDisk() string {
return p.OriginDisk
}
func (p *ReplicaDiskMigrateRequest) GetTargetDisk() string {
return p.TargetDisk
}
func (p *ReplicaDiskMigrateRequest) IsSetPid() bool {
return p.Pid != nil
}
func (p *ReplicaDiskMigrateRequest) 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
}
}
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
}
}
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 *ReplicaDiskMigrateRequest) ReadField1(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 *ReplicaDiskMigrateRequest) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.OriginDisk = v
}
return nil
}
func (p *ReplicaDiskMigrateRequest) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.TargetDisk = v
}
return nil
}
func (p *ReplicaDiskMigrateRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("replica_disk_migrate_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 *ReplicaDiskMigrateRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("pid", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1: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 1:pid: ", p), err)
}
return err
}
func (p *ReplicaDiskMigrateRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("origin_disk", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:origin_disk: ", p), err)
}
if err := oprot.WriteString(string(p.OriginDisk)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.origin_disk (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:origin_disk: ", p), err)
}
return err
}
func (p *ReplicaDiskMigrateRequest) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("target_disk", thrift.STRING, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:target_disk: ", p), err)
}
if err := oprot.WriteString(string(p.TargetDisk)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.target_disk (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:target_disk: ", p), err)
}
return err
}
func (p *ReplicaDiskMigrateRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaDiskMigrateRequest(%+v)", *p)
}
// Attributes:
// - Err
// - Hint
type ReplicaDiskMigrateResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
Hint *string `thrift:"hint,2" db:"hint" json:"hint,omitempty"`
}
func NewReplicaDiskMigrateResponse() *ReplicaDiskMigrateResponse {
return &ReplicaDiskMigrateResponse{}
}
var ReplicaDiskMigrateResponse_Err_DEFAULT *base.ErrorCode
func (p *ReplicaDiskMigrateResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return ReplicaDiskMigrateResponse_Err_DEFAULT
}
return p.Err
}
var ReplicaDiskMigrateResponse_Hint_DEFAULT string
func (p *ReplicaDiskMigrateResponse) GetHint() string {
if !p.IsSetHint() {
return ReplicaDiskMigrateResponse_Hint_DEFAULT
}
return *p.Hint
}
func (p *ReplicaDiskMigrateResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *ReplicaDiskMigrateResponse) IsSetHint() bool {
return p.Hint != nil
}
func (p *ReplicaDiskMigrateResponse) 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 *ReplicaDiskMigrateResponse) 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 *ReplicaDiskMigrateResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.Hint = &v
}
return nil
}
func (p *ReplicaDiskMigrateResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("replica_disk_migrate_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 *ReplicaDiskMigrateResponse) 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 *ReplicaDiskMigrateResponse) writeField2(oprot thrift.TProtocol) (err error) {
if p.IsSetHint() {
if err := oprot.WriteFieldBegin("hint", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:hint: ", p), err)
}
if err := oprot.WriteString(string(*p.Hint)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.hint (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:hint: ", p), err)
}
}
return err
}
func (p *ReplicaDiskMigrateResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaDiskMigrateResponse(%+v)", *p)
}
// Attributes:
// - Type
// - Action
// - Pid
type DetectHotkeyRequest struct {
Type HotkeyType `thrift:"type,1" db:"type" json:"type"`
Action DetectAction `thrift:"action,2" db:"action" json:"action"`
Pid *base.Gpid `thrift:"pid,3" db:"pid" json:"pid"`
}
func NewDetectHotkeyRequest() *DetectHotkeyRequest {
return &DetectHotkeyRequest{}
}
func (p *DetectHotkeyRequest) GetType() HotkeyType {
return p.Type
}
func (p *DetectHotkeyRequest) GetAction() DetectAction {
return p.Action
}
var DetectHotkeyRequest_Pid_DEFAULT *base.Gpid
func (p *DetectHotkeyRequest) GetPid() *base.Gpid {
if !p.IsSetPid() {
return DetectHotkeyRequest_Pid_DEFAULT
}
return p.Pid
}
func (p *DetectHotkeyRequest) IsSetPid() bool {
return p.Pid != nil
}
func (p *DetectHotkeyRequest) 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.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 *DetectHotkeyRequest) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
temp := HotkeyType(v)
p.Type = temp
}
return nil
}
func (p *DetectHotkeyRequest) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
temp := DetectAction(v)
p.Action = temp
}
return nil
}
func (p *DetectHotkeyRequest) ReadField3(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 *DetectHotkeyRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("detect_hotkey_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 *DetectHotkeyRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("type", thrift.I32, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:type: ", p), err)
}
if err := oprot.WriteI32(int32(p.Type)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.type (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:type: ", p), err)
}
return err
}
func (p *DetectHotkeyRequest) writeField2(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("action", thrift.I32, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:action: ", p), err)
}
if err := oprot.WriteI32(int32(p.Action)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.action (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:action: ", p), err)
}
return err
}
func (p *DetectHotkeyRequest) writeField3(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("pid", thrift.STRUCT, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3: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 3:pid: ", p), err)
}
return err
}
func (p *DetectHotkeyRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DetectHotkeyRequest(%+v)", *p)
}
// Attributes:
// - Err
// - ErrHint
// - HotkeyResult_
type DetectHotkeyResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
ErrHint *string `thrift:"err_hint,2" db:"err_hint" json:"err_hint,omitempty"`
HotkeyResult_ *string `thrift:"hotkey_result,3" db:"hotkey_result" json:"hotkey_result,omitempty"`
}
func NewDetectHotkeyResponse() *DetectHotkeyResponse {
return &DetectHotkeyResponse{}
}
var DetectHotkeyResponse_Err_DEFAULT *base.ErrorCode
func (p *DetectHotkeyResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return DetectHotkeyResponse_Err_DEFAULT
}
return p.Err
}
var DetectHotkeyResponse_ErrHint_DEFAULT string
func (p *DetectHotkeyResponse) GetErrHint() string {
if !p.IsSetErrHint() {
return DetectHotkeyResponse_ErrHint_DEFAULT
}
return *p.ErrHint
}
var DetectHotkeyResponse_HotkeyResult__DEFAULT string
func (p *DetectHotkeyResponse) GetHotkeyResult_() string {
if !p.IsSetHotkeyResult_() {
return DetectHotkeyResponse_HotkeyResult__DEFAULT
}
return *p.HotkeyResult_
}
func (p *DetectHotkeyResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *DetectHotkeyResponse) IsSetErrHint() bool {
return p.ErrHint != nil
}
func (p *DetectHotkeyResponse) IsSetHotkeyResult_() bool {
return p.HotkeyResult_ != nil
}
func (p *DetectHotkeyResponse) 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
}
}
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
}
}
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 *DetectHotkeyResponse) 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 *DetectHotkeyResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.ErrHint = &v
}
return nil
}
func (p *DetectHotkeyResponse) ReadField3(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.HotkeyResult_ = &v
}
return nil
}
func (p *DetectHotkeyResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("detect_hotkey_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 *DetectHotkeyResponse) 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 *DetectHotkeyResponse) writeField2(oprot thrift.TProtocol) (err error) {
if p.IsSetErrHint() {
if err := oprot.WriteFieldBegin("err_hint", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:err_hint: ", p), err)
}
if err := oprot.WriteString(string(*p.ErrHint)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.err_hint (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:err_hint: ", p), err)
}
}
return err
}
func (p *DetectHotkeyResponse) writeField3(oprot thrift.TProtocol) (err error) {
if p.IsSetHotkeyResult_() {
if err := oprot.WriteFieldBegin("hotkey_result", thrift.STRING, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:hotkey_result: ", p), err)
}
if err := oprot.WriteString(string(*p.HotkeyResult_)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.hotkey_result (3) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:hotkey_result: ", p), err)
}
}
return err
}
func (p *DetectHotkeyResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("DetectHotkeyResponse(%+v)", *p)
}
// Attributes:
// - DiskStr
type AddNewDiskRequest struct {
DiskStr string `thrift:"disk_str,1" db:"disk_str" json:"disk_str"`
}
func NewAddNewDiskRequest() *AddNewDiskRequest {
return &AddNewDiskRequest{}
}
func (p *AddNewDiskRequest) GetDiskStr() string {
return p.DiskStr
}
func (p *AddNewDiskRequest) 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 *AddNewDiskRequest) ReadField1(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.DiskStr = v
}
return nil
}
func (p *AddNewDiskRequest) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("add_new_disk_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 *AddNewDiskRequest) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("disk_str", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:disk_str: ", p), err)
}
if err := oprot.WriteString(string(p.DiskStr)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.disk_str (1) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:disk_str: ", p), err)
}
return err
}
func (p *AddNewDiskRequest) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("AddNewDiskRequest(%+v)", *p)
}
// Attributes:
// - Err
// - ErrHint
type AddNewDiskResponse struct {
Err *base.ErrorCode `thrift:"err,1" db:"err" json:"err"`
ErrHint *string `thrift:"err_hint,2" db:"err_hint" json:"err_hint,omitempty"`
}
func NewAddNewDiskResponse() *AddNewDiskResponse {
return &AddNewDiskResponse{}
}
var AddNewDiskResponse_Err_DEFAULT *base.ErrorCode
func (p *AddNewDiskResponse) GetErr() *base.ErrorCode {
if !p.IsSetErr() {
return AddNewDiskResponse_Err_DEFAULT
}
return p.Err
}
var AddNewDiskResponse_ErrHint_DEFAULT string
func (p *AddNewDiskResponse) GetErrHint() string {
if !p.IsSetErrHint() {
return AddNewDiskResponse_ErrHint_DEFAULT
}
return *p.ErrHint
}
func (p *AddNewDiskResponse) IsSetErr() bool {
return p.Err != nil
}
func (p *AddNewDiskResponse) IsSetErrHint() bool {
return p.ErrHint != nil
}
func (p *AddNewDiskResponse) 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 *AddNewDiskResponse) 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 *AddNewDiskResponse) ReadField2(iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.ErrHint = &v
}
return nil
}
func (p *AddNewDiskResponse) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("add_new_disk_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 *AddNewDiskResponse) 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 *AddNewDiskResponse) writeField2(oprot thrift.TProtocol) (err error) {
if p.IsSetErrHint() {
if err := oprot.WriteFieldBegin("err_hint", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:err_hint: ", p), err)
}
if err := oprot.WriteString(string(*p.ErrHint)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.err_hint (2) field write error: ", p), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:err_hint: ", p), err)
}
}
return err
}
func (p *AddNewDiskResponse) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("AddNewDiskResponse(%+v)", *p)
}
type ReplicaClient interface {
// Parameters:
// - Req
QueryDiskInfo(ctx context.Context, req *QueryDiskInfoRequest) (r *QueryDiskInfoResponse, err error)
// Parameters:
// - Req
DiskMigrate(ctx context.Context, req *ReplicaDiskMigrateRequest) (r *ReplicaDiskMigrateResponse, err error)
// Parameters:
// - Req
AddDisk(ctx context.Context, req *AddNewDiskRequest) (r *AddNewDiskResponse, err error)
}
type ReplicaClientClient struct {
c thrift.TClient
}
func NewReplicaClientClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ReplicaClientClient {
return &ReplicaClientClient{
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
}
}
func NewReplicaClientClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ReplicaClientClient {
return &ReplicaClientClient{
c: thrift.NewTStandardClient(iprot, oprot),
}
}
func NewReplicaClientClient(c thrift.TClient) *ReplicaClientClient {
return &ReplicaClientClient{
c: c,
}
}
func (p *ReplicaClientClient) Client_() thrift.TClient {
return p.c
}
// Parameters:
// - Req
func (p *ReplicaClientClient) QueryDiskInfo(ctx context.Context, req *QueryDiskInfoRequest) (r *QueryDiskInfoResponse, err error) {
var _args8 ReplicaClientQueryDiskInfoArgs
_args8.Req = req
var _result9 ReplicaClientQueryDiskInfoResult
if err = p.Client_().Call(ctx, "query_disk_info", &_args8, &_result9); err != nil {
return
}
return _result9.GetSuccess(), nil
}
// Parameters:
// - Req
func (p *ReplicaClientClient) DiskMigrate(ctx context.Context, req *ReplicaDiskMigrateRequest) (r *ReplicaDiskMigrateResponse, err error) {
var _args10 ReplicaClientDiskMigrateArgs
_args10.Req = req
var _result11 ReplicaClientDiskMigrateResult
if err = p.Client_().Call(ctx, "disk_migrate", &_args10, &_result11); err != nil {
return
}
return _result11.GetSuccess(), nil
}
// Parameters:
// - Req
func (p *ReplicaClientClient) AddDisk(ctx context.Context, req *AddNewDiskRequest) (r *AddNewDiskResponse, err error) {
var _args12 ReplicaClientAddDiskArgs
_args12.Req = req
var _result13 ReplicaClientAddDiskResult
if err = p.Client_().Call(ctx, "add_disk", &_args12, &_result13); err != nil {
return
}
return _result13.GetSuccess(), nil
}
type ReplicaClientProcessor struct {
processorMap map[string]thrift.TProcessorFunction
handler ReplicaClient
}
func (p *ReplicaClientProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
p.processorMap[key] = processor
}
func (p *ReplicaClientProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
processor, ok = p.processorMap[key]
return processor, ok
}
func (p *ReplicaClientProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
return p.processorMap
}
func NewReplicaClientProcessor(handler ReplicaClient) *ReplicaClientProcessor {
self14 := &ReplicaClientProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
self14.processorMap["query_disk_info"] = &replicaClientProcessorQueryDiskInfo{handler: handler}
self14.processorMap["disk_migrate"] = &replicaClientProcessorDiskMigrate{handler: handler}
self14.processorMap["add_disk"] = &replicaClientProcessorAddDisk{handler: handler}
return self14
}
func (p *ReplicaClientProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
name, _, seqId, err := iprot.ReadMessageBegin()
if err != nil {
return false, err
}
if processor, ok := p.GetProcessorFunction(name); ok {
return processor.Process(ctx, seqId, iprot, oprot)
}
iprot.Skip(thrift.STRUCT)
iprot.ReadMessageEnd()
x15 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
x15.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return false, x15
}
type replicaClientProcessorQueryDiskInfo struct {
handler ReplicaClient
}
func (p *replicaClientProcessorQueryDiskInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := ReplicaClientQueryDiskInfoArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("query_disk_info", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return false, err
}
iprot.ReadMessageEnd()
result := ReplicaClientQueryDiskInfoResult{}
var retval *QueryDiskInfoResponse
var err2 error
if retval, err2 = p.handler.QueryDiskInfo(ctx, args.Req); err2 != nil {
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing query_disk_info: "+err2.Error())
oprot.WriteMessageBegin("query_disk_info", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return true, err2
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("query_disk_info", thrift.REPLY, seqId); err2 != nil {
err = err2
}
if err2 = result.Write(oprot); err == nil && err2 != nil {
err = err2
}
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
err = err2
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
type replicaClientProcessorDiskMigrate struct {
handler ReplicaClient
}
func (p *replicaClientProcessorDiskMigrate) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := ReplicaClientDiskMigrateArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("disk_migrate", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return false, err
}
iprot.ReadMessageEnd()
result := ReplicaClientDiskMigrateResult{}
var retval *ReplicaDiskMigrateResponse
var err2 error
if retval, err2 = p.handler.DiskMigrate(ctx, args.Req); err2 != nil {
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing disk_migrate: "+err2.Error())
oprot.WriteMessageBegin("disk_migrate", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return true, err2
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("disk_migrate", thrift.REPLY, seqId); err2 != nil {
err = err2
}
if err2 = result.Write(oprot); err == nil && err2 != nil {
err = err2
}
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
err = err2
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
type replicaClientProcessorAddDisk struct {
handler ReplicaClient
}
func (p *replicaClientProcessorAddDisk) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := ReplicaClientAddDiskArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("add_disk", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return false, err
}
iprot.ReadMessageEnd()
result := ReplicaClientAddDiskResult{}
var retval *AddNewDiskResponse
var err2 error
if retval, err2 = p.handler.AddDisk(ctx, args.Req); err2 != nil {
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing add_disk: "+err2.Error())
oprot.WriteMessageBegin("add_disk", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush(ctx)
return true, err2
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("add_disk", thrift.REPLY, seqId); err2 != nil {
err = err2
}
if err2 = result.Write(oprot); err == nil && err2 != nil {
err = err2
}
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
err = err2
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
// - Req
type ReplicaClientQueryDiskInfoArgs struct {
Req *QueryDiskInfoRequest `thrift:"req,1" db:"req" json:"req"`
}
func NewReplicaClientQueryDiskInfoArgs() *ReplicaClientQueryDiskInfoArgs {
return &ReplicaClientQueryDiskInfoArgs{}
}
var ReplicaClientQueryDiskInfoArgs_Req_DEFAULT *QueryDiskInfoRequest
func (p *ReplicaClientQueryDiskInfoArgs) GetReq() *QueryDiskInfoRequest {
if !p.IsSetReq() {
return ReplicaClientQueryDiskInfoArgs_Req_DEFAULT
}
return p.Req
}
func (p *ReplicaClientQueryDiskInfoArgs) IsSetReq() bool {
return p.Req != nil
}
func (p *ReplicaClientQueryDiskInfoArgs) 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 *ReplicaClientQueryDiskInfoArgs) ReadField1(iprot thrift.TProtocol) error {
p.Req = &QueryDiskInfoRequest{}
if err := p.Req.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err)
}
return nil
}
func (p *ReplicaClientQueryDiskInfoArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_disk_info_args"); 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 *ReplicaClientQueryDiskInfoArgs) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err)
}
if err := p.Req.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Req), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:req: ", p), err)
}
return err
}
func (p *ReplicaClientQueryDiskInfoArgs) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaClientQueryDiskInfoArgs(%+v)", *p)
}
// Attributes:
// - Success
type ReplicaClientQueryDiskInfoResult struct {
Success *QueryDiskInfoResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewReplicaClientQueryDiskInfoResult() *ReplicaClientQueryDiskInfoResult {
return &ReplicaClientQueryDiskInfoResult{}
}
var ReplicaClientQueryDiskInfoResult_Success_DEFAULT *QueryDiskInfoResponse
func (p *ReplicaClientQueryDiskInfoResult) GetSuccess() *QueryDiskInfoResponse {
if !p.IsSetSuccess() {
return ReplicaClientQueryDiskInfoResult_Success_DEFAULT
}
return p.Success
}
func (p *ReplicaClientQueryDiskInfoResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *ReplicaClientQueryDiskInfoResult) 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 0:
if fieldTypeId == thrift.STRUCT {
if err := p.ReadField0(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 *ReplicaClientQueryDiskInfoResult) ReadField0(iprot thrift.TProtocol) error {
p.Success = &QueryDiskInfoResponse{}
if err := p.Success.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *ReplicaClientQueryDiskInfoResult) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("query_disk_info_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if p != nil {
if err := p.writeField0(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 *ReplicaClientQueryDiskInfoResult) writeField0(oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
}
if err := p.Success.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
}
}
return err
}
func (p *ReplicaClientQueryDiskInfoResult) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaClientQueryDiskInfoResult(%+v)", *p)
}
// Attributes:
// - Req
type ReplicaClientDiskMigrateArgs struct {
Req *ReplicaDiskMigrateRequest `thrift:"req,1" db:"req" json:"req"`
}
func NewReplicaClientDiskMigrateArgs() *ReplicaClientDiskMigrateArgs {
return &ReplicaClientDiskMigrateArgs{}
}
var ReplicaClientDiskMigrateArgs_Req_DEFAULT *ReplicaDiskMigrateRequest
func (p *ReplicaClientDiskMigrateArgs) GetReq() *ReplicaDiskMigrateRequest {
if !p.IsSetReq() {
return ReplicaClientDiskMigrateArgs_Req_DEFAULT
}
return p.Req
}
func (p *ReplicaClientDiskMigrateArgs) IsSetReq() bool {
return p.Req != nil
}
func (p *ReplicaClientDiskMigrateArgs) 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 *ReplicaClientDiskMigrateArgs) ReadField1(iprot thrift.TProtocol) error {
p.Req = &ReplicaDiskMigrateRequest{}
if err := p.Req.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err)
}
return nil
}
func (p *ReplicaClientDiskMigrateArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("disk_migrate_args"); 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 *ReplicaClientDiskMigrateArgs) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err)
}
if err := p.Req.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Req), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:req: ", p), err)
}
return err
}
func (p *ReplicaClientDiskMigrateArgs) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaClientDiskMigrateArgs(%+v)", *p)
}
// Attributes:
// - Success
type ReplicaClientDiskMigrateResult struct {
Success *ReplicaDiskMigrateResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewReplicaClientDiskMigrateResult() *ReplicaClientDiskMigrateResult {
return &ReplicaClientDiskMigrateResult{}
}
var ReplicaClientDiskMigrateResult_Success_DEFAULT *ReplicaDiskMigrateResponse
func (p *ReplicaClientDiskMigrateResult) GetSuccess() *ReplicaDiskMigrateResponse {
if !p.IsSetSuccess() {
return ReplicaClientDiskMigrateResult_Success_DEFAULT
}
return p.Success
}
func (p *ReplicaClientDiskMigrateResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *ReplicaClientDiskMigrateResult) 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 0:
if fieldTypeId == thrift.STRUCT {
if err := p.ReadField0(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 *ReplicaClientDiskMigrateResult) ReadField0(iprot thrift.TProtocol) error {
p.Success = &ReplicaDiskMigrateResponse{}
if err := p.Success.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *ReplicaClientDiskMigrateResult) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("disk_migrate_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if p != nil {
if err := p.writeField0(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 *ReplicaClientDiskMigrateResult) writeField0(oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
}
if err := p.Success.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
}
}
return err
}
func (p *ReplicaClientDiskMigrateResult) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaClientDiskMigrateResult(%+v)", *p)
}
// Attributes:
// - Req
type ReplicaClientAddDiskArgs struct {
Req *AddNewDiskRequest `thrift:"req,1" db:"req" json:"req"`
}
func NewReplicaClientAddDiskArgs() *ReplicaClientAddDiskArgs {
return &ReplicaClientAddDiskArgs{}
}
var ReplicaClientAddDiskArgs_Req_DEFAULT *AddNewDiskRequest
func (p *ReplicaClientAddDiskArgs) GetReq() *AddNewDiskRequest {
if !p.IsSetReq() {
return ReplicaClientAddDiskArgs_Req_DEFAULT
}
return p.Req
}
func (p *ReplicaClientAddDiskArgs) IsSetReq() bool {
return p.Req != nil
}
func (p *ReplicaClientAddDiskArgs) 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 *ReplicaClientAddDiskArgs) ReadField1(iprot thrift.TProtocol) error {
p.Req = &AddNewDiskRequest{}
if err := p.Req.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Req), err)
}
return nil
}
func (p *ReplicaClientAddDiskArgs) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("add_disk_args"); 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 *ReplicaClientAddDiskArgs) writeField1(oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:req: ", p), err)
}
if err := p.Req.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Req), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:req: ", p), err)
}
return err
}
func (p *ReplicaClientAddDiskArgs) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaClientAddDiskArgs(%+v)", *p)
}
// Attributes:
// - Success
type ReplicaClientAddDiskResult struct {
Success *AddNewDiskResponse `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewReplicaClientAddDiskResult() *ReplicaClientAddDiskResult {
return &ReplicaClientAddDiskResult{}
}
var ReplicaClientAddDiskResult_Success_DEFAULT *AddNewDiskResponse
func (p *ReplicaClientAddDiskResult) GetSuccess() *AddNewDiskResponse {
if !p.IsSetSuccess() {
return ReplicaClientAddDiskResult_Success_DEFAULT
}
return p.Success
}
func (p *ReplicaClientAddDiskResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *ReplicaClientAddDiskResult) 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 0:
if fieldTypeId == thrift.STRUCT {
if err := p.ReadField0(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 *ReplicaClientAddDiskResult) ReadField0(iprot thrift.TProtocol) error {
p.Success = &AddNewDiskResponse{}
if err := p.Success.Read(iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *ReplicaClientAddDiskResult) Write(oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin("add_disk_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
}
if p != nil {
if err := p.writeField0(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 *ReplicaClientAddDiskResult) writeField0(oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
}
if err := p.Success.Write(oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
}
}
return err
}
func (p *ReplicaClientAddDiskResult) String() string {
if p == nil {
return "<nil>"
}
return fmt.Sprintf("ReplicaClientAddDiskResult(%+v)", *p)
}