/
tchan-gauntlet_tchannel.go
1041 lines (861 loc) · 26.9 KB
/
tchan-gauntlet_tchannel.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// @generated Code generated by thrift-gen. Do not modify.
// Copyright (c) 2019 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// Package gauntlet_tchannel is generated code used to make or handle TChannel calls using Thrift.
package gauntlet_tchannel
import (
"fmt"
athrift "github.com/apache/thrift/lib/go/thrift"
"github.com/uber/tchannel-go/thrift"
)
// Interfaces for the service and client for the services defined in the IDL.
// TChanSecondService is the interface that defines the server handler and client interface.
type TChanSecondService interface {
BlahBlah(ctx thrift.Context) error
SecondtestString(ctx thrift.Context, thing string) (string, error)
}
// TChanThriftTest is the interface that defines the server handler and client interface.
type TChanThriftTest interface {
TestBinary(ctx thrift.Context, thing []byte) ([]byte, error)
TestByte(ctx thrift.Context, thing int8) (int8, error)
TestDouble(ctx thrift.Context, thing float64) (float64, error)
TestEnum(ctx thrift.Context, thing Numberz) (Numberz, error)
TestException(ctx thrift.Context, arg string) error
TestI32(ctx thrift.Context, thing int32) (int32, error)
TestI64(ctx thrift.Context, thing int64) (int64, error)
TestInsanity(ctx thrift.Context, argument *Insanity) (map[UserId]map[Numberz]*Insanity, error)
TestList(ctx thrift.Context, thing []int32) ([]int32, error)
TestMap(ctx thrift.Context, thing map[int32]int32) (map[int32]int32, error)
TestMapMap(ctx thrift.Context, hello int32) (map[int32]map[int32]int32, error)
TestMulti(ctx thrift.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 Numberz, arg5 UserId) (*Xtruct, error)
TestMultiException(ctx thrift.Context, arg0 string, arg1 string) (*Xtruct, error)
TestNest(ctx thrift.Context, thing *Xtruct2) (*Xtruct2, error)
TestSet(ctx thrift.Context, thing map[int32]bool) (map[int32]bool, error)
TestString(ctx thrift.Context, thing string) (string, error)
TestStringMap(ctx thrift.Context, thing map[string]string) (map[string]string, error)
TestStruct(ctx thrift.Context, thing *Xtruct) (*Xtruct, error)
TestTypedef(ctx thrift.Context, thing UserId) (UserId, error)
TestVoid(ctx thrift.Context) error
}
// Implementation of a client and service handler.
type tchanSecondServiceClient struct {
thriftService string
client thrift.TChanClient
}
func NewTChanSecondServiceInheritedClient(thriftService string, client thrift.TChanClient) *tchanSecondServiceClient {
return &tchanSecondServiceClient{
thriftService,
client,
}
}
// NewTChanSecondServiceClient creates a client that can be used to make remote calls.
func NewTChanSecondServiceClient(client thrift.TChanClient) TChanSecondService {
return NewTChanSecondServiceInheritedClient("SecondService", client)
}
func (c *tchanSecondServiceClient) BlahBlah(ctx thrift.Context) error {
var resp SecondServiceBlahBlahResult
args := SecondServiceBlahBlahArgs{}
success, err := c.client.Call(ctx, c.thriftService, "blahBlah", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for blahBlah")
}
}
return err
}
func (c *tchanSecondServiceClient) SecondtestString(ctx thrift.Context, thing string) (string, error) {
var resp SecondServiceSecondtestStringResult
args := SecondServiceSecondtestStringArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "secondtestString", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for secondtestString")
}
}
return resp.GetSuccess(), err
}
type tchanSecondServiceServer struct {
handler TChanSecondService
}
// NewTChanSecondServiceServer wraps a handler for TChanSecondService so it can be
// registered with a thrift.Server.
func NewTChanSecondServiceServer(handler TChanSecondService) thrift.TChanServer {
return &tchanSecondServiceServer{
handler,
}
}
func (s *tchanSecondServiceServer) Service() string {
return "SecondService"
}
func (s *tchanSecondServiceServer) Methods() []string {
return []string{
"blahBlah",
"secondtestString",
}
}
func (s *tchanSecondServiceServer) Handle(ctx thrift.Context, methodName string, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
switch methodName {
case "blahBlah":
return s.handleBlahBlah(ctx, protocol)
case "secondtestString":
return s.handleSecondtestString(ctx, protocol)
default:
return false, nil, fmt.Errorf("method %v not found in service %v", methodName, s.Service())
}
}
func (s *tchanSecondServiceServer) handleBlahBlah(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req SecondServiceBlahBlahArgs
var res SecondServiceBlahBlahResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
err :=
s.handler.BlahBlah(ctx)
if err != nil {
return false, nil, err
} else {
}
return err == nil, &res, nil
}
func (s *tchanSecondServiceServer) handleSecondtestString(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req SecondServiceSecondtestStringArgs
var res SecondServiceSecondtestStringResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.SecondtestString(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
type tchanThriftTestClient struct {
thriftService string
client thrift.TChanClient
}
func NewTChanThriftTestInheritedClient(thriftService string, client thrift.TChanClient) *tchanThriftTestClient {
return &tchanThriftTestClient{
thriftService,
client,
}
}
// NewTChanThriftTestClient creates a client that can be used to make remote calls.
func NewTChanThriftTestClient(client thrift.TChanClient) TChanThriftTest {
return NewTChanThriftTestInheritedClient("ThriftTest", client)
}
func (c *tchanThriftTestClient) TestBinary(ctx thrift.Context, thing []byte) ([]byte, error) {
var resp ThriftTestTestBinaryResult
args := ThriftTestTestBinaryArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testBinary", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testBinary")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestByte(ctx thrift.Context, thing int8) (int8, error) {
var resp ThriftTestTestByteResult
args := ThriftTestTestByteArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testByte", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testByte")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestDouble(ctx thrift.Context, thing float64) (float64, error) {
var resp ThriftTestTestDoubleResult
args := ThriftTestTestDoubleArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testDouble", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testDouble")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestEnum(ctx thrift.Context, thing Numberz) (Numberz, error) {
var resp ThriftTestTestEnumResult
args := ThriftTestTestEnumArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testEnum", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testEnum")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestException(ctx thrift.Context, arg string) error {
var resp ThriftTestTestExceptionResult
args := ThriftTestTestExceptionArgs{
Arg: arg,
}
success, err := c.client.Call(ctx, c.thriftService, "testException", &args, &resp)
if err == nil && !success {
switch {
case resp.Err1 != nil:
err = resp.Err1
default:
err = fmt.Errorf("received no result or unknown exception for testException")
}
}
return err
}
func (c *tchanThriftTestClient) TestI32(ctx thrift.Context, thing int32) (int32, error) {
var resp ThriftTestTestI32Result
args := ThriftTestTestI32Args{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testI32", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testI32")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestI64(ctx thrift.Context, thing int64) (int64, error) {
var resp ThriftTestTestI64Result
args := ThriftTestTestI64Args{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testI64", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testI64")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestInsanity(ctx thrift.Context, argument *Insanity) (map[UserId]map[Numberz]*Insanity, error) {
var resp ThriftTestTestInsanityResult
args := ThriftTestTestInsanityArgs{
Argument: argument,
}
success, err := c.client.Call(ctx, c.thriftService, "testInsanity", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testInsanity")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestList(ctx thrift.Context, thing []int32) ([]int32, error) {
var resp ThriftTestTestListResult
args := ThriftTestTestListArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testList", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testList")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestMap(ctx thrift.Context, thing map[int32]int32) (map[int32]int32, error) {
var resp ThriftTestTestMapResult
args := ThriftTestTestMapArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testMap", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testMap")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestMapMap(ctx thrift.Context, hello int32) (map[int32]map[int32]int32, error) {
var resp ThriftTestTestMapMapResult
args := ThriftTestTestMapMapArgs{
Hello: hello,
}
success, err := c.client.Call(ctx, c.thriftService, "testMapMap", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testMapMap")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestMulti(ctx thrift.Context, arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 Numberz, arg5 UserId) (*Xtruct, error) {
var resp ThriftTestTestMultiResult
args := ThriftTestTestMultiArgs{
Arg0: arg0,
Arg1: arg1,
Arg2: arg2,
Arg3: arg3,
Arg4: arg4,
Arg5: arg5,
}
success, err := c.client.Call(ctx, c.thriftService, "testMulti", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testMulti")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestMultiException(ctx thrift.Context, arg0 string, arg1 string) (*Xtruct, error) {
var resp ThriftTestTestMultiExceptionResult
args := ThriftTestTestMultiExceptionArgs{
Arg0: arg0,
Arg1: arg1,
}
success, err := c.client.Call(ctx, c.thriftService, "testMultiException", &args, &resp)
if err == nil && !success {
switch {
case resp.Err1 != nil:
err = resp.Err1
case resp.Err2 != nil:
err = resp.Err2
default:
err = fmt.Errorf("received no result or unknown exception for testMultiException")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestNest(ctx thrift.Context, thing *Xtruct2) (*Xtruct2, error) {
var resp ThriftTestTestNestResult
args := ThriftTestTestNestArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testNest", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testNest")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestSet(ctx thrift.Context, thing map[int32]bool) (map[int32]bool, error) {
var resp ThriftTestTestSetResult
args := ThriftTestTestSetArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testSet", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testSet")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestString(ctx thrift.Context, thing string) (string, error) {
var resp ThriftTestTestStringResult
args := ThriftTestTestStringArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testString", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testString")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestStringMap(ctx thrift.Context, thing map[string]string) (map[string]string, error) {
var resp ThriftTestTestStringMapResult
args := ThriftTestTestStringMapArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testStringMap", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testStringMap")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestStruct(ctx thrift.Context, thing *Xtruct) (*Xtruct, error) {
var resp ThriftTestTestStructResult
args := ThriftTestTestStructArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testStruct", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testStruct")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestTypedef(ctx thrift.Context, thing UserId) (UserId, error) {
var resp ThriftTestTestTypedefResult
args := ThriftTestTestTypedefArgs{
Thing: thing,
}
success, err := c.client.Call(ctx, c.thriftService, "testTypedef", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testTypedef")
}
}
return resp.GetSuccess(), err
}
func (c *tchanThriftTestClient) TestVoid(ctx thrift.Context) error {
var resp ThriftTestTestVoidResult
args := ThriftTestTestVoidArgs{}
success, err := c.client.Call(ctx, c.thriftService, "testVoid", &args, &resp)
if err == nil && !success {
switch {
default:
err = fmt.Errorf("received no result or unknown exception for testVoid")
}
}
return err
}
type tchanThriftTestServer struct {
handler TChanThriftTest
}
// NewTChanThriftTestServer wraps a handler for TChanThriftTest so it can be
// registered with a thrift.Server.
func NewTChanThriftTestServer(handler TChanThriftTest) thrift.TChanServer {
return &tchanThriftTestServer{
handler,
}
}
func (s *tchanThriftTestServer) Service() string {
return "ThriftTest"
}
func (s *tchanThriftTestServer) Methods() []string {
return []string{
"testBinary",
"testByte",
"testDouble",
"testEnum",
"testException",
"testI32",
"testI64",
"testInsanity",
"testList",
"testMap",
"testMapMap",
"testMulti",
"testMultiException",
"testNest",
"testSet",
"testString",
"testStringMap",
"testStruct",
"testTypedef",
"testVoid",
}
}
func (s *tchanThriftTestServer) Handle(ctx thrift.Context, methodName string, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
switch methodName {
case "testBinary":
return s.handleTestBinary(ctx, protocol)
case "testByte":
return s.handleTestByte(ctx, protocol)
case "testDouble":
return s.handleTestDouble(ctx, protocol)
case "testEnum":
return s.handleTestEnum(ctx, protocol)
case "testException":
return s.handleTestException(ctx, protocol)
case "testI32":
return s.handleTestI32(ctx, protocol)
case "testI64":
return s.handleTestI64(ctx, protocol)
case "testInsanity":
return s.handleTestInsanity(ctx, protocol)
case "testList":
return s.handleTestList(ctx, protocol)
case "testMap":
return s.handleTestMap(ctx, protocol)
case "testMapMap":
return s.handleTestMapMap(ctx, protocol)
case "testMulti":
return s.handleTestMulti(ctx, protocol)
case "testMultiException":
return s.handleTestMultiException(ctx, protocol)
case "testNest":
return s.handleTestNest(ctx, protocol)
case "testSet":
return s.handleTestSet(ctx, protocol)
case "testString":
return s.handleTestString(ctx, protocol)
case "testStringMap":
return s.handleTestStringMap(ctx, protocol)
case "testStruct":
return s.handleTestStruct(ctx, protocol)
case "testTypedef":
return s.handleTestTypedef(ctx, protocol)
case "testVoid":
return s.handleTestVoid(ctx, protocol)
default:
return false, nil, fmt.Errorf("method %v not found in service %v", methodName, s.Service())
}
}
func (s *tchanThriftTestServer) handleTestBinary(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestBinaryArgs
var res ThriftTestTestBinaryResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestBinary(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestByte(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestByteArgs
var res ThriftTestTestByteResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestByte(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestDouble(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestDoubleArgs
var res ThriftTestTestDoubleResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestDouble(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestEnum(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestEnumArgs
var res ThriftTestTestEnumResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestEnum(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestException(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestExceptionArgs
var res ThriftTestTestExceptionResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
err :=
s.handler.TestException(ctx, req.Arg)
if err != nil {
switch v := err.(type) {
case *Xception:
if v == nil {
return false, nil, fmt.Errorf("Handler for err1 returned non-nil error type *Xception but nil value")
}
res.Err1 = v
default:
return false, nil, err
}
} else {
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestI32(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestI32Args
var res ThriftTestTestI32Result
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestI32(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestI64(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestI64Args
var res ThriftTestTestI64Result
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestI64(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestInsanity(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestInsanityArgs
var res ThriftTestTestInsanityResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestInsanity(ctx, req.Argument)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestList(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestListArgs
var res ThriftTestTestListResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestList(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestMap(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestMapArgs
var res ThriftTestTestMapResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestMap(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestMapMap(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestMapMapArgs
var res ThriftTestTestMapMapResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestMapMap(ctx, req.Hello)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestMulti(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestMultiArgs
var res ThriftTestTestMultiResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestMulti(ctx, req.Arg0, req.Arg1, req.Arg2, req.Arg3, req.Arg4, req.Arg5)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestMultiException(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestMultiExceptionArgs
var res ThriftTestTestMultiExceptionResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestMultiException(ctx, req.Arg0, req.Arg1)
if err != nil {
switch v := err.(type) {
case *Xception:
if v == nil {
return false, nil, fmt.Errorf("Handler for err1 returned non-nil error type *Xception but nil value")
}
res.Err1 = v
case *Xception2:
if v == nil {
return false, nil, fmt.Errorf("Handler for err2 returned non-nil error type *Xception2 but nil value")
}
res.Err2 = v
default:
return false, nil, err
}
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestNest(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestNestArgs
var res ThriftTestTestNestResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestNest(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestSet(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestSetArgs
var res ThriftTestTestSetResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestSet(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestString(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestStringArgs
var res ThriftTestTestStringResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestString(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = &r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestStringMap(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestStringMapArgs
var res ThriftTestTestStringMapResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestStringMap(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}
return err == nil, &res, nil
}
func (s *tchanThriftTestServer) handleTestStruct(ctx thrift.Context, protocol athrift.TProtocol) (bool, athrift.TStruct, error) {
var req ThriftTestTestStructArgs
var res ThriftTestTestStructResult
if err := req.Read(protocol); err != nil {
return false, nil, err
}
r, err :=
s.handler.TestStruct(ctx, req.Thing)
if err != nil {
return false, nil, err
} else {
res.Success = r
}