Skip to content

Commit

Permalink
Remove deprecated ContextClientInterface
Browse files Browse the repository at this point in the history
Summary:
Interface serves no useful purpose.

#build_rule_type[go_library,go_binary,go_unittest,go_test]

Reviewed By: leoleovich

Differential Revision: D68877382

fbshipit-source-id: 8f8eeca2565c95ebca55518a796c425c3890cce5
  • Loading branch information
echistyakov authored and facebook-github-bot committed Jan 30, 2025
1 parent 03719f3 commit 54e3b77
Show file tree
Hide file tree
Showing 23 changed files with 0 additions and 298 deletions.
1 change: 0 additions & 1 deletion thrift/compiler/generate/templates/go/svc/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ type {{service:go_name}}Client struct {
}
// Compile time interface enforcer
var _ {{service:go_name}}ClientInterface = (*{{service:go_name}}Client)(nil)
var _ {{service:go_name}}ContextClientInterface = (*{{service:go_name}}Client)(nil)

func New{{service:go_name}}Client(prot thrift.Protocol) *{{service:go_name}}Client {
return &{{service:go_name}}Client{
Expand Down
24 changes: 0 additions & 24 deletions thrift/compiler/generate/templates/go/svc/interface.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,4 @@ type {{service:go_name}}ClientInterface interface {
{{/function:go_supported?}}
{{/service:functions}}
}

{{!COMPAT: backwards compatibility
Currently there are a bunch of use cases that implement ClientInterface without Context functions.
1. We need to manually move them over to ContextClientInterface
2. Add func_signature_with_ctx to ClientInterface
3. Move them back to ClientInterface
4. Delete ContextClientInterface
}}{{!
}}type {{service:go_name}}ContextClientInterface interface {
{{service:go_name}}ClientInterface
{{#service:extends?}}
{{#service:extends}}
// Inherited/extended service
{{service:go_qualified_name}}ContextClientInterface

{{/service:extends}}
{{/service:extends?}}
{{#service:functions}}
{{#function:go_supported?}}
{{> svc/func_signature_with_ctx}}

{{/function:go_supported?}}
{{/service:functions}}
}
{{! new line }}
13 changes: 0 additions & 13 deletions thrift/compiler/test/fixtures/adapter/out/go/gen-go/module/svcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ type ServiceClientInterface interface {
Func(arg1 StringWithAdapter_7208, arg2 string, arg3 *Foo) (MyI32_4873, error)
}

type ServiceContextClientInterface interface {
ServiceClientInterface
FuncContext(ctx context.Context, arg1 StringWithAdapter_7208, arg2 string, arg3 *Foo) (MyI32_4873, error)
}

type ServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -62,7 +57,6 @@ type ServiceClient struct {
}
// Compile time interface enforcer
var _ ServiceClientInterface = (*ServiceClient)(nil)
var _ ServiceContextClientInterface = (*ServiceClient)(nil)

func NewServiceClient(prot thrift.Protocol) *ServiceClient {
return &ServiceClient{
Expand Down Expand Up @@ -214,12 +208,6 @@ type AdapterServiceClientInterface interface {
AdaptedTypes(arg *HeapAllocated) (*HeapAllocated, error)
}

type AdapterServiceContextClientInterface interface {
AdapterServiceClientInterface
CountContext(ctx context.Context) (*CountingStruct, error)
AdaptedTypesContext(ctx context.Context, arg *HeapAllocated) (*HeapAllocated, error)
}

type AdapterServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -241,7 +229,6 @@ type AdapterServiceClient struct {
}
// Compile time interface enforcer
var _ AdapterServiceClientInterface = (*AdapterServiceClient)(nil)
var _ AdapterServiceContextClientInterface = (*AdapterServiceClient)(nil)

func NewAdapterServiceClient(prot thrift.Protocol) *AdapterServiceClient {
return &AdapterServiceClient{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ type MyServiceClientInterface interface {
GoDoNothing() (error)
}

type MyServiceContextClientInterface interface {
MyServiceClientInterface
PingContext(ctx context.Context) (error)
GetRandomDataContext(ctx context.Context) (string, error)
HasDataByIdContext(ctx context.Context, id int64) (bool, error)
GoGetDataByIdContext(ctx context.Context, id int64) (string, error)
PutDataByIdContext(ctx context.Context, id int64, data string) (error)
LobDataByIdContext(ctx context.Context, id int64, data string) (error)
GoDoNothingContext(ctx context.Context) (error)
}

type MyServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -80,7 +69,6 @@ type MyServiceClient struct {
}
// Compile time interface enforcer
var _ MyServiceClientInterface = (*MyServiceClient)(nil)
var _ MyServiceContextClientInterface = (*MyServiceClient)(nil)

func NewMyServiceClient(prot thrift.Protocol) *MyServiceClient {
return &MyServiceClient{
Expand Down Expand Up @@ -672,12 +660,6 @@ type MyServicePrioParentClientInterface interface {
Pong() (error)
}

type MyServicePrioParentContextClientInterface interface {
MyServicePrioParentClientInterface
PingContext(ctx context.Context) (error)
PongContext(ctx context.Context) (error)
}

type MyServicePrioParentChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -699,7 +681,6 @@ type MyServicePrioParentClient struct {
}
// Compile time interface enforcer
var _ MyServicePrioParentClientInterface = (*MyServicePrioParentClient)(nil)
var _ MyServicePrioParentContextClientInterface = (*MyServicePrioParentClient)(nil)

func NewMyServicePrioParentClient(prot thrift.Protocol) *MyServicePrioParentClient {
return &MyServicePrioParentClient{
Expand Down Expand Up @@ -921,14 +902,6 @@ type MyServicePrioChildClientInterface interface {
Pang() (error)
}

type MyServicePrioChildContextClientInterface interface {
MyServicePrioChildClientInterface
// Inherited/extended service
MyServicePrioParentContextClientInterface

PangContext(ctx context.Context) (error)
}

type MyServicePrioChildChannelClient struct {
// Inherited/extended service
*MyServicePrioParentChannelClient
Expand All @@ -955,7 +928,6 @@ type MyServicePrioChildClient struct {
}
// Compile time interface enforcer
var _ MyServicePrioChildClientInterface = (*MyServicePrioChildClient)(nil)
var _ MyServicePrioChildContextClientInterface = (*MyServicePrioChildClient)(nil)

func NewMyServicePrioChildClient(prot thrift.Protocol) *MyServicePrioChildClient {
return &MyServicePrioChildClient{
Expand Down Expand Up @@ -1074,11 +1046,6 @@ type BadServiceClientInterface interface {
Bar() (int32, error)
}

type BadServiceContextClientInterface interface {
BadServiceClientInterface
BarContext(ctx context.Context) (int32, error)
}

type BadServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -1100,7 +1067,6 @@ type BadServiceClient struct {
}
// Compile time interface enforcer
var _ BadServiceClientInterface = (*BadServiceClient)(nil)
var _ BadServiceContextClientInterface = (*BadServiceClient)(nil)

func NewBadServiceClient(prot thrift.Protocol) *BadServiceClient {
return &BadServiceClient{
Expand Down Expand Up @@ -1250,13 +1216,6 @@ type FooBarBazServiceClientInterface interface {
Baz() (error)
}

type FooBarBazServiceContextClientInterface interface {
FooBarBazServiceClientInterface
FooStructuredContext(ctx context.Context) (error)
BarNonStructuredContext(ctx context.Context) (error)
BazContext(ctx context.Context) (error)
}

type FooBarBazServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -1278,7 +1237,6 @@ type FooBarBazServiceClient struct {
}
// Compile time interface enforcer
var _ FooBarBazServiceClientInterface = (*FooBarBazServiceClient)(nil)
var _ FooBarBazServiceContextClientInterface = (*FooBarBazServiceClient)(nil)

func NewFooBarBazServiceClient(prot thrift.Protocol) *FooBarBazServiceClient {
return &FooBarBazServiceClient{
Expand Down
34 changes: 0 additions & 34 deletions thrift/compiler/test/fixtures/basic/out/go/gen-go/module/svcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ type FooServiceClientInterface interface {
SimpleRPC() (error)
}

type FooServiceContextClientInterface interface {
FooServiceClientInterface
SimpleRPCContext(ctx context.Context) (error)
}

type FooServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -62,7 +57,6 @@ type FooServiceClient struct {
}
// Compile time interface enforcer
var _ FooServiceClientInterface = (*FooServiceClient)(nil)
var _ FooServiceContextClientInterface = (*FooServiceClient)(nil)

func NewFooServiceClient(prot thrift.Protocol) *FooServiceClient {
return &FooServiceClient{
Expand Down Expand Up @@ -207,11 +201,6 @@ type FB303ServiceClientInterface interface {
SimpleRPC(intParameter int32) (*ReservedKeyword, error)
}

type FB303ServiceContextClientInterface interface {
FB303ServiceClientInterface
SimpleRPCContext(ctx context.Context, intParameter int32) (*ReservedKeyword, error)
}

type FB303ServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -233,7 +222,6 @@ type FB303ServiceClient struct {
}
// Compile time interface enforcer
var _ FB303ServiceClientInterface = (*FB303ServiceClient)(nil)
var _ FB303ServiceContextClientInterface = (*FB303ServiceClient)(nil)

func NewFB303ServiceClient(prot thrift.Protocol) *FB303ServiceClient {
return &FB303ServiceClient{
Expand Down Expand Up @@ -399,20 +387,6 @@ type MyServiceClientInterface interface {
RpcSkippedCodegen() (error)
}

type MyServiceContextClientInterface interface {
MyServiceClientInterface
PingContext(ctx context.Context) (error)
GetRandomDataContext(ctx context.Context) (string, error)
SinkContext(ctx context.Context, sink int64) (error)
PutDataByIdContext(ctx context.Context, id int64, data string) (error)
HasDataByIdContext(ctx context.Context, id int64) (bool, error)
GetDataByIdContext(ctx context.Context, id int64) (string, error)
DeleteDataByIdContext(ctx context.Context, id int64) (error)
LobDataByIdContext(ctx context.Context, id int64, data string) (error)
InvalidReturnForHackContext(ctx context.Context) ([]float32, error)
RpcSkippedCodegenContext(ctx context.Context) (error)
}

type MyServiceChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -434,7 +408,6 @@ type MyServiceClient struct {
}
// Compile time interface enforcer
var _ MyServiceClientInterface = (*MyServiceClient)(nil)
var _ MyServiceContextClientInterface = (*MyServiceClient)(nil)

func NewMyServiceClient(prot thrift.Protocol) *MyServiceClient {
return &MyServiceClient{
Expand Down Expand Up @@ -1232,12 +1205,6 @@ type DbMixedStackArgumentsClientInterface interface {
GetDataByKey1(key string) ([]byte, error)
}

type DbMixedStackArgumentsContextClientInterface interface {
DbMixedStackArgumentsClientInterface
GetDataByKey0Context(ctx context.Context, key string) ([]byte, error)
GetDataByKey1Context(ctx context.Context, key string) ([]byte, error)
}

type DbMixedStackArgumentsChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -1259,7 +1226,6 @@ type DbMixedStackArgumentsClient struct {
}
// Compile time interface enforcer
var _ DbMixedStackArgumentsClientInterface = (*DbMixedStackArgumentsClient)(nil)
var _ DbMixedStackArgumentsContextClientInterface = (*DbMixedStackArgumentsClient)(nil)

func NewDbMixedStackArgumentsClient(prot thrift.Protocol) *DbMixedStackArgumentsClient {
return &DbMixedStackArgumentsClient{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ type CClientInterface interface {
Thing(a int32, b string, c []int32) (string, error)
}

type CContextClientInterface interface {
CClientInterface
FContext(ctx context.Context) (error)
ThingContext(ctx context.Context, a int32, b string, c []int32) (string, error)
}

type CChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -65,7 +59,6 @@ type CClient struct {
}
// Compile time interface enforcer
var _ CClientInterface = (*CClient)(nil)
var _ CContextClientInterface = (*CClient)(nil)

func NewCClient(prot thrift.Protocol) *CClient {
return &CClient{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ type RaiserClientInterface interface {
Get500() (string, error)
}

type RaiserContextClientInterface interface {
RaiserClientInterface
DoBlandContext(ctx context.Context) (error)
DoRaiseContext(ctx context.Context) (error)
Get200Context(ctx context.Context) (string, error)
Get500Context(ctx context.Context) (string, error)
}

type RaiserChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -71,7 +63,6 @@ type RaiserClient struct {
}
// Compile time interface enforcer
var _ RaiserClientInterface = (*RaiserClient)(nil)
var _ RaiserContextClientInterface = (*RaiserClient)(nil)

func NewRaiserClient(prot thrift.Protocol) *RaiserClient {
return &RaiserClient{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,6 @@ type GetEntityClientInterface interface {
GetErr1Collision(err int64, err1 int64) (int32, error)
}

type GetEntityContextClientInterface interface {
GetEntityClientInterface
GetEntityContext(ctx context.Context, r *GetEntityRequest) (*GetEntityResponse, error)
GetBoolContext(ctx context.Context) (bool, error)
GetByteContext(ctx context.Context) (int8, error)
GetI16Context(ctx context.Context) (int16, error)
GetI32Context(ctx context.Context) (int32, error)
GetI64Context(ctx context.Context) (int64, error)
GetDoubleContext(ctx context.Context) (float64, error)
GetStringContext(ctx context.Context) (string, error)
GetBinaryContext(ctx context.Context) ([]byte, error)
GetMapContext(ctx context.Context) (map[string]string, error)
GetSetContext(ctx context.Context) ([]string, error)
GetListContext(ctx context.Context) ([]string, error)
GetLegacyStuffContext(ctx context.Context, numPos int64, numNeg1 int64, numNeg2 int64) (int32, error)
GetCtxCollisionContext(ctx1 context.Context, ctx int64) (int32, error)
GetCtx1CollisionContext(ctx2 context.Context, ctx int64, ctx1 int64) (int32, error)
GetContextCollisionContext(ctx context.Context, context_ int64) (int32, error)
GetOutCollisionContext(ctx context.Context, out int64) (int32, error)
GetOut1CollisionContext(ctx context.Context, out int64, out1 int64) (int32, error)
GetInCollisionContext(ctx context.Context, in int64) (int32, error)
GetIn1CollisionContext(ctx context.Context, in int64, in1 int64) (int32, error)
GetErrCollisionContext(ctx context.Context, err int64) (int32, error)
GetErr1CollisionContext(ctx context.Context, err int64, err1 int64) (int32, error)
}

type GetEntityChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -125,7 +99,6 @@ type GetEntityClient struct {
}
// Compile time interface enforcer
var _ GetEntityClientInterface = (*GetEntityClient)(nil)
var _ GetEntityContextClientInterface = (*GetEntityClient)(nil)

func NewGetEntityClient(prot thrift.Protocol) *GetEntityClient {
return &GetEntityClient{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ type FinderClientInterface interface {
PreviousPlate(plate Plate) (Plate, error)
}

type FinderContextClientInterface interface {
FinderClientInterface
ByPlateContext(ctx context.Context, plate Plate) (*Automobile, error)
AliasByPlateContext(ctx context.Context, plate Plate) (*Car, error)
PreviousPlateContext(ctx context.Context, plate Plate) (Plate, error)
}

type FinderChannelClient struct {
ch thrift.RequestChannel
}
Expand All @@ -72,7 +65,6 @@ type FinderClient struct {
}
// Compile time interface enforcer
var _ FinderClientInterface = (*FinderClient)(nil)
var _ FinderContextClientInterface = (*FinderClient)(nil)

func NewFinderClient(prot thrift.Protocol) *FinderClient {
return &FinderClient{
Expand Down
Loading

0 comments on commit 54e3b77

Please sign in to comment.