283 | 283 |
}
|
284 | 284 |
|
285 | 285 |
type AddServiceClient struct {
|
286 | |
Transport thrift.TTransport
|
287 | |
ProtocolFactory thrift.TProtocolFactory
|
288 | |
InputProtocol thrift.TProtocol
|
289 | |
OutputProtocol thrift.TProtocol
|
290 | |
SeqId int32
|
291 | |
}
|
292 | |
|
|
286 |
c thrift.TClient
|
|
287 |
}
|
|
288 |
|
|
289 |
// Deprecated: Use NewAddService instead
|
293 | 290 |
func NewAddServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AddServiceClient {
|
294 | |
return &AddServiceClient{Transport: t,
|
295 | |
ProtocolFactory: f,
|
296 | |
InputProtocol: f.GetProtocol(t),
|
297 | |
OutputProtocol: f.GetProtocol(t),
|
298 | |
SeqId: 0,
|
299 | |
}
|
300 | |
}
|
301 | |
|
|
291 |
return &AddServiceClient{
|
|
292 |
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
|
|
293 |
}
|
|
294 |
}
|
|
295 |
|
|
296 |
// Deprecated: Use NewAddService instead
|
302 | 297 |
func NewAddServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AddServiceClient {
|
303 | |
return &AddServiceClient{Transport: t,
|
304 | |
ProtocolFactory: nil,
|
305 | |
InputProtocol: iprot,
|
306 | |
OutputProtocol: oprot,
|
307 | |
SeqId: 0,
|
|
298 |
return &AddServiceClient{
|
|
299 |
c: thrift.NewTStandardClient(iprot, oprot),
|
|
300 |
}
|
|
301 |
}
|
|
302 |
|
|
303 |
func NewAddServiceClient(c thrift.TClient) *AddServiceClient {
|
|
304 |
return &AddServiceClient{
|
|
305 |
c: c,
|
308 | 306 |
}
|
309 | 307 |
}
|
310 | 308 |
|
|
312 | 310 |
// - A
|
313 | 311 |
// - B
|
314 | 312 |
func (p *AddServiceClient) Sum(ctx context.Context, a int64, b int64) (r *SumReply, err error) {
|
315 | |
if err = p.sendSum(a, b); err != nil { return }
|
316 | |
return p.recvSum()
|
317 | |
}
|
318 | |
|
319 | |
func (p *AddServiceClient) sendSum(a int64, b int64)(err error) {
|
320 | |
oprot := p.OutputProtocol
|
321 | |
if oprot == nil {
|
322 | |
oprot = p.ProtocolFactory.GetProtocol(p.Transport)
|
323 | |
p.OutputProtocol = oprot
|
324 | |
}
|
325 | |
p.SeqId++
|
326 | |
if err = oprot.WriteMessageBegin("Sum", thrift.CALL, p.SeqId); err != nil {
|
327 | |
return
|
328 | |
}
|
329 | |
args := AddServiceSumArgs{
|
330 | |
A : a,
|
331 | |
B : b,
|
332 | |
}
|
333 | |
if err = args.Write(oprot); err != nil {
|
334 | |
return
|
335 | |
}
|
336 | |
if err = oprot.WriteMessageEnd(); err != nil {
|
337 | |
return
|
338 | |
}
|
339 | |
return oprot.Flush()
|
340 | |
}
|
341 | |
|
342 | |
|
343 | |
func (p *AddServiceClient) recvSum() (value *SumReply, err error) {
|
344 | |
iprot := p.InputProtocol
|
345 | |
if iprot == nil {
|
346 | |
iprot = p.ProtocolFactory.GetProtocol(p.Transport)
|
347 | |
p.InputProtocol = iprot
|
348 | |
}
|
349 | |
method, mTypeId, seqId, err := iprot.ReadMessageBegin()
|
350 | |
if err != nil {
|
|
313 |
var _args0 AddServiceSumArgs
|
|
314 |
_args0.A = a
|
|
315 |
_args0.B = b
|
|
316 |
var _result1 AddServiceSumResult
|
|
317 |
if err = p.c.Call(ctx, "Sum", &_args0, &_result1); err != nil {
|
351 | 318 |
return
|
352 | 319 |
}
|
353 | |
if method != "Sum" {
|
354 | |
err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "Sum failed: wrong method name")
|
355 | |
return
|
356 | |
}
|
357 | |
if p.SeqId != seqId {
|
358 | |
err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Sum failed: out of sequence response")
|
359 | |
return
|
360 | |
}
|
361 | |
if mTypeId == thrift.EXCEPTION {
|
362 | |
error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
|
363 | |
var error1 error
|
364 | |
error1, err = error0.Read(iprot)
|
365 | |
if err != nil {
|
366 | |
return
|
367 | |
}
|
368 | |
if err = iprot.ReadMessageEnd(); err != nil {
|
369 | |
return
|
370 | |
}
|
371 | |
err = error1
|
372 | |
return
|
373 | |
}
|
374 | |
if mTypeId != thrift.REPLY {
|
375 | |
err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "Sum failed: invalid message type")
|
376 | |
return
|
377 | |
}
|
378 | |
result := AddServiceSumResult{}
|
379 | |
if err = result.Read(iprot); err != nil {
|
380 | |
return
|
381 | |
}
|
382 | |
if err = iprot.ReadMessageEnd(); err != nil {
|
383 | |
return
|
384 | |
}
|
385 | |
value = result.GetSuccess()
|
386 | |
return
|
|
320 |
return _result1.GetSuccess(), nil
|
387 | 321 |
}
|
388 | 322 |
|
389 | 323 |
// Parameters:
|
390 | 324 |
// - A
|
391 | 325 |
// - B
|
392 | 326 |
func (p *AddServiceClient) Concat(ctx context.Context, a string, b string) (r *ConcatReply, err error) {
|
393 | |
if err = p.sendConcat(a, b); err != nil { return }
|
394 | |
return p.recvConcat()
|
395 | |
}
|
396 | |
|
397 | |
func (p *AddServiceClient) sendConcat(a string, b string)(err error) {
|
398 | |
oprot := p.OutputProtocol
|
399 | |
if oprot == nil {
|
400 | |
oprot = p.ProtocolFactory.GetProtocol(p.Transport)
|
401 | |
p.OutputProtocol = oprot
|
402 | |
}
|
403 | |
p.SeqId++
|
404 | |
if err = oprot.WriteMessageBegin("Concat", thrift.CALL, p.SeqId); err != nil {
|
405 | |
return
|
406 | |
}
|
407 | |
args := AddServiceConcatArgs{
|
408 | |
A : a,
|
409 | |
B : b,
|
410 | |
}
|
411 | |
if err = args.Write(oprot); err != nil {
|
412 | |
return
|
413 | |
}
|
414 | |
if err = oprot.WriteMessageEnd(); err != nil {
|
415 | |
return
|
416 | |
}
|
417 | |
return oprot.Flush()
|
418 | |
}
|
419 | |
|
420 | |
|
421 | |
func (p *AddServiceClient) recvConcat() (value *ConcatReply, err error) {
|
422 | |
iprot := p.InputProtocol
|
423 | |
if iprot == nil {
|
424 | |
iprot = p.ProtocolFactory.GetProtocol(p.Transport)
|
425 | |
p.InputProtocol = iprot
|
426 | |
}
|
427 | |
method, mTypeId, seqId, err := iprot.ReadMessageBegin()
|
428 | |
if err != nil {
|
|
327 |
var _args2 AddServiceConcatArgs
|
|
328 |
_args2.A = a
|
|
329 |
_args2.B = b
|
|
330 |
var _result3 AddServiceConcatResult
|
|
331 |
if err = p.c.Call(ctx, "Concat", &_args2, &_result3); err != nil {
|
429 | 332 |
return
|
430 | 333 |
}
|
431 | |
if method != "Concat" {
|
432 | |
err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "Concat failed: wrong method name")
|
433 | |
return
|
434 | |
}
|
435 | |
if p.SeqId != seqId {
|
436 | |
err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "Concat failed: out of sequence response")
|
437 | |
return
|
438 | |
}
|
439 | |
if mTypeId == thrift.EXCEPTION {
|
440 | |
error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
|
441 | |
var error3 error
|
442 | |
error3, err = error2.Read(iprot)
|
443 | |
if err != nil {
|
444 | |
return
|
445 | |
}
|
446 | |
if err = iprot.ReadMessageEnd(); err != nil {
|
447 | |
return
|
448 | |
}
|
449 | |
err = error3
|
450 | |
return
|
451 | |
}
|
452 | |
if mTypeId != thrift.REPLY {
|
453 | |
err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "Concat failed: invalid message type")
|
454 | |
return
|
455 | |
}
|
456 | |
result := AddServiceConcatResult{}
|
457 | |
if err = result.Read(iprot); err != nil {
|
458 | |
return
|
459 | |
}
|
460 | |
if err = iprot.ReadMessageEnd(); err != nil {
|
461 | |
return
|
462 | |
}
|
463 | |
value = result.GetSuccess()
|
464 | |
return
|
465 | |
}
|
466 | |
|
|
334 |
return _result3.GetSuccess(), nil
|
|
335 |
}
|
467 | 336 |
|
468 | 337 |
type AddServiceProcessor struct {
|
469 | 338 |
processorMap map[string]thrift.TProcessorFunction
|