Skip to content

Commit b5fbc57

Browse files
echistyakovfacebook-github-bot
authored andcommitted
Standardize/normalize terminology
Summary: Make terminology/naming consistent with the `RequestChannel.cpp` API we are trying to mimic. https://www.internalfb.com/code/fbsource/[0d3d8ef19c93]/fbcode/thrift/lib/cpp2/async/RequestChannel.h?lines=132 https://www.internalfb.com/code/fbsource/[0d3d8ef19c93]/fbcode/thrift/lib/cpp2/async/RequestChannel.h?lines=144 Consistency makes it easier to compare the APIs - especially as we add support for streaming APIs downstream - e.g.: https://www.internalfb.com/code/fbsource/[0d3d8ef19c93]/fbcode/thrift/lib/cpp2/async/RequestChannel.h?lines=160 `Oneway` becomes `SendRequestNoResponse`. `Call` becomes `SendRequestResponse`. #build_rule_type[go_library,go_binary,go_test] Reviewed By: mahmednabil109 Differential Revision: D71901668 fbshipit-source-id: 9745828ab2216e4e5cdb9c5ef83ddff044ce948a
1 parent 8937d13 commit b5fbc57

File tree

25 files changed

+96
-96
lines changed

25 files changed

+96
-96
lines changed

thrift/compiler/generate/templates/go/svc/client_func_oneway.mustache

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ func (c *{{service:go_name}}Client) {{> svc/func_signature}} {
2727
{{/field:type}}
2828
{{/function:args}}
2929
}
30-
return c.ch.Oneway({{function:ctx_arg_name}}, "{{function:name}}", fbthriftReq)
30+
return c.ch.SendRequestNoResponse({{function:ctx_arg_name}}, "{{function:name}}", fbthriftReq)
3131
}

thrift/compiler/generate/templates/go/svc/client_func_request_response.mustache

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (c *{{service:go_name}}Client) {{> svc/func_signature}} {
2828
{{/function:args}}
2929
}
3030
fbthriftResp := newResp{{service:go_name}}{{function:go_name}}()
31-
fbthriftErr := c.ch.Call({{function:ctx_arg_name}}, "{{function:name}}", fbthriftReq, fbthriftResp)
31+
fbthriftErr := c.ch.SendRequestResponse({{function:ctx_arg_name}}, "{{function:name}}", fbthriftReq, fbthriftResp)
3232
if fbthriftErr != nil {
3333
return {{^function:void?}}{{#function:return_type}}{{> common/go_zero_value}}{{/function:return_type}}, {{/function:void?}}fbthriftErr
3434
}{{#function:exceptions?}}{{!

thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/svcs.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (c *ServiceClient) Func(ctx context.Context, arg1 StringWithAdapter_7208, a
6464
Arg3: arg3,
6565
}
6666
fbthriftResp := newRespServiceFunc()
67-
fbthriftErr := c.ch.Call(ctx, "func", fbthriftReq, fbthriftResp)
67+
fbthriftErr := c.ch.SendRequestResponse(ctx, "func", fbthriftReq, fbthriftResp)
6868
if fbthriftErr != nil {
6969
return 0, fbthriftErr
7070
}
@@ -210,7 +210,7 @@ func (c *AdapterServiceClient) Count(ctx context.Context) (*CountingStruct, erro
210210
fbthriftReq := &reqAdapterServiceCount{
211211
}
212212
fbthriftResp := newRespAdapterServiceCount()
213-
fbthriftErr := c.ch.Call(ctx, "count", fbthriftReq, fbthriftResp)
213+
fbthriftErr := c.ch.SendRequestResponse(ctx, "count", fbthriftReq, fbthriftResp)
214214
if fbthriftErr != nil {
215215
return nil, fbthriftErr
216216
}
@@ -222,7 +222,7 @@ func (c *AdapterServiceClient) AdaptedTypes(ctx context.Context, arg *HeapAlloca
222222
Arg: arg,
223223
}
224224
fbthriftResp := newRespAdapterServiceAdaptedTypes()
225-
fbthriftErr := c.ch.Call(ctx, "adaptedTypes", fbthriftReq, fbthriftResp)
225+
fbthriftErr := c.ch.SendRequestResponse(ctx, "adaptedTypes", fbthriftReq, fbthriftResp)
226226
if fbthriftErr != nil {
227227
return nil, fbthriftErr
228228
}

thrift/compiler/test/fixtures/basic-annotations/out/go/gen-go/module/svcs.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (c *MyServiceClient) Ping(ctx context.Context) (error) {
7373
fbthriftReq := &reqMyServicePing{
7474
}
7575
fbthriftResp := newRespMyServicePing()
76-
fbthriftErr := c.ch.Call(ctx, "ping", fbthriftReq, fbthriftResp)
76+
fbthriftErr := c.ch.SendRequestResponse(ctx, "ping", fbthriftReq, fbthriftResp)
7777
if fbthriftErr != nil {
7878
return fbthriftErr
7979
} else if fbthriftResp.MyExcept != nil {
@@ -86,7 +86,7 @@ func (c *MyServiceClient) GetRandomData(ctx context.Context) (string, error) {
8686
fbthriftReq := &reqMyServiceGetRandomData{
8787
}
8888
fbthriftResp := newRespMyServiceGetRandomData()
89-
fbthriftErr := c.ch.Call(ctx, "getRandomData", fbthriftReq, fbthriftResp)
89+
fbthriftErr := c.ch.SendRequestResponse(ctx, "getRandomData", fbthriftReq, fbthriftResp)
9090
if fbthriftErr != nil {
9191
return "", fbthriftErr
9292
}
@@ -98,7 +98,7 @@ func (c *MyServiceClient) HasDataById(ctx context.Context, id int64) (bool, erro
9898
Id: id,
9999
}
100100
fbthriftResp := newRespMyServiceHasDataById()
101-
fbthriftErr := c.ch.Call(ctx, "hasDataById", fbthriftReq, fbthriftResp)
101+
fbthriftErr := c.ch.SendRequestResponse(ctx, "hasDataById", fbthriftReq, fbthriftResp)
102102
if fbthriftErr != nil {
103103
return false, fbthriftErr
104104
}
@@ -110,7 +110,7 @@ func (c *MyServiceClient) GoGetDataById(ctx context.Context, id int64) (string,
110110
Id: id,
111111
}
112112
fbthriftResp := newRespMyServiceGoGetDataById()
113-
fbthriftErr := c.ch.Call(ctx, "getDataById", fbthriftReq, fbthriftResp)
113+
fbthriftErr := c.ch.SendRequestResponse(ctx, "getDataById", fbthriftReq, fbthriftResp)
114114
if fbthriftErr != nil {
115115
return "", fbthriftErr
116116
}
@@ -123,7 +123,7 @@ func (c *MyServiceClient) PutDataById(ctx context.Context, id int64, data string
123123
Data: data,
124124
}
125125
fbthriftResp := newRespMyServicePutDataById()
126-
fbthriftErr := c.ch.Call(ctx, "putDataById", fbthriftReq, fbthriftResp)
126+
fbthriftErr := c.ch.SendRequestResponse(ctx, "putDataById", fbthriftReq, fbthriftResp)
127127
if fbthriftErr != nil {
128128
return fbthriftErr
129129
}
@@ -135,14 +135,14 @@ func (c *MyServiceClient) LobDataById(ctx context.Context, id int64, data string
135135
Id: id,
136136
Data: data,
137137
}
138-
return c.ch.Oneway(ctx, "lobDataById", fbthriftReq)
138+
return c.ch.SendRequestNoResponse(ctx, "lobDataById", fbthriftReq)
139139
}
140140

141141
func (c *MyServiceClient) GoDoNothing(ctx context.Context) (error) {
142142
fbthriftReq := &reqMyServiceGoDoNothing{
143143
}
144144
fbthriftResp := newRespMyServiceGoDoNothing()
145-
fbthriftErr := c.ch.Call(ctx, "doNothing", fbthriftReq, fbthriftResp)
145+
fbthriftErr := c.ch.SendRequestResponse(ctx, "doNothing", fbthriftReq, fbthriftResp)
146146
if fbthriftErr != nil {
147147
return fbthriftErr
148148
}
@@ -614,7 +614,7 @@ func (c *MyServicePrioParentClient) Ping(ctx context.Context) (error) {
614614
fbthriftReq := &reqMyServicePrioParentPing{
615615
}
616616
fbthriftResp := newRespMyServicePrioParentPing()
617-
fbthriftErr := c.ch.Call(ctx, "ping", fbthriftReq, fbthriftResp)
617+
fbthriftErr := c.ch.SendRequestResponse(ctx, "ping", fbthriftReq, fbthriftResp)
618618
if fbthriftErr != nil {
619619
return fbthriftErr
620620
}
@@ -625,7 +625,7 @@ func (c *MyServicePrioParentClient) Pong(ctx context.Context) (error) {
625625
fbthriftReq := &reqMyServicePrioParentPong{
626626
}
627627
fbthriftResp := newRespMyServicePrioParentPong()
628-
fbthriftErr := c.ch.Call(ctx, "pong", fbthriftReq, fbthriftResp)
628+
fbthriftErr := c.ch.SendRequestResponse(ctx, "pong", fbthriftReq, fbthriftResp)
629629
if fbthriftErr != nil {
630630
return fbthriftErr
631631
}
@@ -828,7 +828,7 @@ func (c *MyServicePrioChildClient) Pang(ctx context.Context) (error) {
828828
fbthriftReq := &reqMyServicePrioChildPang{
829829
}
830830
fbthriftResp := newRespMyServicePrioChildPang()
831-
fbthriftErr := c.ch.Call(ctx, "pang", fbthriftReq, fbthriftResp)
831+
fbthriftErr := c.ch.SendRequestResponse(ctx, "pang", fbthriftReq, fbthriftResp)
832832
if fbthriftErr != nil {
833833
return fbthriftErr
834834
}
@@ -943,7 +943,7 @@ func (c *BadServiceClient) Bar(ctx context.Context) (int32, error) {
943943
fbthriftReq := &reqBadServiceBar{
944944
}
945945
fbthriftResp := newRespBadServiceBar()
946-
fbthriftErr := c.ch.Call(ctx, "bar", fbthriftReq, fbthriftResp)
946+
fbthriftErr := c.ch.SendRequestResponse(ctx, "bar", fbthriftReq, fbthriftResp)
947947
if fbthriftErr != nil {
948948
return 0, fbthriftErr
949949
}
@@ -1090,7 +1090,7 @@ func (c *FooBarBazServiceClient) FooStructured(ctx context.Context) (error) {
10901090
fbthriftReq := &reqFooBarBazServiceFooStructured{
10911091
}
10921092
fbthriftResp := newRespFooBarBazServiceFooStructured()
1093-
fbthriftErr := c.ch.Call(ctx, "foo", fbthriftReq, fbthriftResp)
1093+
fbthriftErr := c.ch.SendRequestResponse(ctx, "foo", fbthriftReq, fbthriftResp)
10941094
if fbthriftErr != nil {
10951095
return fbthriftErr
10961096
}
@@ -1101,7 +1101,7 @@ func (c *FooBarBazServiceClient) BarNonStructured(ctx context.Context) (error) {
11011101
fbthriftReq := &reqFooBarBazServiceBarNonStructured{
11021102
}
11031103
fbthriftResp := newRespFooBarBazServiceBarNonStructured()
1104-
fbthriftErr := c.ch.Call(ctx, "bar", fbthriftReq, fbthriftResp)
1104+
fbthriftErr := c.ch.SendRequestResponse(ctx, "bar", fbthriftReq, fbthriftResp)
11051105
if fbthriftErr != nil {
11061106
return fbthriftErr
11071107
}
@@ -1112,7 +1112,7 @@ func (c *FooBarBazServiceClient) Baz(ctx context.Context) (error) {
11121112
fbthriftReq := &reqFooBarBazServiceBaz{
11131113
}
11141114
fbthriftResp := newRespFooBarBazServiceBaz()
1115-
fbthriftErr := c.ch.Call(ctx, "baz", fbthriftReq, fbthriftResp)
1115+
fbthriftErr := c.ch.SendRequestResponse(ctx, "baz", fbthriftReq, fbthriftResp)
11161116
if fbthriftErr != nil {
11171117
return fbthriftErr
11181118
}

thrift/compiler/test/fixtures/basic/out/go/gen-go/module/svcs.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (c *FooServiceClient) SimpleRPC(ctx context.Context) (error) {
6161
fbthriftReq := &reqFooServiceSimpleRPC{
6262
}
6363
fbthriftResp := newRespFooServiceSimpleRPC()
64-
fbthriftErr := c.ch.Call(ctx, "simple_rpc", fbthriftReq, fbthriftResp)
64+
fbthriftErr := c.ch.SendRequestResponse(ctx, "simple_rpc", fbthriftReq, fbthriftResp)
6565
if fbthriftErr != nil {
6666
return fbthriftErr
6767
}
@@ -204,7 +204,7 @@ func (c *FB303ServiceClient) SimpleRPC(ctx context.Context, intParameter int32)
204204
IntParameter: intParameter,
205205
}
206206
fbthriftResp := newRespFB303ServiceSimpleRPC()
207-
fbthriftErr := c.ch.Call(ctx, "simple_rpc", fbthriftReq, fbthriftResp)
207+
fbthriftErr := c.ch.SendRequestResponse(ctx, "simple_rpc", fbthriftReq, fbthriftResp)
208208
if fbthriftErr != nil {
209209
return nil, fbthriftErr
210210
}
@@ -366,7 +366,7 @@ func (c *MyServiceClient) Ping(ctx context.Context) (error) {
366366
fbthriftReq := &reqMyServicePing{
367367
}
368368
fbthriftResp := newRespMyServicePing()
369-
fbthriftErr := c.ch.Call(ctx, "ping", fbthriftReq, fbthriftResp)
369+
fbthriftErr := c.ch.SendRequestResponse(ctx, "ping", fbthriftReq, fbthriftResp)
370370
if fbthriftErr != nil {
371371
return fbthriftErr
372372
}
@@ -377,7 +377,7 @@ func (c *MyServiceClient) GetRandomData(ctx context.Context) (string, error) {
377377
fbthriftReq := &reqMyServiceGetRandomData{
378378
}
379379
fbthriftResp := newRespMyServiceGetRandomData()
380-
fbthriftErr := c.ch.Call(ctx, "getRandomData", fbthriftReq, fbthriftResp)
380+
fbthriftErr := c.ch.SendRequestResponse(ctx, "getRandomData", fbthriftReq, fbthriftResp)
381381
if fbthriftErr != nil {
382382
return "", fbthriftErr
383383
}
@@ -389,7 +389,7 @@ func (c *MyServiceClient) Sink(ctx context.Context, sink int64) (error) {
389389
Sink: sink,
390390
}
391391
fbthriftResp := newRespMyServiceSink()
392-
fbthriftErr := c.ch.Call(ctx, "sink", fbthriftReq, fbthriftResp)
392+
fbthriftErr := c.ch.SendRequestResponse(ctx, "sink", fbthriftReq, fbthriftResp)
393393
if fbthriftErr != nil {
394394
return fbthriftErr
395395
}
@@ -402,7 +402,7 @@ func (c *MyServiceClient) PutDataById(ctx context.Context, id int64, data string
402402
Data: data,
403403
}
404404
fbthriftResp := newRespMyServicePutDataById()
405-
fbthriftErr := c.ch.Call(ctx, "putDataById", fbthriftReq, fbthriftResp)
405+
fbthriftErr := c.ch.SendRequestResponse(ctx, "putDataById", fbthriftReq, fbthriftResp)
406406
if fbthriftErr != nil {
407407
return fbthriftErr
408408
}
@@ -414,7 +414,7 @@ func (c *MyServiceClient) HasDataById(ctx context.Context, id int64) (bool, erro
414414
Id: id,
415415
}
416416
fbthriftResp := newRespMyServiceHasDataById()
417-
fbthriftErr := c.ch.Call(ctx, "hasDataById", fbthriftReq, fbthriftResp)
417+
fbthriftErr := c.ch.SendRequestResponse(ctx, "hasDataById", fbthriftReq, fbthriftResp)
418418
if fbthriftErr != nil {
419419
return false, fbthriftErr
420420
}
@@ -426,7 +426,7 @@ func (c *MyServiceClient) GetDataById(ctx context.Context, id int64) (string, er
426426
Id: id,
427427
}
428428
fbthriftResp := newRespMyServiceGetDataById()
429-
fbthriftErr := c.ch.Call(ctx, "getDataById", fbthriftReq, fbthriftResp)
429+
fbthriftErr := c.ch.SendRequestResponse(ctx, "getDataById", fbthriftReq, fbthriftResp)
430430
if fbthriftErr != nil {
431431
return "", fbthriftErr
432432
}
@@ -438,7 +438,7 @@ func (c *MyServiceClient) DeleteDataById(ctx context.Context, id int64) (error)
438438
Id: id,
439439
}
440440
fbthriftResp := newRespMyServiceDeleteDataById()
441-
fbthriftErr := c.ch.Call(ctx, "deleteDataById", fbthriftReq, fbthriftResp)
441+
fbthriftErr := c.ch.SendRequestResponse(ctx, "deleteDataById", fbthriftReq, fbthriftResp)
442442
if fbthriftErr != nil {
443443
return fbthriftErr
444444
}
@@ -450,14 +450,14 @@ func (c *MyServiceClient) LobDataById(ctx context.Context, id int64, data string
450450
Id: id,
451451
Data: data,
452452
}
453-
return c.ch.Oneway(ctx, "lobDataById", fbthriftReq)
453+
return c.ch.SendRequestNoResponse(ctx, "lobDataById", fbthriftReq)
454454
}
455455

456456
func (c *MyServiceClient) InvalidReturnForHack(ctx context.Context) ([]float32, error) {
457457
fbthriftReq := &reqMyServiceInvalidReturnForHack{
458458
}
459459
fbthriftResp := newRespMyServiceInvalidReturnForHack()
460-
fbthriftErr := c.ch.Call(ctx, "invalid_return_for_hack", fbthriftReq, fbthriftResp)
460+
fbthriftErr := c.ch.SendRequestResponse(ctx, "invalid_return_for_hack", fbthriftReq, fbthriftResp)
461461
if fbthriftErr != nil {
462462
return nil, fbthriftErr
463463
}
@@ -468,7 +468,7 @@ func (c *MyServiceClient) RpcSkippedCodegen(ctx context.Context) (error) {
468468
fbthriftReq := &reqMyServiceRpcSkippedCodegen{
469469
}
470470
fbthriftResp := newRespMyServiceRpcSkippedCodegen()
471-
fbthriftErr := c.ch.Call(ctx, "rpc_skipped_codegen", fbthriftReq, fbthriftResp)
471+
fbthriftErr := c.ch.SendRequestResponse(ctx, "rpc_skipped_codegen", fbthriftReq, fbthriftResp)
472472
if fbthriftErr != nil {
473473
return fbthriftErr
474474
}
@@ -1090,7 +1090,7 @@ func (c *DbMixedStackArgumentsClient) GetDataByKey0(ctx context.Context, key str
10901090
Key: key,
10911091
}
10921092
fbthriftResp := newRespDbMixedStackArgumentsGetDataByKey0()
1093-
fbthriftErr := c.ch.Call(ctx, "getDataByKey0", fbthriftReq, fbthriftResp)
1093+
fbthriftErr := c.ch.SendRequestResponse(ctx, "getDataByKey0", fbthriftReq, fbthriftResp)
10941094
if fbthriftErr != nil {
10951095
return nil, fbthriftErr
10961096
}
@@ -1102,7 +1102,7 @@ func (c *DbMixedStackArgumentsClient) GetDataByKey1(ctx context.Context, key str
11021102
Key: key,
11031103
}
11041104
fbthriftResp := newRespDbMixedStackArgumentsGetDataByKey1()
1105-
fbthriftErr := c.ch.Call(ctx, "getDataByKey1", fbthriftReq, fbthriftResp)
1105+
fbthriftErr := c.ch.SendRequestResponse(ctx, "getDataByKey1", fbthriftReq, fbthriftResp)
11061106
if fbthriftErr != nil {
11071107
return nil, fbthriftErr
11081108
}

thrift/compiler/test/fixtures/doctext/out/go/gen-go/module/svcs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (c *CClient) F(ctx context.Context) (error) {
6363
fbthriftReq := &reqCF{
6464
}
6565
fbthriftResp := newRespCF()
66-
fbthriftErr := c.ch.Call(ctx, "f", fbthriftReq, fbthriftResp)
66+
fbthriftErr := c.ch.SendRequestResponse(ctx, "f", fbthriftReq, fbthriftResp)
6767
if fbthriftErr != nil {
6868
return fbthriftErr
6969
}
@@ -77,7 +77,7 @@ func (c *CClient) Thing(ctx context.Context, a int32, b string, c []int32) (stri
7777
C: c,
7878
}
7979
fbthriftResp := newRespCThing()
80-
fbthriftErr := c.ch.Call(ctx, "thing", fbthriftReq, fbthriftResp)
80+
fbthriftErr := c.ch.SendRequestResponse(ctx, "thing", fbthriftReq, fbthriftResp)
8181
if fbthriftErr != nil {
8282
return "", fbthriftErr
8383
} else if fbthriftResp.Bang != nil {

thrift/compiler/test/fixtures/exceptions/out/go/gen-go/module/svcs.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (c *RaiserClient) DoBland(ctx context.Context) (error) {
6767
fbthriftReq := &reqRaiserDoBland{
6868
}
6969
fbthriftResp := newRespRaiserDoBland()
70-
fbthriftErr := c.ch.Call(ctx, "doBland", fbthriftReq, fbthriftResp)
70+
fbthriftErr := c.ch.SendRequestResponse(ctx, "doBland", fbthriftReq, fbthriftResp)
7171
if fbthriftErr != nil {
7272
return fbthriftErr
7373
}
@@ -78,7 +78,7 @@ func (c *RaiserClient) DoRaise(ctx context.Context) (error) {
7878
fbthriftReq := &reqRaiserDoRaise{
7979
}
8080
fbthriftResp := newRespRaiserDoRaise()
81-
fbthriftErr := c.ch.Call(ctx, "doRaise", fbthriftReq, fbthriftResp)
81+
fbthriftErr := c.ch.SendRequestResponse(ctx, "doRaise", fbthriftReq, fbthriftResp)
8282
if fbthriftErr != nil {
8383
return fbthriftErr
8484
} else if fbthriftResp.B != nil {
@@ -95,7 +95,7 @@ func (c *RaiserClient) Get200(ctx context.Context) (string, error) {
9595
fbthriftReq := &reqRaiserGet200{
9696
}
9797
fbthriftResp := newRespRaiserGet200()
98-
fbthriftErr := c.ch.Call(ctx, "get200", fbthriftReq, fbthriftResp)
98+
fbthriftErr := c.ch.SendRequestResponse(ctx, "get200", fbthriftReq, fbthriftResp)
9999
if fbthriftErr != nil {
100100
return "", fbthriftErr
101101
}
@@ -106,7 +106,7 @@ func (c *RaiserClient) Get500(ctx context.Context) (string, error) {
106106
fbthriftReq := &reqRaiserGet500{
107107
}
108108
fbthriftResp := newRespRaiserGet500()
109-
fbthriftErr := c.ch.Call(ctx, "get500", fbthriftReq, fbthriftResp)
109+
fbthriftErr := c.ch.SendRequestResponse(ctx, "get500", fbthriftReq, fbthriftResp)
110110
if fbthriftErr != nil {
111111
return "", fbthriftErr
112112
} else if fbthriftResp.F != nil {

0 commit comments

Comments
 (0)