github.com/hashicorp/go-plugin@v1.6.0/test/grpc/test_grpc.pb.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 5 // versions: 6 // - protoc-gen-go-grpc v1.3.0 7 // - protoc (unknown) 8 // source: test/grpc/test.proto 9 10 package grpctest 11 12 import ( 13 context "context" 14 grpc "google.golang.org/grpc" 15 codes "google.golang.org/grpc/codes" 16 status "google.golang.org/grpc/status" 17 emptypb "google.golang.org/protobuf/types/known/emptypb" 18 ) 19 20 // This is a compile-time assertion to ensure that this generated file 21 // is compatible with the grpc package it is being compiled against. 22 // Requires gRPC-Go v1.32.0 or later. 23 const _ = grpc.SupportPackageIsVersion7 24 25 const ( 26 Test_Double_FullMethodName = "/grpctest.Test/Double" 27 Test_PrintKV_FullMethodName = "/grpctest.Test/PrintKV" 28 Test_Bidirectional_FullMethodName = "/grpctest.Test/Bidirectional" 29 Test_Stream_FullMethodName = "/grpctest.Test/Stream" 30 Test_PrintStdio_FullMethodName = "/grpctest.Test/PrintStdio" 31 ) 32 33 // TestClient is the client API for Test service. 34 // 35 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 36 type TestClient interface { 37 Double(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) 38 PrintKV(ctx context.Context, in *PrintKVRequest, opts ...grpc.CallOption) (*PrintKVResponse, error) 39 Bidirectional(ctx context.Context, in *BidirectionalRequest, opts ...grpc.CallOption) (*BidirectionalResponse, error) 40 Stream(ctx context.Context, opts ...grpc.CallOption) (Test_StreamClient, error) 41 PrintStdio(ctx context.Context, in *PrintStdioRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) 42 } 43 44 type testClient struct { 45 cc grpc.ClientConnInterface 46 } 47 48 func NewTestClient(cc grpc.ClientConnInterface) TestClient { 49 return &testClient{cc} 50 } 51 52 func (c *testClient) Double(ctx context.Context, in *TestRequest, opts ...grpc.CallOption) (*TestResponse, error) { 53 out := new(TestResponse) 54 err := c.cc.Invoke(ctx, Test_Double_FullMethodName, in, out, opts...) 55 if err != nil { 56 return nil, err 57 } 58 return out, nil 59 } 60 61 func (c *testClient) PrintKV(ctx context.Context, in *PrintKVRequest, opts ...grpc.CallOption) (*PrintKVResponse, error) { 62 out := new(PrintKVResponse) 63 err := c.cc.Invoke(ctx, Test_PrintKV_FullMethodName, in, out, opts...) 64 if err != nil { 65 return nil, err 66 } 67 return out, nil 68 } 69 70 func (c *testClient) Bidirectional(ctx context.Context, in *BidirectionalRequest, opts ...grpc.CallOption) (*BidirectionalResponse, error) { 71 out := new(BidirectionalResponse) 72 err := c.cc.Invoke(ctx, Test_Bidirectional_FullMethodName, in, out, opts...) 73 if err != nil { 74 return nil, err 75 } 76 return out, nil 77 } 78 79 func (c *testClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Test_StreamClient, error) { 80 stream, err := c.cc.NewStream(ctx, &Test_ServiceDesc.Streams[0], Test_Stream_FullMethodName, opts...) 81 if err != nil { 82 return nil, err 83 } 84 x := &testStreamClient{stream} 85 return x, nil 86 } 87 88 type Test_StreamClient interface { 89 Send(*TestRequest) error 90 Recv() (*TestResponse, error) 91 grpc.ClientStream 92 } 93 94 type testStreamClient struct { 95 grpc.ClientStream 96 } 97 98 func (x *testStreamClient) Send(m *TestRequest) error { 99 return x.ClientStream.SendMsg(m) 100 } 101 102 func (x *testStreamClient) Recv() (*TestResponse, error) { 103 m := new(TestResponse) 104 if err := x.ClientStream.RecvMsg(m); err != nil { 105 return nil, err 106 } 107 return m, nil 108 } 109 110 func (c *testClient) PrintStdio(ctx context.Context, in *PrintStdioRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { 111 out := new(emptypb.Empty) 112 err := c.cc.Invoke(ctx, Test_PrintStdio_FullMethodName, in, out, opts...) 113 if err != nil { 114 return nil, err 115 } 116 return out, nil 117 } 118 119 // TestServer is the server API for Test service. 120 // All implementations should embed UnimplementedTestServer 121 // for forward compatibility 122 type TestServer interface { 123 Double(context.Context, *TestRequest) (*TestResponse, error) 124 PrintKV(context.Context, *PrintKVRequest) (*PrintKVResponse, error) 125 Bidirectional(context.Context, *BidirectionalRequest) (*BidirectionalResponse, error) 126 Stream(Test_StreamServer) error 127 PrintStdio(context.Context, *PrintStdioRequest) (*emptypb.Empty, error) 128 } 129 130 // UnimplementedTestServer should be embedded to have forward compatible implementations. 131 type UnimplementedTestServer struct { 132 } 133 134 func (UnimplementedTestServer) Double(context.Context, *TestRequest) (*TestResponse, error) { 135 return nil, status.Errorf(codes.Unimplemented, "method Double not implemented") 136 } 137 func (UnimplementedTestServer) PrintKV(context.Context, *PrintKVRequest) (*PrintKVResponse, error) { 138 return nil, status.Errorf(codes.Unimplemented, "method PrintKV not implemented") 139 } 140 func (UnimplementedTestServer) Bidirectional(context.Context, *BidirectionalRequest) (*BidirectionalResponse, error) { 141 return nil, status.Errorf(codes.Unimplemented, "method Bidirectional not implemented") 142 } 143 func (UnimplementedTestServer) Stream(Test_StreamServer) error { 144 return status.Errorf(codes.Unimplemented, "method Stream not implemented") 145 } 146 func (UnimplementedTestServer) PrintStdio(context.Context, *PrintStdioRequest) (*emptypb.Empty, error) { 147 return nil, status.Errorf(codes.Unimplemented, "method PrintStdio not implemented") 148 } 149 150 // UnsafeTestServer may be embedded to opt out of forward compatibility for this service. 151 // Use of this interface is not recommended, as added methods to TestServer will 152 // result in compilation errors. 153 type UnsafeTestServer interface { 154 mustEmbedUnimplementedTestServer() 155 } 156 157 func RegisterTestServer(s grpc.ServiceRegistrar, srv TestServer) { 158 s.RegisterService(&Test_ServiceDesc, srv) 159 } 160 161 func _Test_Double_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 162 in := new(TestRequest) 163 if err := dec(in); err != nil { 164 return nil, err 165 } 166 if interceptor == nil { 167 return srv.(TestServer).Double(ctx, in) 168 } 169 info := &grpc.UnaryServerInfo{ 170 Server: srv, 171 FullMethod: Test_Double_FullMethodName, 172 } 173 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 174 return srv.(TestServer).Double(ctx, req.(*TestRequest)) 175 } 176 return interceptor(ctx, in, info, handler) 177 } 178 179 func _Test_PrintKV_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 180 in := new(PrintKVRequest) 181 if err := dec(in); err != nil { 182 return nil, err 183 } 184 if interceptor == nil { 185 return srv.(TestServer).PrintKV(ctx, in) 186 } 187 info := &grpc.UnaryServerInfo{ 188 Server: srv, 189 FullMethod: Test_PrintKV_FullMethodName, 190 } 191 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 192 return srv.(TestServer).PrintKV(ctx, req.(*PrintKVRequest)) 193 } 194 return interceptor(ctx, in, info, handler) 195 } 196 197 func _Test_Bidirectional_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 198 in := new(BidirectionalRequest) 199 if err := dec(in); err != nil { 200 return nil, err 201 } 202 if interceptor == nil { 203 return srv.(TestServer).Bidirectional(ctx, in) 204 } 205 info := &grpc.UnaryServerInfo{ 206 Server: srv, 207 FullMethod: Test_Bidirectional_FullMethodName, 208 } 209 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 210 return srv.(TestServer).Bidirectional(ctx, req.(*BidirectionalRequest)) 211 } 212 return interceptor(ctx, in, info, handler) 213 } 214 215 func _Test_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { 216 return srv.(TestServer).Stream(&testStreamServer{stream}) 217 } 218 219 type Test_StreamServer interface { 220 Send(*TestResponse) error 221 Recv() (*TestRequest, error) 222 grpc.ServerStream 223 } 224 225 type testStreamServer struct { 226 grpc.ServerStream 227 } 228 229 func (x *testStreamServer) Send(m *TestResponse) error { 230 return x.ServerStream.SendMsg(m) 231 } 232 233 func (x *testStreamServer) Recv() (*TestRequest, error) { 234 m := new(TestRequest) 235 if err := x.ServerStream.RecvMsg(m); err != nil { 236 return nil, err 237 } 238 return m, nil 239 } 240 241 func _Test_PrintStdio_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 242 in := new(PrintStdioRequest) 243 if err := dec(in); err != nil { 244 return nil, err 245 } 246 if interceptor == nil { 247 return srv.(TestServer).PrintStdio(ctx, in) 248 } 249 info := &grpc.UnaryServerInfo{ 250 Server: srv, 251 FullMethod: Test_PrintStdio_FullMethodName, 252 } 253 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 254 return srv.(TestServer).PrintStdio(ctx, req.(*PrintStdioRequest)) 255 } 256 return interceptor(ctx, in, info, handler) 257 } 258 259 // Test_ServiceDesc is the grpc.ServiceDesc for Test service. 260 // It's only intended for direct use with grpc.RegisterService, 261 // and not to be introspected or modified (even as a copy) 262 var Test_ServiceDesc = grpc.ServiceDesc{ 263 ServiceName: "grpctest.Test", 264 HandlerType: (*TestServer)(nil), 265 Methods: []grpc.MethodDesc{ 266 { 267 MethodName: "Double", 268 Handler: _Test_Double_Handler, 269 }, 270 { 271 MethodName: "PrintKV", 272 Handler: _Test_PrintKV_Handler, 273 }, 274 { 275 MethodName: "Bidirectional", 276 Handler: _Test_Bidirectional_Handler, 277 }, 278 { 279 MethodName: "PrintStdio", 280 Handler: _Test_PrintStdio_Handler, 281 }, 282 }, 283 Streams: []grpc.StreamDesc{ 284 { 285 StreamName: "Stream", 286 Handler: _Test_Stream_Handler, 287 ServerStreams: true, 288 ClientStreams: true, 289 }, 290 }, 291 Metadata: "test/grpc/test.proto", 292 } 293 294 const ( 295 PingPong_Ping_FullMethodName = "/grpctest.PingPong/Ping" 296 ) 297 298 // PingPongClient is the client API for PingPong service. 299 // 300 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 301 type PingPongClient interface { 302 Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) 303 } 304 305 type pingPongClient struct { 306 cc grpc.ClientConnInterface 307 } 308 309 func NewPingPongClient(cc grpc.ClientConnInterface) PingPongClient { 310 return &pingPongClient{cc} 311 } 312 313 func (c *pingPongClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) { 314 out := new(PongResponse) 315 err := c.cc.Invoke(ctx, PingPong_Ping_FullMethodName, in, out, opts...) 316 if err != nil { 317 return nil, err 318 } 319 return out, nil 320 } 321 322 // PingPongServer is the server API for PingPong service. 323 // All implementations should embed UnimplementedPingPongServer 324 // for forward compatibility 325 type PingPongServer interface { 326 Ping(context.Context, *PingRequest) (*PongResponse, error) 327 } 328 329 // UnimplementedPingPongServer should be embedded to have forward compatible implementations. 330 type UnimplementedPingPongServer struct { 331 } 332 333 func (UnimplementedPingPongServer) Ping(context.Context, *PingRequest) (*PongResponse, error) { 334 return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") 335 } 336 337 // UnsafePingPongServer may be embedded to opt out of forward compatibility for this service. 338 // Use of this interface is not recommended, as added methods to PingPongServer will 339 // result in compilation errors. 340 type UnsafePingPongServer interface { 341 mustEmbedUnimplementedPingPongServer() 342 } 343 344 func RegisterPingPongServer(s grpc.ServiceRegistrar, srv PingPongServer) { 345 s.RegisterService(&PingPong_ServiceDesc, srv) 346 } 347 348 func _PingPong_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 349 in := new(PingRequest) 350 if err := dec(in); err != nil { 351 return nil, err 352 } 353 if interceptor == nil { 354 return srv.(PingPongServer).Ping(ctx, in) 355 } 356 info := &grpc.UnaryServerInfo{ 357 Server: srv, 358 FullMethod: PingPong_Ping_FullMethodName, 359 } 360 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 361 return srv.(PingPongServer).Ping(ctx, req.(*PingRequest)) 362 } 363 return interceptor(ctx, in, info, handler) 364 } 365 366 // PingPong_ServiceDesc is the grpc.ServiceDesc for PingPong service. 367 // It's only intended for direct use with grpc.RegisterService, 368 // and not to be introspected or modified (even as a copy) 369 var PingPong_ServiceDesc = grpc.ServiceDesc{ 370 ServiceName: "grpctest.PingPong", 371 HandlerType: (*PingPongServer)(nil), 372 Methods: []grpc.MethodDesc{ 373 { 374 MethodName: "Ping", 375 Handler: _PingPong_Ping_Handler, 376 }, 377 }, 378 Streams: []grpc.StreamDesc{}, 379 Metadata: "test/grpc/test.proto", 380 }