sync.sync.go Maven / Gradle / Ivy
// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT.
package sync
import(
"bytes"
"context"
"fmt"
"time"
"github.com/apache/thrift/lib/go/thrift"
)
// (needed to ensure safety because of naive import list construction.)
var _ = thrift.ZERO
var _ = fmt.Printf
var _ = context.Background
var _ = time.Now
var _ = bytes.Equal
// Attributes:
// - Code
// - Msg
type SyncStatus struct {
Code int32 `thrift:"code,1,required" db:"code" json:"code"`
Msg string `thrift:"msg,2,required" db:"msg" json:"msg"`
}
func NewSyncStatus() *SyncStatus {
return &SyncStatus{}
}
func (p *SyncStatus) GetCode() int32 {
return p.Code
}
func (p *SyncStatus) GetMsg() string {
return p.Msg
}
func (p *SyncStatus) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
var issetCode bool = false;
var issetMsg bool = false;
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
issetCode = true
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
case 2:
if fieldTypeId == thrift.STRING {
if err := p.ReadField2(ctx, iprot); err != nil {
return err
}
issetMsg = true
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
if !issetCode{
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Code is not set"));
}
if !issetMsg{
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Msg is not set"));
}
return nil
}
func (p *SyncStatus) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadI32(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Code = v
}
return nil
}
func (p *SyncStatus) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.Msg = v
}
return nil
}
func (p *SyncStatus) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "SyncStatus"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
if err := p.writeField2(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncStatus) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "code", thrift.I32, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:code: ", p), err) }
if err := oprot.WriteI32(ctx, int32(p.Code)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.code (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:code: ", p), err) }
return err
}
func (p *SyncStatus) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "msg", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:msg: ", p), err) }
if err := oprot.WriteString(ctx, string(p.Msg)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.msg (2) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:msg: ", p), err) }
return err
}
func (p *SyncStatus) Equals(other *SyncStatus) bool {
if p == other {
return true
} else if p == nil || other == nil {
return false
}
if p.Code != other.Code { return false }
if p.Msg != other.Msg { return false }
return true
}
func (p *SyncStatus) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncStatus(%+v)", *p)
}
// Attributes:
// - Address
// - UUID
// - PartitionInterval
// - Version
type ConfirmInfo struct {
Address string `thrift:"address,1" db:"address" json:"address"`
UUID string `thrift:"uuid,2" db:"uuid" json:"uuid"`
PartitionInterval int64 `thrift:"partitionInterval,3" db:"partitionInterval" json:"partitionInterval"`
Version string `thrift:"version,4" db:"version" json:"version"`
}
func NewConfirmInfo() *ConfirmInfo {
return &ConfirmInfo{}
}
func (p *ConfirmInfo) GetAddress() string {
return p.Address
}
func (p *ConfirmInfo) GetUUID() string {
return p.UUID
}
func (p *ConfirmInfo) GetPartitionInterval() int64 {
return p.PartitionInterval
}
func (p *ConfirmInfo) GetVersion() string {
return p.Version
}
func (p *ConfirmInfo) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
case 2:
if fieldTypeId == thrift.STRING {
if err := p.ReadField2(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
case 3:
if fieldTypeId == thrift.I64 {
if err := p.ReadField3(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
case 4:
if fieldTypeId == thrift.STRING {
if err := p.ReadField4(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *ConfirmInfo) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Address = v
}
return nil
}
func (p *ConfirmInfo) ReadField2(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 2: ", err)
} else {
p.UUID = v
}
return nil
}
func (p *ConfirmInfo) ReadField3(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadI64(ctx); err != nil {
return thrift.PrependError("error reading field 3: ", err)
} else {
p.PartitionInterval = v
}
return nil
}
func (p *ConfirmInfo) ReadField4(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 4: ", err)
} else {
p.Version = v
}
return nil
}
func (p *ConfirmInfo) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "ConfirmInfo"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
if err := p.writeField2(ctx, oprot); err != nil { return err }
if err := p.writeField3(ctx, oprot); err != nil { return err }
if err := p.writeField4(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *ConfirmInfo) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "address", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:address: ", p), err) }
if err := oprot.WriteString(ctx, string(p.Address)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.address (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:address: ", p), err) }
return err
}
func (p *ConfirmInfo) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "uuid", thrift.STRING, 2); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:uuid: ", p), err) }
if err := oprot.WriteString(ctx, string(p.UUID)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.uuid (2) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 2:uuid: ", p), err) }
return err
}
func (p *ConfirmInfo) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "partitionInterval", thrift.I64, 3); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:partitionInterval: ", p), err) }
if err := oprot.WriteI64(ctx, int64(p.PartitionInterval)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.partitionInterval (3) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 3:partitionInterval: ", p), err) }
return err
}
func (p *ConfirmInfo) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "version", thrift.STRING, 4); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:version: ", p), err) }
if err := oprot.WriteString(ctx, string(p.Version)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.version (4) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 4:version: ", p), err) }
return err
}
func (p *ConfirmInfo) Equals(other *ConfirmInfo) bool {
if p == other {
return true
} else if p == nil || other == nil {
return false
}
if p.Address != other.Address { return false }
if p.UUID != other.UUID { return false }
if p.PartitionInterval != other.PartitionInterval { return false }
if p.Version != other.Version { return false }
return true
}
func (p *ConfirmInfo) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("ConfirmInfo(%+v)", *p)
}
type SyncService interface {
// Parameters:
// - Info
Check(ctx context.Context, info *ConfirmInfo) (_r *SyncStatus, _err error)
StartSync(ctx context.Context) (_r *SyncStatus, _err error)
// Parameters:
// - StorageGroupName
Init(ctx context.Context, storageGroupName string) (_r *SyncStatus, _err error)
// Parameters:
// - FileName
SyncDeletedFileName(ctx context.Context, fileName string) (_r *SyncStatus, _err error)
// Parameters:
// - Filename
InitSyncData(ctx context.Context, filename string) (_r *SyncStatus, _err error)
// Parameters:
// - Buff
SyncData(ctx context.Context, buff []byte) (_r *SyncStatus, _err error)
// Parameters:
// - Md5
CheckDataDigest(ctx context.Context, md5 string) (_r *SyncStatus, _err error)
EndSync(ctx context.Context) (_r *SyncStatus, _err error)
}
type SyncServiceClient struct {
c thrift.TClient
meta thrift.ResponseMeta
}
func NewSyncServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *SyncServiceClient {
return &SyncServiceClient{
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
}
}
func NewSyncServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *SyncServiceClient {
return &SyncServiceClient{
c: thrift.NewTStandardClient(iprot, oprot),
}
}
func NewSyncServiceClient(c thrift.TClient) *SyncServiceClient {
return &SyncServiceClient{
c: c,
}
}
func (p *SyncServiceClient) Client_() thrift.TClient {
return p.c
}
func (p *SyncServiceClient) LastResponseMeta_() thrift.ResponseMeta {
return p.meta
}
func (p *SyncServiceClient) SetLastResponseMeta_(meta thrift.ResponseMeta) {
p.meta = meta
}
// Parameters:
// - Info
func (p *SyncServiceClient) Check(ctx context.Context, info *ConfirmInfo) (_r *SyncStatus, _err error) {
var _args0 SyncServiceCheckArgs
_args0.Info = info
var _result2 SyncServiceCheckResult
var _meta1 thrift.ResponseMeta
_meta1, _err = p.Client_().Call(ctx, "check", &_args0, &_result2)
p.SetLastResponseMeta_(_meta1)
if _err != nil {
return
}
return _result2.GetSuccess(), nil
}
func (p *SyncServiceClient) StartSync(ctx context.Context) (_r *SyncStatus, _err error) {
var _args3 SyncServiceStartSyncArgs
var _result5 SyncServiceStartSyncResult
var _meta4 thrift.ResponseMeta
_meta4, _err = p.Client_().Call(ctx, "startSync", &_args3, &_result5)
p.SetLastResponseMeta_(_meta4)
if _err != nil {
return
}
return _result5.GetSuccess(), nil
}
// Parameters:
// - StorageGroupName
func (p *SyncServiceClient) Init(ctx context.Context, storageGroupName string) (_r *SyncStatus, _err error) {
var _args6 SyncServiceInitArgs
_args6.StorageGroupName = storageGroupName
var _result8 SyncServiceInitResult
var _meta7 thrift.ResponseMeta
_meta7, _err = p.Client_().Call(ctx, "init", &_args6, &_result8)
p.SetLastResponseMeta_(_meta7)
if _err != nil {
return
}
return _result8.GetSuccess(), nil
}
// Parameters:
// - FileName
func (p *SyncServiceClient) SyncDeletedFileName(ctx context.Context, fileName string) (_r *SyncStatus, _err error) {
var _args9 SyncServiceSyncDeletedFileNameArgs
_args9.FileName = fileName
var _result11 SyncServiceSyncDeletedFileNameResult
var _meta10 thrift.ResponseMeta
_meta10, _err = p.Client_().Call(ctx, "syncDeletedFileName", &_args9, &_result11)
p.SetLastResponseMeta_(_meta10)
if _err != nil {
return
}
return _result11.GetSuccess(), nil
}
// Parameters:
// - Filename
func (p *SyncServiceClient) InitSyncData(ctx context.Context, filename string) (_r *SyncStatus, _err error) {
var _args12 SyncServiceInitSyncDataArgs
_args12.Filename = filename
var _result14 SyncServiceInitSyncDataResult
var _meta13 thrift.ResponseMeta
_meta13, _err = p.Client_().Call(ctx, "initSyncData", &_args12, &_result14)
p.SetLastResponseMeta_(_meta13)
if _err != nil {
return
}
return _result14.GetSuccess(), nil
}
// Parameters:
// - Buff
func (p *SyncServiceClient) SyncData(ctx context.Context, buff []byte) (_r *SyncStatus, _err error) {
var _args15 SyncServiceSyncDataArgs
_args15.Buff = buff
var _result17 SyncServiceSyncDataResult
var _meta16 thrift.ResponseMeta
_meta16, _err = p.Client_().Call(ctx, "syncData", &_args15, &_result17)
p.SetLastResponseMeta_(_meta16)
if _err != nil {
return
}
return _result17.GetSuccess(), nil
}
// Parameters:
// - Md5
func (p *SyncServiceClient) CheckDataDigest(ctx context.Context, md5 string) (_r *SyncStatus, _err error) {
var _args18 SyncServiceCheckDataDigestArgs
_args18.Md5 = md5
var _result20 SyncServiceCheckDataDigestResult
var _meta19 thrift.ResponseMeta
_meta19, _err = p.Client_().Call(ctx, "checkDataDigest", &_args18, &_result20)
p.SetLastResponseMeta_(_meta19)
if _err != nil {
return
}
return _result20.GetSuccess(), nil
}
func (p *SyncServiceClient) EndSync(ctx context.Context) (_r *SyncStatus, _err error) {
var _args21 SyncServiceEndSyncArgs
var _result23 SyncServiceEndSyncResult
var _meta22 thrift.ResponseMeta
_meta22, _err = p.Client_().Call(ctx, "endSync", &_args21, &_result23)
p.SetLastResponseMeta_(_meta22)
if _err != nil {
return
}
return _result23.GetSuccess(), nil
}
type SyncServiceProcessor struct {
processorMap map[string]thrift.TProcessorFunction
handler SyncService
}
func (p *SyncServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
p.processorMap[key] = processor
}
func (p *SyncServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
processor, ok = p.processorMap[key]
return processor, ok
}
func (p *SyncServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
return p.processorMap
}
func NewSyncServiceProcessor(handler SyncService) *SyncServiceProcessor {
self24 := &SyncServiceProcessor{handler:handler, processorMap:make(map[string]thrift.TProcessorFunction)}
self24.processorMap["check"] = &syncServiceProcessorCheck{handler:handler}
self24.processorMap["startSync"] = &syncServiceProcessorStartSync{handler:handler}
self24.processorMap["init"] = &syncServiceProcessorInit{handler:handler}
self24.processorMap["syncDeletedFileName"] = &syncServiceProcessorSyncDeletedFileName{handler:handler}
self24.processorMap["initSyncData"] = &syncServiceProcessorInitSyncData{handler:handler}
self24.processorMap["syncData"] = &syncServiceProcessorSyncData{handler:handler}
self24.processorMap["checkDataDigest"] = &syncServiceProcessorCheckDataDigest{handler:handler}
self24.processorMap["endSync"] = &syncServiceProcessorEndSync{handler:handler}
return self24
}
func (p *SyncServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
name, _, seqId, err2 := iprot.ReadMessageBegin(ctx)
if err2 != nil { return false, thrift.WrapTException(err2) }
if processor, ok := p.GetProcessorFunction(name); ok {
return processor.Process(ctx, seqId, iprot, oprot)
}
iprot.Skip(ctx, thrift.STRUCT)
iprot.ReadMessageEnd(ctx)
x25 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function " + name)
oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId)
x25.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, x25
}
type syncServiceProcessorCheck struct {
handler SyncService
}
func (p *syncServiceProcessorCheck) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceCheckArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "check", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceCheckResult{}
var retval *SyncStatus
if retval, err2 = p.handler.Check(ctx, args.Info); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing check: " + err2.Error())
oprot.WriteMessageBegin(ctx, "check", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "check", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorStartSync struct {
handler SyncService
}
func (p *syncServiceProcessorStartSync) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceStartSyncArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "startSync", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceStartSyncResult{}
var retval *SyncStatus
if retval, err2 = p.handler.StartSync(ctx); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing startSync: " + err2.Error())
oprot.WriteMessageBegin(ctx, "startSync", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "startSync", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorInit struct {
handler SyncService
}
func (p *syncServiceProcessorInit) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceInitArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "init", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceInitResult{}
var retval *SyncStatus
if retval, err2 = p.handler.Init(ctx, args.StorageGroupName); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing init: " + err2.Error())
oprot.WriteMessageBegin(ctx, "init", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "init", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorSyncDeletedFileName struct {
handler SyncService
}
func (p *syncServiceProcessorSyncDeletedFileName) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceSyncDeletedFileNameArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "syncDeletedFileName", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceSyncDeletedFileNameResult{}
var retval *SyncStatus
if retval, err2 = p.handler.SyncDeletedFileName(ctx, args.FileName); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing syncDeletedFileName: " + err2.Error())
oprot.WriteMessageBegin(ctx, "syncDeletedFileName", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "syncDeletedFileName", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorInitSyncData struct {
handler SyncService
}
func (p *syncServiceProcessorInitSyncData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceInitSyncDataArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "initSyncData", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceInitSyncDataResult{}
var retval *SyncStatus
if retval, err2 = p.handler.InitSyncData(ctx, args.Filename); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing initSyncData: " + err2.Error())
oprot.WriteMessageBegin(ctx, "initSyncData", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "initSyncData", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorSyncData struct {
handler SyncService
}
func (p *syncServiceProcessorSyncData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceSyncDataArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "syncData", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceSyncDataResult{}
var retval *SyncStatus
if retval, err2 = p.handler.SyncData(ctx, args.Buff); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing syncData: " + err2.Error())
oprot.WriteMessageBegin(ctx, "syncData", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "syncData", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorCheckDataDigest struct {
handler SyncService
}
func (p *syncServiceProcessorCheckDataDigest) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceCheckDataDigestArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "checkDataDigest", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceCheckDataDigestResult{}
var retval *SyncStatus
if retval, err2 = p.handler.CheckDataDigest(ctx, args.Md5); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing checkDataDigest: " + err2.Error())
oprot.WriteMessageBegin(ctx, "checkDataDigest", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "checkDataDigest", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
type syncServiceProcessorEndSync struct {
handler SyncService
}
func (p *syncServiceProcessorEndSync) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SyncServiceEndSyncArgs{}
var err2 error
if err2 = args.Read(ctx, iprot); err2 != nil {
iprot.ReadMessageEnd(ctx)
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
oprot.WriteMessageBegin(ctx, "endSync", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return false, thrift.WrapTException(err2)
}
iprot.ReadMessageEnd(ctx)
tickerCancel := func() {}
// Start a goroutine to do server side connectivity check.
if thrift.ServerConnectivityCheckInterval > 0 {
var cancel context.CancelFunc
ctx, cancel = context.WithCancel(ctx)
defer cancel()
var tickerCtx context.Context
tickerCtx, tickerCancel = context.WithCancel(context.Background())
defer tickerCancel()
go func(ctx context.Context, cancel context.CancelFunc) {
ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
if !iprot.Transport().IsOpen() {
cancel()
return
}
}
}
}(tickerCtx, cancel)
}
result := SyncServiceEndSyncResult{}
var retval *SyncStatus
if retval, err2 = p.handler.EndSync(ctx); err2 != nil {
tickerCancel()
if err2 == thrift.ErrAbandonRequest {
return false, thrift.WrapTException(err2)
}
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing endSync: " + err2.Error())
oprot.WriteMessageBegin(ctx, "endSync", thrift.EXCEPTION, seqId)
x.Write(ctx, oprot)
oprot.WriteMessageEnd(ctx)
oprot.Flush(ctx)
return true, thrift.WrapTException(err2)
} else {
result.Success = retval
}
tickerCancel()
if err2 = oprot.WriteMessageBegin(ctx, "endSync", thrift.REPLY, seqId); err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = result.Write(ctx, oprot); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
err = thrift.WrapTException(err2)
}
if err != nil {
return
}
return true, err
}
// HELPER FUNCTIONS AND STRUCTURES
// Attributes:
// - Info
type SyncServiceCheckArgs struct {
Info *ConfirmInfo
}
func NewSyncServiceCheckArgs() *SyncServiceCheckArgs {
return &SyncServiceCheckArgs{}
}
var SyncServiceCheckArgs_Info_DEFAULT *ConfirmInfo
func (p *SyncServiceCheckArgs) GetInfo() *ConfirmInfo {
if !p.IsSetInfo() {
return SyncServiceCheckArgs_Info_DEFAULT
}
return p.Info
}
func (p *SyncServiceCheckArgs) IsSetInfo() bool {
return p.Info != nil
}
func (p *SyncServiceCheckArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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.ReadField_1(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceCheckArgs) ReadField_1(ctx context.Context, iprot thrift.TProtocol) error {
p.Info = &ConfirmInfo{}
if err := p.Info.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Info), err)
}
return nil
}
func (p *SyncServiceCheckArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "check_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField_1(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceCheckArgs) writeField_1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "info", thrift.STRUCT, -1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error -1:info: ", p), err) }
if err := p.Info.Write(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Info), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error -1:info: ", p), err) }
return err
}
func (p *SyncServiceCheckArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceCheckArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceCheckResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceCheckResult() *SyncServiceCheckResult {
return &SyncServiceCheckResult{}
}
var SyncServiceCheckResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceCheckResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceCheckResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceCheckResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceCheckResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceCheckResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceCheckResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "check_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceCheckResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceCheckResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceCheckResult(%+v)", *p)
}
type SyncServiceStartSyncArgs struct {
}
func NewSyncServiceStartSyncArgs() *SyncServiceStartSyncArgs {
return &SyncServiceStartSyncArgs{}
}
func (p *SyncServiceStartSyncArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
}
if fieldTypeId == thrift.STOP { break; }
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceStartSyncArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "startSync_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceStartSyncArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceStartSyncArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceStartSyncResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceStartSyncResult() *SyncServiceStartSyncResult {
return &SyncServiceStartSyncResult{}
}
var SyncServiceStartSyncResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceStartSyncResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceStartSyncResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceStartSyncResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceStartSyncResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceStartSyncResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceStartSyncResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "startSync_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceStartSyncResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceStartSyncResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceStartSyncResult(%+v)", *p)
}
// Attributes:
// - StorageGroupName
type SyncServiceInitArgs struct {
StorageGroupName string `thrift:"storageGroupName,1" db:"storageGroupName" json:"storageGroupName"`
}
func NewSyncServiceInitArgs() *SyncServiceInitArgs {
return &SyncServiceInitArgs{}
}
func (p *SyncServiceInitArgs) GetStorageGroupName() string {
return p.StorageGroupName
}
func (p *SyncServiceInitArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceInitArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.StorageGroupName = v
}
return nil
}
func (p *SyncServiceInitArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "init_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceInitArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "storageGroupName", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:storageGroupName: ", p), err) }
if err := oprot.WriteString(ctx, string(p.StorageGroupName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.storageGroupName (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:storageGroupName: ", p), err) }
return err
}
func (p *SyncServiceInitArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceInitArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceInitResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceInitResult() *SyncServiceInitResult {
return &SyncServiceInitResult{}
}
var SyncServiceInitResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceInitResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceInitResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceInitResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceInitResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceInitResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceInitResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "init_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceInitResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceInitResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceInitResult(%+v)", *p)
}
// Attributes:
// - FileName
type SyncServiceSyncDeletedFileNameArgs struct {
FileName string `thrift:"fileName,1" db:"fileName" json:"fileName"`
}
func NewSyncServiceSyncDeletedFileNameArgs() *SyncServiceSyncDeletedFileNameArgs {
return &SyncServiceSyncDeletedFileNameArgs{}
}
func (p *SyncServiceSyncDeletedFileNameArgs) GetFileName() string {
return p.FileName
}
func (p *SyncServiceSyncDeletedFileNameArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceSyncDeletedFileNameArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.FileName = v
}
return nil
}
func (p *SyncServiceSyncDeletedFileNameArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "syncDeletedFileName_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceSyncDeletedFileNameArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "fileName", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fileName: ", p), err) }
if err := oprot.WriteString(ctx, string(p.FileName)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.fileName (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fileName: ", p), err) }
return err
}
func (p *SyncServiceSyncDeletedFileNameArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceSyncDeletedFileNameArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceSyncDeletedFileNameResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceSyncDeletedFileNameResult() *SyncServiceSyncDeletedFileNameResult {
return &SyncServiceSyncDeletedFileNameResult{}
}
var SyncServiceSyncDeletedFileNameResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceSyncDeletedFileNameResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceSyncDeletedFileNameResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceSyncDeletedFileNameResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceSyncDeletedFileNameResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceSyncDeletedFileNameResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceSyncDeletedFileNameResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "syncDeletedFileName_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceSyncDeletedFileNameResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceSyncDeletedFileNameResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceSyncDeletedFileNameResult(%+v)", *p)
}
// Attributes:
// - Filename
type SyncServiceInitSyncDataArgs struct {
Filename string `thrift:"filename,1" db:"filename" json:"filename"`
}
func NewSyncServiceInitSyncDataArgs() *SyncServiceInitSyncDataArgs {
return &SyncServiceInitSyncDataArgs{}
}
func (p *SyncServiceInitSyncDataArgs) GetFilename() string {
return p.Filename
}
func (p *SyncServiceInitSyncDataArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceInitSyncDataArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Filename = v
}
return nil
}
func (p *SyncServiceInitSyncDataArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "initSyncData_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceInitSyncDataArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "filename", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:filename: ", p), err) }
if err := oprot.WriteString(ctx, string(p.Filename)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.filename (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:filename: ", p), err) }
return err
}
func (p *SyncServiceInitSyncDataArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceInitSyncDataArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceInitSyncDataResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceInitSyncDataResult() *SyncServiceInitSyncDataResult {
return &SyncServiceInitSyncDataResult{}
}
var SyncServiceInitSyncDataResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceInitSyncDataResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceInitSyncDataResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceInitSyncDataResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceInitSyncDataResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceInitSyncDataResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceInitSyncDataResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "initSyncData_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceInitSyncDataResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceInitSyncDataResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceInitSyncDataResult(%+v)", *p)
}
// Attributes:
// - Buff
type SyncServiceSyncDataArgs struct {
Buff []byte `thrift:"buff,1" db:"buff" json:"buff"`
}
func NewSyncServiceSyncDataArgs() *SyncServiceSyncDataArgs {
return &SyncServiceSyncDataArgs{}
}
func (p *SyncServiceSyncDataArgs) GetBuff() []byte {
return p.Buff
}
func (p *SyncServiceSyncDataArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceSyncDataArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadBinary(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Buff = v
}
return nil
}
func (p *SyncServiceSyncDataArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "syncData_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceSyncDataArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "buff", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:buff: ", p), err) }
if err := oprot.WriteBinary(ctx, p.Buff); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.buff (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:buff: ", p), err) }
return err
}
func (p *SyncServiceSyncDataArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceSyncDataArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceSyncDataResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceSyncDataResult() *SyncServiceSyncDataResult {
return &SyncServiceSyncDataResult{}
}
var SyncServiceSyncDataResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceSyncDataResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceSyncDataResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceSyncDataResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceSyncDataResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceSyncDataResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceSyncDataResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "syncData_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceSyncDataResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceSyncDataResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceSyncDataResult(%+v)", *p)
}
// Attributes:
// - Md5
type SyncServiceCheckDataDigestArgs struct {
Md5 string `thrift:"md5,1" db:"md5" json:"md5"`
}
func NewSyncServiceCheckDataDigestArgs() *SyncServiceCheckDataDigestArgs {
return &SyncServiceCheckDataDigestArgs{}
}
func (p *SyncServiceCheckDataDigestArgs) GetMd5() string {
return p.Md5
}
func (p *SyncServiceCheckDataDigestArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceCheckDataDigestArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error {
if v, err := iprot.ReadString(ctx); err != nil {
return thrift.PrependError("error reading field 1: ", err)
} else {
p.Md5 = v
}
return nil
}
func (p *SyncServiceCheckDataDigestArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "checkDataDigest_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField1(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceCheckDataDigestArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) {
if err := oprot.WriteFieldBegin(ctx, "md5", thrift.STRING, 1); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:md5: ", p), err) }
if err := oprot.WriteString(ctx, string(p.Md5)); err != nil {
return thrift.PrependError(fmt.Sprintf("%T.md5 (1) field write error: ", p), err) }
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 1:md5: ", p), err) }
return err
}
func (p *SyncServiceCheckDataDigestArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceCheckDataDigestArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceCheckDataDigestResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceCheckDataDigestResult() *SyncServiceCheckDataDigestResult {
return &SyncServiceCheckDataDigestResult{}
}
var SyncServiceCheckDataDigestResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceCheckDataDigestResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceCheckDataDigestResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceCheckDataDigestResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceCheckDataDigestResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceCheckDataDigestResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceCheckDataDigestResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "checkDataDigest_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceCheckDataDigestResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceCheckDataDigestResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceCheckDataDigestResult(%+v)", *p)
}
type SyncServiceEndSyncArgs struct {
}
func NewSyncServiceEndSyncArgs() *SyncServiceEndSyncArgs {
return &SyncServiceEndSyncArgs{}
}
func (p *SyncServiceEndSyncArgs) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
if err != nil {
return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
}
if fieldTypeId == thrift.STOP { break; }
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceEndSyncArgs) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "endSync_args"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceEndSyncArgs) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceEndSyncArgs(%+v)", *p)
}
// Attributes:
// - Success
type SyncServiceEndSyncResult struct {
Success *SyncStatus `thrift:"success,0" db:"success" json:"success,omitempty"`
}
func NewSyncServiceEndSyncResult() *SyncServiceEndSyncResult {
return &SyncServiceEndSyncResult{}
}
var SyncServiceEndSyncResult_Success_DEFAULT *SyncStatus
func (p *SyncServiceEndSyncResult) GetSuccess() *SyncStatus {
if !p.IsSetSuccess() {
return SyncServiceEndSyncResult_Success_DEFAULT
}
return p.Success
}
func (p *SyncServiceEndSyncResult) IsSetSuccess() bool {
return p.Success != nil
}
func (p *SyncServiceEndSyncResult) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
for {
_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx)
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(ctx, iprot); err != nil {
return err
}
} else {
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
default:
if err := iprot.Skip(ctx, fieldTypeId); err != nil {
return err
}
}
if err := iprot.ReadFieldEnd(ctx); err != nil {
return err
}
}
if err := iprot.ReadStructEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
}
return nil
}
func (p *SyncServiceEndSyncResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error {
p.Success = &SyncStatus{}
if err := p.Success.Read(ctx, iprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
}
return nil
}
func (p *SyncServiceEndSyncResult) Write(ctx context.Context, oprot thrift.TProtocol) error {
if err := oprot.WriteStructBegin(ctx, "endSync_result"); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) }
if p != nil {
if err := p.writeField0(ctx, oprot); err != nil { return err }
}
if err := oprot.WriteFieldStop(ctx); err != nil {
return thrift.PrependError("write field stop error: ", err) }
if err := oprot.WriteStructEnd(ctx); err != nil {
return thrift.PrependError("write struct stop error: ", err) }
return nil
}
func (p *SyncServiceEndSyncResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) {
if p.IsSetSuccess() {
if err := oprot.WriteFieldBegin(ctx, "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(ctx, oprot); err != nil {
return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
}
if err := oprot.WriteFieldEnd(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) }
}
return err
}
func (p *SyncServiceEndSyncResult) String() string {
if p == nil {
return ""
}
return fmt.Sprintf("SyncServiceEndSyncResult(%+v)", *p)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy