blob: b32c37dd2615a3c1f856affcf3664d71594b7f86 [file] [log] [blame]
mpagenkoaf801632020-07-03 10:00:42 +00001// Autogenerated by Thrift Compiler (0.9.3)
2// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
3
4package jaeger
5
6import (
7 "bytes"
8 "fmt"
9 "github.com/uber/jaeger-client-go/thrift"
10)
11
12// (needed to ensure safety because of naive import list construction.)
13var _ = thrift.ZERO
14var _ = fmt.Printf
15var _ = bytes.Equal
16
17type Agent interface {
18 // Parameters:
19 // - Batch
20 EmitBatch(batch *Batch) (err error)
21}
22
23type AgentClient struct {
24 Transport thrift.TTransport
25 ProtocolFactory thrift.TProtocolFactory
26 InputProtocol thrift.TProtocol
27 OutputProtocol thrift.TProtocol
28 SeqId int32
29}
30
31func NewAgentClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AgentClient {
32 return &AgentClient{Transport: t,
33 ProtocolFactory: f,
34 InputProtocol: f.GetProtocol(t),
35 OutputProtocol: f.GetProtocol(t),
36 SeqId: 0,
37 }
38}
39
40func NewAgentClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AgentClient {
41 return &AgentClient{Transport: t,
42 ProtocolFactory: nil,
43 InputProtocol: iprot,
44 OutputProtocol: oprot,
45 SeqId: 0,
46 }
47}
48
49// Parameters:
50// - Batch
51func (p *AgentClient) EmitBatch(batch *Batch) (err error) {
52 if err = p.sendEmitBatch(batch); err != nil {
53 return
54 }
55 return
56}
57
58func (p *AgentClient) sendEmitBatch(batch *Batch) (err error) {
59 oprot := p.OutputProtocol
60 if oprot == nil {
61 oprot = p.ProtocolFactory.GetProtocol(p.Transport)
62 p.OutputProtocol = oprot
63 }
64 p.SeqId++
65 if err = oprot.WriteMessageBegin("emitBatch", thrift.ONEWAY, p.SeqId); err != nil {
66 return
67 }
68 args := AgentEmitBatchArgs{
69 Batch: batch,
70 }
71 if err = args.Write(oprot); err != nil {
72 return
73 }
74 if err = oprot.WriteMessageEnd(); err != nil {
75 return
76 }
77 return oprot.Flush()
78}
79
80type AgentProcessor struct {
81 processorMap map[string]thrift.TProcessorFunction
82 handler Agent
83}
84
85func (p *AgentProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
86 p.processorMap[key] = processor
87}
88
89func (p *AgentProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
90 processor, ok = p.processorMap[key]
91 return processor, ok
92}
93
94func (p *AgentProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
95 return p.processorMap
96}
97
98func NewAgentProcessor(handler Agent) *AgentProcessor {
99
100 self6 := &AgentProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
101 self6.processorMap["emitBatch"] = &agentProcessorEmitBatch{handler: handler}
102 return self6
103}
104
105func (p *AgentProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
106 name, _, seqId, err := iprot.ReadMessageBegin()
107 if err != nil {
108 return false, err
109 }
110 if processor, ok := p.GetProcessorFunction(name); ok {
111 return processor.Process(seqId, iprot, oprot)
112 }
113 iprot.Skip(thrift.STRUCT)
114 iprot.ReadMessageEnd()
115 x7 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
116 oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
117 x7.Write(oprot)
118 oprot.WriteMessageEnd()
119 oprot.Flush()
120 return false, x7
121
122}
123
124type agentProcessorEmitBatch struct {
125 handler Agent
126}
127
128func (p *agentProcessorEmitBatch) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
129 args := AgentEmitBatchArgs{}
130 if err = args.Read(iprot); err != nil {
131 iprot.ReadMessageEnd()
132 return false, err
133 }
134
135 iprot.ReadMessageEnd()
136 var err2 error
137 if err2 = p.handler.EmitBatch(args.Batch); err2 != nil {
138 return true, err2
139 }
140 return true, nil
141}
142
143// HELPER FUNCTIONS AND STRUCTURES
144
145// Attributes:
146// - Batch
147type AgentEmitBatchArgs struct {
148 Batch *Batch `thrift:"batch,1" json:"batch"`
149}
150
151func NewAgentEmitBatchArgs() *AgentEmitBatchArgs {
152 return &AgentEmitBatchArgs{}
153}
154
155var AgentEmitBatchArgs_Batch_DEFAULT *Batch
156
157func (p *AgentEmitBatchArgs) GetBatch() *Batch {
158 if !p.IsSetBatch() {
159 return AgentEmitBatchArgs_Batch_DEFAULT
160 }
161 return p.Batch
162}
163func (p *AgentEmitBatchArgs) IsSetBatch() bool {
164 return p.Batch != nil
165}
166
167func (p *AgentEmitBatchArgs) Read(iprot thrift.TProtocol) error {
168 if _, err := iprot.ReadStructBegin(); err != nil {
169 return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
170 }
171
172 for {
173 _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
174 if err != nil {
175 return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
176 }
177 if fieldTypeId == thrift.STOP {
178 break
179 }
180 switch fieldId {
181 case 1:
182 if err := p.readField1(iprot); err != nil {
183 return err
184 }
185 default:
186 if err := iprot.Skip(fieldTypeId); err != nil {
187 return err
188 }
189 }
190 if err := iprot.ReadFieldEnd(); err != nil {
191 return err
192 }
193 }
194 if err := iprot.ReadStructEnd(); err != nil {
195 return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
196 }
197 return nil
198}
199
200func (p *AgentEmitBatchArgs) readField1(iprot thrift.TProtocol) error {
201 p.Batch = &Batch{}
202 if err := p.Batch.Read(iprot); err != nil {
203 return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Batch), err)
204 }
205 return nil
206}
207
208func (p *AgentEmitBatchArgs) Write(oprot thrift.TProtocol) error {
209 if err := oprot.WriteStructBegin("emitBatch_args"); err != nil {
210 return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
211 }
212 if err := p.writeField1(oprot); err != nil {
213 return err
214 }
215 if err := oprot.WriteFieldStop(); err != nil {
216 return thrift.PrependError("write field stop error: ", err)
217 }
218 if err := oprot.WriteStructEnd(); err != nil {
219 return thrift.PrependError("write struct stop error: ", err)
220 }
221 return nil
222}
223
224func (p *AgentEmitBatchArgs) writeField1(oprot thrift.TProtocol) (err error) {
225 if err := oprot.WriteFieldBegin("batch", thrift.STRUCT, 1); err != nil {
226 return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batch: ", p), err)
227 }
228 if err := p.Batch.Write(oprot); err != nil {
229 return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Batch), err)
230 }
231 if err := oprot.WriteFieldEnd(); err != nil {
232 return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batch: ", p), err)
233 }
234 return err
235}
236
237func (p *AgentEmitBatchArgs) String() string {
238 if p == nil {
239 return "<nil>"
240 }
241 return fmt.Sprintf("AgentEmitBatchArgs(%+v)", *p)
242}