| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486 |
- // Autogenerated by Thrift Compiler (0.9.2)
- // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- package common
- import (
- "bytes"
- "fmt"
- "gmanager/library/thrift"
- )
- // (needed to ensure safety because of naive import list construction.)
- var _ = thrift.ZERO
- var _ = fmt.Printf
- var _ = bytes.Equal
- type RPCRequestGMIFace interface {
- // Parameters:
- // - Reserved
- // - Cmd
- IdipGm(reserved string, cmd string) (r *Result_, err error)
- }
- type RPCRequestGMIFaceClient struct {
- Transport thrift.TTransport
- ProtocolFactory thrift.TProtocolFactory
- InputProtocol thrift.TProtocol
- OutputProtocol thrift.TProtocol
- SeqId int32
- }
- func NewRPCRequestGMIFaceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *RPCRequestGMIFaceClient {
- return &RPCRequestGMIFaceClient{Transport: t,
- ProtocolFactory: f,
- InputProtocol: f.GetProtocol(t),
- OutputProtocol: f.GetProtocol(t),
- SeqId: 0,
- }
- }
- func NewRPCRequestGMIFaceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *RPCRequestGMIFaceClient {
- return &RPCRequestGMIFaceClient{Transport: t,
- ProtocolFactory: nil,
- InputProtocol: iprot,
- OutputProtocol: oprot,
- SeqId: 0,
- }
- }
- // Parameters:
- // - Reserved
- // - Cmd
- func (p *RPCRequestGMIFaceClient) IdipGm(reserved string, cmd string) (r *Result_, err error) {
- if err = p.sendIdipGm(reserved, cmd); err != nil {
- return
- }
- return p.recvIdipGm()
- }
- func (p *RPCRequestGMIFaceClient) sendIdipGm(reserved string, cmd string) (err error) {
- oprot := p.OutputProtocol
- if oprot == nil {
- oprot = p.ProtocolFactory.GetProtocol(p.Transport)
- p.OutputProtocol = oprot
- }
- p.SeqId++
- if err = oprot.WriteMessageBegin("idipGm", thrift.CALL, p.SeqId); err != nil {
- return
- }
- args := IdipGmArgs{
- Reserved: reserved,
- Cmd: cmd,
- }
- if err = args.Write(oprot); err != nil {
- return
- }
- if err = oprot.WriteMessageEnd(); err != nil {
- return
- }
- return oprot.Flush()
- }
- func (p *RPCRequestGMIFaceClient) recvIdipGm() (value *Result_, err error) {
- iprot := p.InputProtocol
- if iprot == nil {
- iprot = p.ProtocolFactory.GetProtocol(p.Transport)
- p.InputProtocol = iprot
- }
- _, mTypeId, seqId, err := iprot.ReadMessageBegin()
- if err != nil {
- return
- }
- if mTypeId == thrift.EXCEPTION {
- error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
- var error1 error
- error1, err = error0.Read(iprot)
- if err != nil {
- return
- }
- if err = iprot.ReadMessageEnd(); err != nil {
- return
- }
- err = error1
- return
- }
- if p.SeqId != seqId {
- err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "idipGm failed: out of sequence response")
- return
- }
- result := IdipGmResult{}
- if err = result.Read(iprot); err != nil {
- return
- }
- if err = iprot.ReadMessageEnd(); err != nil {
- return
- }
- if result.Ouch != nil {
- err = result.Ouch
- return
- }
- value = result.GetSuccess()
- return
- }
- type RPCRequestGMIFaceProcessor struct {
- processorMap map[string]thrift.TProcessorFunction
- handler RPCRequestGMIFace
- }
- func (p *RPCRequestGMIFaceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
- p.processorMap[key] = processor
- }
- func (p *RPCRequestGMIFaceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
- processor, ok = p.processorMap[key]
- return processor, ok
- }
- func (p *RPCRequestGMIFaceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
- return p.processorMap
- }
- func NewRPCRequestGMIFaceProcessor(handler RPCRequestGMIFace) *RPCRequestGMIFaceProcessor {
- self2 := &RPCRequestGMIFaceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
- self2.processorMap["idipGm"] = &rPCRequestGMIFaceProcessorIdipGm{handler: handler}
- return self2
- }
- func (p *RPCRequestGMIFaceProcessor) 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
- }
- type rPCRequestGMIFaceProcessorIdipGm struct {
- handler RPCRequestGMIFace
- }
- func (p *rPCRequestGMIFaceProcessorIdipGm) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
- args := IdipGmArgs{}
- if err = args.Read(iprot); err != nil {
- iprot.ReadMessageEnd()
- x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
- oprot.WriteMessageBegin("idipGm", thrift.EXCEPTION, seqId)
- x.Write(oprot)
- oprot.WriteMessageEnd()
- oprot.Flush()
- return false, err
- }
- iprot.ReadMessageEnd()
- result := IdipGmResult{}
- var retval *Result_
- var err2 error
- if retval, err2 = p.handler.IdipGm(args.Reserved, args.Cmd); err2 != nil {
- switch v := err2.(type) {
- case *InvalidOperException:
- result.Ouch = v
- default:
- x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing idipGm: "+err2.Error())
- oprot.WriteMessageBegin("idipGm", thrift.EXCEPTION, seqId)
- x.Write(oprot)
- oprot.WriteMessageEnd()
- oprot.Flush()
- return true, err2
- }
- } else {
- result.Success = retval
- }
- if err2 = oprot.WriteMessageBegin("idipGm", 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
- }
- // HELPER FUNCTIONS AND STRUCTURES
- type IdipGmArgs struct {
- Reserved string `thrift:"reserved,1" json:"reserved"`
- Cmd string `thrift:"cmd,2" json:"cmd"`
- }
- func NewIdipGmArgs() *IdipGmArgs {
- return &IdipGmArgs{}
- }
- func (p *IdipGmArgs) GetReserved() string {
- return p.Reserved
- }
- func (p *IdipGmArgs) GetCmd() string {
- return p.Cmd
- }
- func (p *IdipGmArgs) Read(iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(); err != nil {
- return fmt.Errorf("%T read error: %s", p, err)
- }
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
- if err != nil {
- return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
- }
- if fieldTypeId == thrift.STOP {
- break
- }
- switch fieldId {
- case 1:
- if err := p.ReadField1(iprot); err != nil {
- return err
- }
- case 2:
- if err := p.ReadField2(iprot); err != nil {
- return err
- }
- default:
- if err := iprot.Skip(fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(); err != nil {
- return fmt.Errorf("%T read struct end error: %s", p, err)
- }
- return nil
- }
- func (p *IdipGmArgs) ReadField1(iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(); err != nil {
- return fmt.Errorf("error reading field 1: %s", err)
- } else {
- p.Reserved = v
- }
- return nil
- }
- func (p *IdipGmArgs) ReadField2(iprot thrift.TProtocol) error {
- if v, err := iprot.ReadString(); err != nil {
- return fmt.Errorf("error reading field 2: %s", err)
- } else {
- p.Cmd = v
- }
- return nil
- }
- func (p *IdipGmArgs) Write(oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin("idipGm_args"); err != nil {
- return fmt.Errorf("%T write struct begin error: %s", p, err)
- }
- if err := p.writeField1(oprot); err != nil {
- return err
- }
- if err := p.writeField2(oprot); err != nil {
- return err
- }
- if err := oprot.WriteFieldStop(); err != nil {
- return fmt.Errorf("write field stop error: %s", err)
- }
- if err := oprot.WriteStructEnd(); err != nil {
- return fmt.Errorf("write struct stop error: %s", err)
- }
- return nil
- }
- func (p *IdipGmArgs) writeField1(oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("reserved", thrift.STRING, 1); err != nil {
- return fmt.Errorf("%T write field begin error 1:reserved: %s", p, err)
- }
- if err := oprot.WriteString(string(p.Reserved)); err != nil {
- return fmt.Errorf("%T.reserved (1) field write error: %s", p, err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return fmt.Errorf("%T write field end error 1:reserved: %s", p, err)
- }
- return err
- }
- func (p *IdipGmArgs) writeField2(oprot thrift.TProtocol) (err error) {
- if err := oprot.WriteFieldBegin("cmd", thrift.STRING, 2); err != nil {
- return fmt.Errorf("%T write field begin error 2:cmd: %s", p, err)
- }
- if err := oprot.WriteString(string(p.Cmd)); err != nil {
- return fmt.Errorf("%T.cmd (2) field write error: %s", p, err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return fmt.Errorf("%T write field end error 2:cmd: %s", p, err)
- }
- return err
- }
- func (p *IdipGmArgs) String() string {
- if p == nil {
- return "<nil>"
- }
- return fmt.Sprintf("IdipGmArgs(%+v)", *p)
- }
- type IdipGmResult struct {
- Success *Result_ `thrift:"success,0" json:"success"`
- Ouch *InvalidOperException `thrift:"ouch,1" json:"ouch"`
- }
- func NewIdipGmResult() *IdipGmResult {
- return &IdipGmResult{}
- }
- var IdipGmResult_Success_DEFAULT *Result_
- func (p *IdipGmResult) GetSuccess() *Result_ {
- if !p.IsSetSuccess() {
- return IdipGmResult_Success_DEFAULT
- }
- return p.Success
- }
- var IdipGmResult_Ouch_DEFAULT *InvalidOperException
- func (p *IdipGmResult) GetOuch() *InvalidOperException {
- if !p.IsSetOuch() {
- return IdipGmResult_Ouch_DEFAULT
- }
- return p.Ouch
- }
- func (p *IdipGmResult) IsSetSuccess() bool {
- return p.Success != nil
- }
- func (p *IdipGmResult) IsSetOuch() bool {
- return p.Ouch != nil
- }
- func (p *IdipGmResult) Read(iprot thrift.TProtocol) error {
- if _, err := iprot.ReadStructBegin(); err != nil {
- return fmt.Errorf("%T read error: %s", p, err)
- }
- for {
- _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
- if err != nil {
- return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
- }
- if fieldTypeId == thrift.STOP {
- break
- }
- switch fieldId {
- case 0:
- if err := p.ReadField0(iprot); err != nil {
- return err
- }
- case 1:
- if err := p.ReadField1(iprot); err != nil {
- return err
- }
- default:
- if err := iprot.Skip(fieldTypeId); err != nil {
- return err
- }
- }
- if err := iprot.ReadFieldEnd(); err != nil {
- return err
- }
- }
- if err := iprot.ReadStructEnd(); err != nil {
- return fmt.Errorf("%T read struct end error: %s", p, err)
- }
- return nil
- }
- func (p *IdipGmResult) ReadField0(iprot thrift.TProtocol) error {
- p.Success = &Result_{}
- if err := p.Success.Read(iprot); err != nil {
- return fmt.Errorf("%T error reading struct: %s", p.Success, err)
- }
- return nil
- }
- func (p *IdipGmResult) ReadField1(iprot thrift.TProtocol) error {
- p.Ouch = &InvalidOperException{}
- if err := p.Ouch.Read(iprot); err != nil {
- return fmt.Errorf("%T error reading struct: %s", p.Ouch, err)
- }
- return nil
- }
- func (p *IdipGmResult) Write(oprot thrift.TProtocol) error {
- if err := oprot.WriteStructBegin("idipGm_result"); err != nil {
- return fmt.Errorf("%T write struct begin error: %s", p, err)
- }
- if err := p.writeField0(oprot); err != nil {
- return err
- }
- if err := p.writeField1(oprot); err != nil {
- return err
- }
- if err := oprot.WriteFieldStop(); err != nil {
- return fmt.Errorf("write field stop error: %s", err)
- }
- if err := oprot.WriteStructEnd(); err != nil {
- return fmt.Errorf("write struct stop error: %s", err)
- }
- return nil
- }
- func (p *IdipGmResult) writeField0(oprot thrift.TProtocol) (err error) {
- if p.IsSetSuccess() {
- if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
- return fmt.Errorf("%T write field begin error 0:success: %s", p, err)
- }
- if err := p.Success.Write(oprot); err != nil {
- return fmt.Errorf("%T error writing struct: %s", p.Success, err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return fmt.Errorf("%T write field end error 0:success: %s", p, err)
- }
- }
- return err
- }
- func (p *IdipGmResult) writeField1(oprot thrift.TProtocol) (err error) {
- if p.IsSetOuch() {
- if err := oprot.WriteFieldBegin("ouch", thrift.STRUCT, 1); err != nil {
- return fmt.Errorf("%T write field begin error 1:ouch: %s", p, err)
- }
- if err := p.Ouch.Write(oprot); err != nil {
- return fmt.Errorf("%T error writing struct: %s", p.Ouch, err)
- }
- if err := oprot.WriteFieldEnd(); err != nil {
- return fmt.Errorf("%T write field end error 1:ouch: %s", p, err)
- }
- }
- return err
- }
- func (p *IdipGmResult) String() string {
- if p == nil {
- return "<nil>"
- }
- return fmt.Sprintf("IdipGmResult(%+v)", *p)
- }
|