本文整理汇总了Golang中git/apache/org/thrift/git/lib/go/thrift.TProtocol.Flush方法的典型用法代码示例。如果您正苦于以下问题:Golang TProtocol.Flush方法的具体用法?Golang TProtocol.Flush怎么用?Golang TProtocol.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git/apache/org/thrift/git/lib/go/thrift.TProtocol
的用法示例。
在下文中一共展示了TProtocol.Flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Process
func (p *SharedServiceProcessor) Process(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(seqId, iprot, oprot)
}
iprot.Skip(thrift.STRUCT)
iprot.ReadMessageEnd()
x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
x3.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, x3
}
示例2: Process
func (t TestProcessor) Process(in, out thrift.TProtocol) (bool, thrift.TException) {
str, err := in.ReadString()
if err != nil {
fmt.Println("ReadError:", err)
return false, nil
}
if err = out.WriteString(str); err != nil {
fmt.Println("WriteError", err)
return false, nil
}
if err = out.Flush(); err != nil {
fmt.Println("FlushError", err)
return false, nil
}
return true, nil
}
示例3: Process
func (p *mutableEphemeralStateServiceProcessorGetState) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := GetStateArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("getState", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := GetStateResult{}
var retval []byte
var err2 error
if retval, err2 = p.handler.GetState(args.Key); err2 != nil {
switch v := err2.(type) {
case *BoltError:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getState: "+err2.Error())
oprot.WriteMessageBegin("getState", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("getState", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例4: Process
func (p *liveManagerProcessorSendLiveMessage) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SendLiveMessageArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("sendLiveMessage", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := SendLiveMessageResult{}
var retval int64
var err2 error
if retval, err2 = p.handler.SendLiveMessage(args.Rid, args.Uid, args.Comment, args.FromInfo); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing sendLiveMessage: "+err2.Error())
oprot.WriteMessageBegin("sendLiveMessage", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
} else {
result.Success = &retval
}
if err2 = oprot.WriteMessageBegin("sendLiveMessage", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例5: Process
func (p *privateMessageManagerSyncProcessorGetPrivateMessageList) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := GetPrivateMessageListArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("getPrivateMessageList", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := GetPrivateMessageListResult{}
var retval []*entity.PrivateMessageResult_
var err2 error
if retval, err2 = p.handler.GetPrivateMessageList(args.Uid, args.StartReceiveTime, args.EndReceiveTime, args.StartId, args.IsReversed, args.RowCount); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getPrivateMessageList: "+err2.Error())
oprot.WriteMessageBegin("getPrivateMessageList", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("getPrivateMessageList", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例6: Process
func (p *computationServiceProcessorBoltMetadata) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := BoltMetadataArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("boltMetadata", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := BoltMetadataResult{}
var retval *ComputationMetadata
var err2 error
if retval, err2 = p.handler.BoltMetadata(); err2 != nil {
switch v := err2.(type) {
case *BoltError:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing boltMetadata: "+err2.Error())
oprot.WriteMessageBegin("boltMetadata", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("boltMetadata", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例7: Process
func (p *friendManagerSyncProcessorGetFriends) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := GetFriendsArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("getFriends", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := GetFriendsResult{}
var retval []*entity.Friend
var err2 error
if retval, err2 = p.handler.GetFriends(args.Uid); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getFriends: "+err2.Error())
oprot.WriteMessageBegin("getFriends", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
} else {
result.Success = retval
}
if err2 = oprot.WriteMessageBegin("getFriends", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例8: Process
func (p *calculatorProcessorCalculate) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := CalculateArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("calculate", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := CalculateResult{}
var retval int32
var err2 error
if retval, err2 = p.handler.Calculate(args.Logid, args.W); err2 != nil {
switch v := err2.(type) {
case *InvalidOperation:
result.Ouch = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing calculate: "+err2.Error())
oprot.WriteMessageBegin("calculate", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
} else {
result.Success = &retval
}
if err2 = oprot.WriteMessageBegin("calculate", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例9: Process
func (p *smsManagerProcessorSendShortMsg) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SendShortMsgArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("sendShortMsg", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := SendShortMsgResult{}
var err2 error
if err2 = p.handler.SendShortMsg(args.PhoneNumber, args.Content, args.Zone); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing sendShortMsg: "+err2.Error())
oprot.WriteMessageBegin("sendShortMsg", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("sendShortMsg", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例10: Process
func (p *inviteCodeManagerProcessorUseInviteCode) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := UseInviteCodeArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("useInviteCode", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := UseInviteCodeResult{}
var err2 error
if err2 = p.handler.UseInviteCode(args.Code, args.FromType, args.FromInfo); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing useInviteCode: "+err2.Error())
oprot.WriteMessageBegin("useInviteCode", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("useInviteCode", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例11: Process
func (p *boltManagerServiceProcessorSignal) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := SignalArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("signal", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := SignalResult{}
var err2 error
if err2 = p.handler.Signal(args.TopologyId, args.S); err2 != nil {
switch v := err2.(type) {
case *BoltError:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing signal: "+err2.Error())
oprot.WriteMessageBegin("signal", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("signal", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例12: Process
func (p *tagManagerProcessorGetTagsByUid) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := GetTagsByUidArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("getTagsByUid", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := GetTagsByUidResult{}
var err2 error
if err2 = p.handler.GetTagsByUid(args.Uid, args.StartRid, args.RowCount, args.FromInfo); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing getTagsByUid: "+err2.Error())
oprot.WriteMessageBegin("getTagsByUid", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("getTagsByUid", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例13: Process
func (p *boltProxyServiceProcessorUpdateSchedulerAddress) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := UpdateSchedulerAddressArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("updateSchedulerAddress", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := UpdateSchedulerAddressResult{}
var err2 error
if err2 = p.handler.UpdateSchedulerAddress(args.E); err2 != nil {
switch v := err2.(type) {
case *BoltError:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing updateSchedulerAddress: "+err2.Error())
oprot.WriteMessageBegin("updateSchedulerAddress", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("updateSchedulerAddress", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例14: Process
func (p *resourceHistoryManagerProcessorDeleteResourceViewHistory) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := DeleteResourceViewHistoryArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("deleteResourceViewHistory", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := DeleteResourceViewHistoryResult{}
var err2 error
if err2 = p.handler.DeleteResourceViewHistory(args.Uid, args.ViewTime, args.Rid, args.FromInfo); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing deleteResourceViewHistory: "+err2.Error())
oprot.WriteMessageBegin("deleteResourceViewHistory", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("deleteResourceViewHistory", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}
示例15: Process
func (p *statusManagerSyncProcessorUpdateStatus) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
args := UpdateStatusArgs{}
if err = args.Read(iprot); err != nil {
iprot.ReadMessageEnd()
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
oprot.WriteMessageBegin("updateStatus", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return false, err
}
iprot.ReadMessageEnd()
result := UpdateStatusResult{}
var err2 error
if err2 = p.handler.UpdateStatus(args.Key, args.StatusType, args.UpdateType); err2 != nil {
switch v := err2.(type) {
case *entity.UdsException:
result.E = v
default:
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing updateStatus: "+err2.Error())
oprot.WriteMessageBegin("updateStatus", thrift.EXCEPTION, seqId)
x.Write(oprot)
oprot.WriteMessageEnd()
oprot.Flush()
return true, err2
}
}
if err2 = oprot.WriteMessageBegin("updateStatus", 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(); err == nil && err2 != nil {
err = err2
}
if err != nil {
return
}
return true, err
}