From 62b8ea3c8ed4de719f9bcd46713eed1ddf4c9cd0 Mon Sep 17 00:00:00 2001 From: Albert Wu Date: Thu, 4 Jun 2026 20:07:45 -0700 Subject: [PATCH] Use YARPC protobuf v2 codegen --- MODULE.bazel | 1 - go.mod | 3 - go.sum | 17 ---- stovepipe/gateway/protopb/BUILD.bazel | 5 +- stovepipe/gateway/protopb/gateway.pb.yarpc.go | 59 ++++++------- stovepipe/orchestrator/protopb/BUILD.bazel | 5 +- .../protopb/orchestrator.pb.yarpc.go | 59 ++++++------- submitqueue/gateway/protopb/BUILD.bazel | 5 +- .../gateway/protopb/gateway.pb.yarpc.go | 83 +++++++++---------- submitqueue/orchestrator/protopb/BUILD.bazel | 5 +- .../protopb/orchestrator.pb.yarpc.go | 59 ++++++------- tool/proto/proto_codegen.bzl | 8 +- 12 files changed, 128 insertions(+), 181 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 47162774..4038a46e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -51,7 +51,6 @@ use_repo( go_deps, "com_github_data_dog_go_sqlmock", "com_github_go_sql_driver_mysql", - "com_github_gogo_protobuf", "com_github_spf13_cobra", "com_github_stretchr_testify", "com_github_uber_go_tally_v4", diff --git a/go.mod b/go.mod index 12ec655d..be4dfc6e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.24.5 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/go-sql-driver/mysql v1.6.0 - github.com/gogo/protobuf v1.3.2 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 github.com/uber-go/tally/v4 v4.1.17 @@ -24,8 +23,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gogo/googleapis v1.4.1 // indirect - github.com/gogo/status v1.1.0 // indirect github.com/golang/mock v1.7.0-rc.1 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index b12bd5d0..4bfc9166 100644 --- a/go.sum +++ b/go.sum @@ -35,11 +35,9 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= @@ -79,7 +77,6 @@ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.7.0 h1:+SbscKmWJ5mOK/bO1zS60F5I9WwZDWOfRsC4RwfwRV0= github.com/kisielk/errcheck v1.7.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -172,8 +169,6 @@ github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVK github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/uber/tchannel-go v1.34.4 h1:Wi7SSfUQbJ4lPqS4trP1uAZvWu46oK0qz0tOodcfcbY= github.com/uber/tchannel-go v1.34.4/go.mod h1:ERHDsQa50nNJxV8Mm6V4nxPWyGvGxiV+T/dUNRzmoC4= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -212,8 +207,6 @@ golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhp golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= @@ -224,9 +217,7 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= @@ -235,10 +226,8 @@ golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= @@ -254,7 +243,6 @@ golang.org/x/sys v0.0.0-20200117145432-59e60aa80a0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -265,7 +253,6 @@ golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= @@ -278,8 +265,6 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200117215004-fe56e6335763/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= @@ -290,10 +275,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def h1:4P81qv5JXI/sDNae2ClVx88cgDDA6DPilADkG9tYKz8= google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def/go.mod h1:bdAgzvd4kFrpykc5/AC2eLUiegK9T/qxZHD4hXYf/ho= -google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/stovepipe/gateway/protopb/BUILD.bazel b/stovepipe/gateway/protopb/BUILD.bazel index 7f54b03f..e4a862ae 100644 --- a/stovepipe/gateway/protopb/BUILD.bazel +++ b/stovepipe/gateway/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/stovepipe/gateway/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/stovepipe/gateway/protopb/gateway.pb.yarpc.go b/stovepipe/gateway/protopb/gateway.pb.yarpc.go index 260f73aa..fde8278f 100644 --- a/stovepipe/gateway/protopb/gateway.pb.yarpc.go +++ b/stovepipe/gateway/protopb/gateway.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -25,9 +24,9 @@ type StovepipeGatewayYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) } -func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) StovepipeGatewayYARPCClient { - return &_StovepipeGatewayYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) StovepipeGatewayYARPCClient { + return &_StovepipeGatewayYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -37,7 +36,7 @@ func newStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, anyReso } // NewStovepipeGatewayYARPCClient builds a new YARPC client for the StovepipeGateway service. -func NewStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) StovepipeGatewayYARPCClient { +func NewStovepipeGatewayYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) StovepipeGatewayYARPCClient { return newStovepipeGatewayYARPCClient(clientConfig, nil, options...) } @@ -48,19 +47,19 @@ type StovepipeGatewayYARPCServer interface { type buildStovepipeGatewayYARPCProceduresParams struct { Server StovepipeGatewayYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildStovepipeGatewayYARPCProcedures(params buildStovepipeGatewayYARPCProceduresParams) []transport.Procedure { handler := &_StovepipeGatewayYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newStovepipeGatewayServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -68,8 +67,8 @@ func buildStovepipeGatewayYARPCProcedures(params buildStovepipeGatewayYARPCProce ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -87,7 +86,7 @@ type FxStovepipeGatewayYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -111,13 +110,13 @@ type FxStovepipeGatewayYARPCClientResult struct { // protopb.NewFxStovepipeGatewayYARPCClient("service-name"), // ... // ) -func NewFxStovepipeGatewayYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxStovepipeGatewayYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxStovepipeGatewayYARPCClientParams) FxStovepipeGatewayYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -137,7 +136,7 @@ type FxStovepipeGatewayYARPCProceduresParams struct { fx.In Server StovepipeGatewayYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxStovepipeGatewayYARPCProceduresResult defines the output @@ -167,22 +166,16 @@ func NewFxStovepipeGatewayYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: StovepipeGatewayReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", + FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, + }, } } } -// StovepipeGatewayReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var StovepipeGatewayReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.stovepipe.StovepipeGateway", - FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, -} - type _StovepipeGatewayYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_StovepipeGatewayYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -192,7 +185,7 @@ func (c *_StovepipeGatewayYARPCCaller) Ping(ctx context.Context, request *PingRe } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptyStovepipeGatewayServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptyStovepipeGatewayServicePingYARPCResponse, responseMessage) } return response, err } @@ -207,7 +200,7 @@ func (h *_StovepipeGatewayYARPCHandler) Ping(ctx context.Context, requestMessage if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptyStovepipeGatewayServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptyStovepipeGatewayServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -256,7 +249,7 @@ var yarpcFileDescriptorClosuref1a937782ebbded5 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) StovepipeGatewayYARPCClient { - return NewStovepipeGatewayYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewStovepipeGatewayYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/stovepipe/orchestrator/protopb/BUILD.bazel b/stovepipe/orchestrator/protopb/BUILD.bazel index 698a7494..ec1bb9b0 100644 --- a/stovepipe/orchestrator/protopb/BUILD.bazel +++ b/stovepipe/orchestrator/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/stovepipe/orchestrator/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go b/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go index 630fb53b..c7a96783 100644 --- a/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go +++ b/stovepipe/orchestrator/protopb/orchestrator.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -25,9 +24,9 @@ type StovepipeOrchestratorYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) } -func newStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) StovepipeOrchestratorYARPCClient { - return &_StovepipeOrchestratorYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) StovepipeOrchestratorYARPCClient { + return &_StovepipeOrchestratorYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -37,7 +36,7 @@ func newStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, an } // NewStovepipeOrchestratorYARPCClient builds a new YARPC client for the StovepipeOrchestrator service. -func NewStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) StovepipeOrchestratorYARPCClient { +func NewStovepipeOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) StovepipeOrchestratorYARPCClient { return newStovepipeOrchestratorYARPCClient(clientConfig, nil, options...) } @@ -48,19 +47,19 @@ type StovepipeOrchestratorYARPCServer interface { type buildStovepipeOrchestratorYARPCProceduresParams struct { Server StovepipeOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildStovepipeOrchestratorYARPCProcedures(params buildStovepipeOrchestratorYARPCProceduresParams) []transport.Procedure { handler := &_StovepipeOrchestratorYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newStovepipeOrchestratorServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -68,8 +67,8 @@ func buildStovepipeOrchestratorYARPCProcedures(params buildStovepipeOrchestrator ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -87,7 +86,7 @@ type FxStovepipeOrchestratorYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -111,13 +110,13 @@ type FxStovepipeOrchestratorYARPCClientResult struct { // protopb.NewFxStovepipeOrchestratorYARPCClient("service-name"), // ... // ) -func NewFxStovepipeOrchestratorYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxStovepipeOrchestratorYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxStovepipeOrchestratorYARPCClientParams) FxStovepipeOrchestratorYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -137,7 +136,7 @@ type FxStovepipeOrchestratorYARPCProceduresParams struct { fx.In Server StovepipeOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxStovepipeOrchestratorYARPCProceduresResult defines the output @@ -167,22 +166,16 @@ func NewFxStovepipeOrchestratorYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: StovepipeOrchestratorReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", + FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, + }, } } } -// StovepipeOrchestratorReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var StovepipeOrchestratorReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.stovepipe.orchestrator.StovepipeOrchestrator", - FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, -} - type _StovepipeOrchestratorYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_StovepipeOrchestratorYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -192,7 +185,7 @@ func (c *_StovepipeOrchestratorYARPCCaller) Ping(ctx context.Context, request *P } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptyStovepipeOrchestratorServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptyStovepipeOrchestratorServicePingYARPCResponse, responseMessage) } return response, err } @@ -207,7 +200,7 @@ func (h *_StovepipeOrchestratorYARPCHandler) Ping(ctx context.Context, requestMe if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptyStovepipeOrchestratorServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptyStovepipeOrchestratorServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -256,7 +249,7 @@ var yarpcFileDescriptorClosure96b6e6782baaa298 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) StovepipeOrchestratorYARPCClient { - return NewStovepipeOrchestratorYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewStovepipeOrchestratorYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/submitqueue/gateway/protopb/BUILD.bazel b/submitqueue/gateway/protopb/BUILD.bazel index b9a4d66c..9695fa42 100644 --- a/submitqueue/gateway/protopb/BUILD.bazel +++ b/submitqueue/gateway/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/submitqueue/gateway/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/submitqueue/gateway/protopb/gateway.pb.yarpc.go b/submitqueue/gateway/protopb/gateway.pb.yarpc.go index faaa8217..e04d0127 100644 --- a/submitqueue/gateway/protopb/gateway.pb.yarpc.go +++ b/submitqueue/gateway/protopb/gateway.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -28,9 +27,9 @@ type SubmitQueueGatewayYARPCClient interface { Status(context.Context, *StatusRequest, ...yarpc.CallOption) (*StatusResponse, error) } -func newSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) SubmitQueueGatewayYARPCClient { - return &_SubmitQueueGatewayYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) SubmitQueueGatewayYARPCClient { + return &_SubmitQueueGatewayYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -40,7 +39,7 @@ func newSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, anyRe } // NewSubmitQueueGatewayYARPCClient builds a new YARPC client for the SubmitQueueGateway service. -func NewSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) SubmitQueueGatewayYARPCClient { +func NewSubmitQueueGatewayYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) SubmitQueueGatewayYARPCClient { return newSubmitQueueGatewayYARPCClient(clientConfig, nil, options...) } @@ -54,19 +53,19 @@ type SubmitQueueGatewayYARPCServer interface { type buildSubmitQueueGatewayYARPCProceduresParams struct { Server SubmitQueueGatewayYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCProceduresParams) []transport.Procedure { handler := &_SubmitQueueGatewayYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newSubmitQueueGatewayServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -75,8 +74,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP }, { MethodName: "Land", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Land, NewRequest: newSubmitQueueGatewayServiceLandYARPCRequest, AnyResolver: params.AnyResolver, @@ -85,8 +84,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP }, { MethodName: "Cancel", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Cancel, NewRequest: newSubmitQueueGatewayServiceCancelYARPCRequest, AnyResolver: params.AnyResolver, @@ -95,8 +94,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP }, { MethodName: "Status", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Status, NewRequest: newSubmitQueueGatewayServiceStatusYARPCRequest, AnyResolver: params.AnyResolver, @@ -104,8 +103,8 @@ func buildSubmitQueueGatewayYARPCProcedures(params buildSubmitQueueGatewayYARPCP ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -123,7 +122,7 @@ type FxSubmitQueueGatewayYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -147,13 +146,13 @@ type FxSubmitQueueGatewayYARPCClientResult struct { // protopb.NewFxSubmitQueueGatewayYARPCClient("service-name"), // ... // ) -func NewFxSubmitQueueGatewayYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxSubmitQueueGatewayYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxSubmitQueueGatewayYARPCClientParams) FxSubmitQueueGatewayYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -173,7 +172,7 @@ type FxSubmitQueueGatewayYARPCProceduresParams struct { fx.In Server SubmitQueueGatewayYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxSubmitQueueGatewayYARPCProceduresResult defines the output @@ -203,22 +202,16 @@ func NewFxSubmitQueueGatewayYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: SubmitQueueGatewayReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", + FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, + }, } } } -// SubmitQueueGatewayReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var SubmitQueueGatewayReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.gateway.SubmitQueueGateway", - FileDescriptors: yarpcFileDescriptorClosuref1a937782ebbded5, -} - type _SubmitQueueGatewayYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_SubmitQueueGatewayYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -228,7 +221,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Ping(ctx context.Context, request *Ping } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServicePingYARPCResponse, responseMessage) } return response, err } @@ -240,7 +233,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Land(ctx context.Context, request *Land } response, ok := responseMessage.(*LandResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceLandYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceLandYARPCResponse, responseMessage) } return response, err } @@ -252,7 +245,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Cancel(ctx context.Context, request *Ca } response, ok := responseMessage.(*CancelResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceCancelYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceCancelYARPCResponse, responseMessage) } return response, err } @@ -264,7 +257,7 @@ func (c *_SubmitQueueGatewayYARPCCaller) Status(ctx context.Context, request *St } response, ok := responseMessage.(*StatusResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceStatusYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceStatusYARPCResponse, responseMessage) } return response, err } @@ -279,7 +272,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Ping(ctx context.Context, requestMessa if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -295,7 +288,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Land(ctx context.Context, requestMessa if requestMessage != nil { request, ok = requestMessage.(*LandRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceLandYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceLandYARPCRequest, requestMessage) } } response, err := h.server.Land(ctx, request) @@ -311,7 +304,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Cancel(ctx context.Context, requestMes if requestMessage != nil { request, ok = requestMessage.(*CancelRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceCancelYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceCancelYARPCRequest, requestMessage) } } response, err := h.server.Cancel(ctx, request) @@ -327,7 +320,7 @@ func (h *_SubmitQueueGatewayYARPCHandler) Status(ctx context.Context, requestMes if requestMessage != nil { request, ok = requestMessage.(*StatusRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueGatewayServiceStatusYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueGatewayServiceStatusYARPCRequest, requestMessage) } } response, err := h.server.Status(ctx, request) @@ -430,7 +423,7 @@ var yarpcFileDescriptorClosuref1a937782ebbded5 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) SubmitQueueGatewayYARPCClient { - return NewSubmitQueueGatewayYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewSubmitQueueGatewayYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/submitqueue/orchestrator/protopb/BUILD.bazel b/submitqueue/orchestrator/protopb/BUILD.bazel index eb6e7958..790e5928 100644 --- a/submitqueue/orchestrator/protopb/BUILD.bazel +++ b/submitqueue/orchestrator/protopb/BUILD.bazel @@ -10,18 +10,17 @@ go_library( importpath = "github.com/uber/submitqueue/submitqueue/orchestrator/protopb", visibility = ["//visibility:public"], deps = [ - "@com_github_gogo_protobuf//jsonpb", - "@com_github_gogo_protobuf//proto", "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//status", + "@org_golang_google_protobuf//proto", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_uber_go_fx//:fx", "@org_uber_go_yarpc//:yarpc", "@org_uber_go_yarpc//api/transport", "@org_uber_go_yarpc//api/x/restriction", - "@org_uber_go_yarpc//encoding/protobuf", "@org_uber_go_yarpc//encoding/protobuf/reflection", + "@org_uber_go_yarpc//encoding/protobuf/v2:protobuf", ], ) diff --git a/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go b/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go index 7ff6b5bc..c1570391 100644 --- a/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go +++ b/submitqueue/orchestrator/protopb/orchestrator.pb.yarpc.go @@ -8,14 +8,13 @@ import ( "io/ioutil" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "go.uber.org/fx" "go.uber.org/yarpc" "go.uber.org/yarpc/api/transport" "go.uber.org/yarpc/api/x/restriction" - "go.uber.org/yarpc/encoding/protobuf" "go.uber.org/yarpc/encoding/protobuf/reflection" + v2 "go.uber.org/yarpc/encoding/protobuf/v2" + "google.golang.org/protobuf/proto" ) var _ = ioutil.NopCloser @@ -25,9 +24,9 @@ type SubmitQueueOrchestratorYARPCClient interface { Ping(context.Context, *PingRequest, ...yarpc.CallOption) (*PingResponse, error) } -func newSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) SubmitQueueOrchestratorYARPCClient { - return &_SubmitQueueOrchestratorYARPCCaller{protobuf.NewStreamClient( - protobuf.ClientParams{ +func newSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, anyResolver v2.AnyResolver, options ...v2.ClientOption) SubmitQueueOrchestratorYARPCClient { + return &_SubmitQueueOrchestratorYARPCCaller{v2.NewStreamClient( + v2.ClientParams{ ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", ClientConfig: clientConfig, AnyResolver: anyResolver, @@ -37,7 +36,7 @@ func newSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, } // NewSubmitQueueOrchestratorYARPCClient builds a new YARPC client for the SubmitQueueOrchestrator service. -func NewSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) SubmitQueueOrchestratorYARPCClient { +func NewSubmitQueueOrchestratorYARPCClient(clientConfig transport.ClientConfig, options ...v2.ClientOption) SubmitQueueOrchestratorYARPCClient { return newSubmitQueueOrchestratorYARPCClient(clientConfig, nil, options...) } @@ -48,19 +47,19 @@ type SubmitQueueOrchestratorYARPCServer interface { type buildSubmitQueueOrchestratorYARPCProceduresParams struct { Server SubmitQueueOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver + AnyResolver v2.AnyResolver } func buildSubmitQueueOrchestratorYARPCProcedures(params buildSubmitQueueOrchestratorYARPCProceduresParams) []transport.Procedure { handler := &_SubmitQueueOrchestratorYARPCHandler{params.Server} - return protobuf.BuildProcedures( - protobuf.BuildProceduresParams{ + return v2.BuildProcedures( + v2.BuildProceduresParams{ ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", - UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{ + UnaryHandlerParams: []v2.BuildProceduresUnaryHandlerParams{ { MethodName: "Ping", - Handler: protobuf.NewUnaryHandler( - protobuf.UnaryHandlerParams{ + Handler: v2.NewUnaryHandler( + v2.UnaryHandlerParams{ Handle: handler.Ping, NewRequest: newSubmitQueueOrchestratorServicePingYARPCRequest, AnyResolver: params.AnyResolver, @@ -68,8 +67,8 @@ func buildSubmitQueueOrchestratorYARPCProcedures(params buildSubmitQueueOrchestr ), }, }, - OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{}, - StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{}, + OnewayHandlerParams: []v2.BuildProceduresOnewayHandlerParams{}, + StreamHandlerParams: []v2.BuildProceduresStreamHandlerParams{}, }, ) } @@ -87,7 +86,7 @@ type FxSubmitQueueOrchestratorYARPCClientParams struct { fx.In Provider yarpc.ClientConfig - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` Restriction restriction.Checker `optional:"true"` } @@ -111,13 +110,13 @@ type FxSubmitQueueOrchestratorYARPCClientResult struct { // protopb.NewFxSubmitQueueOrchestratorYARPCClient("service-name"), // ... // ) -func NewFxSubmitQueueOrchestratorYARPCClient(name string, options ...protobuf.ClientOption) interface{} { +func NewFxSubmitQueueOrchestratorYARPCClient(name string, options ...v2.ClientOption) interface{} { return func(params FxSubmitQueueOrchestratorYARPCClientParams) FxSubmitQueueOrchestratorYARPCClientResult { cc := params.Provider.ClientConfig(name) if params.Restriction != nil { if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok { - if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil { + if err := params.Restriction.Check(v2.Encoding, namer.TransportName()); err != nil { panic(err.Error()) } } @@ -137,7 +136,7 @@ type FxSubmitQueueOrchestratorYARPCProceduresParams struct { fx.In Server SubmitQueueOrchestratorYARPCServer - AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"` + AnyResolver v2.AnyResolver `name:"yarpcfx" optional:"true"` } // FxSubmitQueueOrchestratorYARPCProceduresResult defines the output @@ -167,22 +166,16 @@ func NewFxSubmitQueueOrchestratorYARPCProcedures() interface{} { Server: params.Server, AnyResolver: params.AnyResolver, }), - ReflectionMeta: SubmitQueueOrchestratorReflectionMeta, + ReflectionMeta: reflection.ServerMeta{ + ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", + FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, + }, } } } -// SubmitQueueOrchestratorReflectionMeta is the reflection server metadata -// required for using the gRPC reflection protocol with YARPC. -// -// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md. -var SubmitQueueOrchestratorReflectionMeta = reflection.ServerMeta{ - ServiceName: "uber.submitqueue.orchestrator.SubmitQueueOrchestrator", - FileDescriptors: yarpcFileDescriptorClosure96b6e6782baaa298, -} - type _SubmitQueueOrchestratorYARPCCaller struct { - streamClient protobuf.StreamClient + streamClient v2.StreamClient } func (c *_SubmitQueueOrchestratorYARPCCaller) Ping(ctx context.Context, request *PingRequest, options ...yarpc.CallOption) (*PingResponse, error) { @@ -192,7 +185,7 @@ func (c *_SubmitQueueOrchestratorYARPCCaller) Ping(ctx context.Context, request } response, ok := responseMessage.(*PingResponse) if !ok { - return nil, protobuf.CastError(emptySubmitQueueOrchestratorServicePingYARPCResponse, responseMessage) + return nil, v2.CastError(emptySubmitQueueOrchestratorServicePingYARPCResponse, responseMessage) } return response, err } @@ -207,7 +200,7 @@ func (h *_SubmitQueueOrchestratorYARPCHandler) Ping(ctx context.Context, request if requestMessage != nil { request, ok = requestMessage.(*PingRequest) if !ok { - return nil, protobuf.CastError(emptySubmitQueueOrchestratorServicePingYARPCRequest, requestMessage) + return nil, v2.CastError(emptySubmitQueueOrchestratorServicePingYARPCRequest, requestMessage) } } response, err := h.server.Ping(ctx, request) @@ -256,7 +249,7 @@ var yarpcFileDescriptorClosure96b6e6782baaa298 = [][]byte{ func init() { yarpc.RegisterClientBuilder( func(clientConfig transport.ClientConfig, structField reflect.StructField) SubmitQueueOrchestratorYARPCClient { - return NewSubmitQueueOrchestratorYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...) + return NewSubmitQueueOrchestratorYARPCClient(clientConfig, v2.ClientBuilderOptions(clientConfig, structField)...) }, ) } diff --git a/tool/proto/proto_codegen.bzl b/tool/proto/proto_codegen.bzl index dbc087a3..8df3a2b9 100644 --- a/tool/proto/proto_codegen.bzl +++ b/tool/proto/proto_codegen.bzl @@ -24,13 +24,13 @@ def _go_proto_generated_files_impl(ctx): args.add(opt) args.add("--plugin=protoc-gen-go={}".format(ctx.executable._protoc_gen_go.path)) args.add("--plugin=protoc-gen-go-grpc={}".format(ctx.executable._protoc_gen_go_grpc.path)) - args.add("--plugin=protoc-gen-yarpc-go={}".format(ctx.executable._protoc_gen_yarpc_go.path)) + args.add("--plugin=protoc-gen-yarpc-go-v2={}".format(ctx.executable._protoc_gen_yarpc_go.path)) args.add("--go_out={}".format(outputs[0].dirname)) args.add("--go_opt=paths=source_relative") args.add("--go-grpc_out={}".format(outputs[0].dirname)) args.add("--go-grpc_opt=paths=source_relative") - args.add("--yarpc-go_out={}".format(outputs[0].dirname)) - args.add("--yarpc-go_opt=paths=source_relative") + args.add("--yarpc-go-v2_out={}".format(outputs[0].dirname)) + args.add("--yarpc-go-v2_opt=paths=source_relative") args.add("--proto_path={}".format(src.dirname)) args.add(src.path) @@ -75,7 +75,7 @@ go_proto_generated_files = rule( cfg = "exec", ), "_protoc_gen_yarpc_go": attr.label( - default = "@org_uber_go_yarpc//encoding/protobuf/protoc-gen-yarpc-go", + default = "@org_uber_go_yarpc//encoding/protobuf/protoc-gen-yarpc-go-v2", executable = True, cfg = "exec", ),