google.golang.org/grpc@v1.72.2/interop/grpc_testing/worker_service_grpc.pb.go (about) 1 // Copyright 2015 gRPC authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // An integration test service that covers all the method signature permutations 16 // of unary/streaming requests/responses. 17 18 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 19 // versions: 20 // - protoc-gen-go-grpc v1.5.1 21 // - protoc v5.27.1 22 // source: grpc/testing/worker_service.proto 23 24 package grpc_testing 25 26 import ( 27 context "context" 28 grpc "google.golang.org/grpc" 29 codes "google.golang.org/grpc/codes" 30 status "google.golang.org/grpc/status" 31 ) 32 33 // This is a compile-time assertion to ensure that this generated file 34 // is compatible with the grpc package it is being compiled against. 35 // Requires gRPC-Go v1.64.0 or later. 36 const _ = grpc.SupportPackageIsVersion9 37 38 const ( 39 WorkerService_RunServer_FullMethodName = "/grpc.testing.WorkerService/RunServer" 40 WorkerService_RunClient_FullMethodName = "/grpc.testing.WorkerService/RunClient" 41 WorkerService_CoreCount_FullMethodName = "/grpc.testing.WorkerService/CoreCount" 42 WorkerService_QuitWorker_FullMethodName = "/grpc.testing.WorkerService/QuitWorker" 43 ) 44 45 // WorkerServiceClient is the client API for WorkerService service. 46 // 47 // 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. 48 type WorkerServiceClient interface { 49 // Start server with specified workload. 50 // First request sent specifies the ServerConfig followed by ServerStatus 51 // response. After that, a "Mark" can be sent anytime to request the latest 52 // stats. Closing the stream will initiate shutdown of the test server 53 // and once the shutdown has finished, the OK status is sent to terminate 54 // this RPC. 55 RunServer(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerArgs, ServerStatus], error) 56 // Start client with specified workload. 57 // First request sent specifies the ClientConfig followed by ClientStatus 58 // response. After that, a "Mark" can be sent anytime to request the latest 59 // stats. Closing the stream will initiate shutdown of the test client 60 // and once the shutdown has finished, the OK status is sent to terminate 61 // this RPC. 62 RunClient(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientArgs, ClientStatus], error) 63 // Just return the core count - unary call 64 CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) 65 // Quit this worker 66 QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) 67 } 68 69 type workerServiceClient struct { 70 cc grpc.ClientConnInterface 71 } 72 73 func NewWorkerServiceClient(cc grpc.ClientConnInterface) WorkerServiceClient { 74 return &workerServiceClient{cc} 75 } 76 77 func (c *workerServiceClient) RunServer(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerArgs, ServerStatus], error) { 78 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 79 stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[0], WorkerService_RunServer_FullMethodName, cOpts...) 80 if err != nil { 81 return nil, err 82 } 83 x := &grpc.GenericClientStream[ServerArgs, ServerStatus]{ClientStream: stream} 84 return x, nil 85 } 86 87 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 88 type WorkerService_RunServerClient = grpc.BidiStreamingClient[ServerArgs, ServerStatus] 89 90 func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientArgs, ClientStatus], error) { 91 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 92 stream, err := c.cc.NewStream(ctx, &WorkerService_ServiceDesc.Streams[1], WorkerService_RunClient_FullMethodName, cOpts...) 93 if err != nil { 94 return nil, err 95 } 96 x := &grpc.GenericClientStream[ClientArgs, ClientStatus]{ClientStream: stream} 97 return x, nil 98 } 99 100 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 101 type WorkerService_RunClientClient = grpc.BidiStreamingClient[ClientArgs, ClientStatus] 102 103 func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) { 104 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 105 out := new(CoreResponse) 106 err := c.cc.Invoke(ctx, WorkerService_CoreCount_FullMethodName, in, out, cOpts...) 107 if err != nil { 108 return nil, err 109 } 110 return out, nil 111 } 112 113 func (c *workerServiceClient) QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) { 114 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 115 out := new(Void) 116 err := c.cc.Invoke(ctx, WorkerService_QuitWorker_FullMethodName, in, out, cOpts...) 117 if err != nil { 118 return nil, err 119 } 120 return out, nil 121 } 122 123 // WorkerServiceServer is the server API for WorkerService service. 124 // All implementations must embed UnimplementedWorkerServiceServer 125 // for forward compatibility. 126 type WorkerServiceServer interface { 127 // Start server with specified workload. 128 // First request sent specifies the ServerConfig followed by ServerStatus 129 // response. After that, a "Mark" can be sent anytime to request the latest 130 // stats. Closing the stream will initiate shutdown of the test server 131 // and once the shutdown has finished, the OK status is sent to terminate 132 // this RPC. 133 RunServer(grpc.BidiStreamingServer[ServerArgs, ServerStatus]) error 134 // Start client with specified workload. 135 // First request sent specifies the ClientConfig followed by ClientStatus 136 // response. After that, a "Mark" can be sent anytime to request the latest 137 // stats. Closing the stream will initiate shutdown of the test client 138 // and once the shutdown has finished, the OK status is sent to terminate 139 // this RPC. 140 RunClient(grpc.BidiStreamingServer[ClientArgs, ClientStatus]) error 141 // Just return the core count - unary call 142 CoreCount(context.Context, *CoreRequest) (*CoreResponse, error) 143 // Quit this worker 144 QuitWorker(context.Context, *Void) (*Void, error) 145 mustEmbedUnimplementedWorkerServiceServer() 146 } 147 148 // UnimplementedWorkerServiceServer must be embedded to have 149 // forward compatible implementations. 150 // 151 // NOTE: this should be embedded by value instead of pointer to avoid a nil 152 // pointer dereference when methods are called. 153 type UnimplementedWorkerServiceServer struct{} 154 155 func (UnimplementedWorkerServiceServer) RunServer(grpc.BidiStreamingServer[ServerArgs, ServerStatus]) error { 156 return status.Errorf(codes.Unimplemented, "method RunServer not implemented") 157 } 158 func (UnimplementedWorkerServiceServer) RunClient(grpc.BidiStreamingServer[ClientArgs, ClientStatus]) error { 159 return status.Errorf(codes.Unimplemented, "method RunClient not implemented") 160 } 161 func (UnimplementedWorkerServiceServer) CoreCount(context.Context, *CoreRequest) (*CoreResponse, error) { 162 return nil, status.Errorf(codes.Unimplemented, "method CoreCount not implemented") 163 } 164 func (UnimplementedWorkerServiceServer) QuitWorker(context.Context, *Void) (*Void, error) { 165 return nil, status.Errorf(codes.Unimplemented, "method QuitWorker not implemented") 166 } 167 func (UnimplementedWorkerServiceServer) mustEmbedUnimplementedWorkerServiceServer() {} 168 func (UnimplementedWorkerServiceServer) testEmbeddedByValue() {} 169 170 // UnsafeWorkerServiceServer may be embedded to opt out of forward compatibility for this service. 171 // Use of this interface is not recommended, as added methods to WorkerServiceServer will 172 // result in compilation errors. 173 type UnsafeWorkerServiceServer interface { 174 mustEmbedUnimplementedWorkerServiceServer() 175 } 176 177 func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServer) { 178 // If the following call panics, it indicates UnimplementedWorkerServiceServer was 179 // embedded by pointer and is nil. This will cause panics if an 180 // unimplemented method is ever invoked, so we test this at initialization 181 // time to prevent it from happening at runtime later due to I/O. 182 if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 183 t.testEmbeddedByValue() 184 } 185 s.RegisterService(&WorkerService_ServiceDesc, srv) 186 } 187 188 func _WorkerService_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error { 189 return srv.(WorkerServiceServer).RunServer(&grpc.GenericServerStream[ServerArgs, ServerStatus]{ServerStream: stream}) 190 } 191 192 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 193 type WorkerService_RunServerServer = grpc.BidiStreamingServer[ServerArgs, ServerStatus] 194 195 func _WorkerService_RunClient_Handler(srv interface{}, stream grpc.ServerStream) error { 196 return srv.(WorkerServiceServer).RunClient(&grpc.GenericServerStream[ClientArgs, ClientStatus]{ServerStream: stream}) 197 } 198 199 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 200 type WorkerService_RunClientServer = grpc.BidiStreamingServer[ClientArgs, ClientStatus] 201 202 func _WorkerService_CoreCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 203 in := new(CoreRequest) 204 if err := dec(in); err != nil { 205 return nil, err 206 } 207 if interceptor == nil { 208 return srv.(WorkerServiceServer).CoreCount(ctx, in) 209 } 210 info := &grpc.UnaryServerInfo{ 211 Server: srv, 212 FullMethod: WorkerService_CoreCount_FullMethodName, 213 } 214 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 215 return srv.(WorkerServiceServer).CoreCount(ctx, req.(*CoreRequest)) 216 } 217 return interceptor(ctx, in, info, handler) 218 } 219 220 func _WorkerService_QuitWorker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 221 in := new(Void) 222 if err := dec(in); err != nil { 223 return nil, err 224 } 225 if interceptor == nil { 226 return srv.(WorkerServiceServer).QuitWorker(ctx, in) 227 } 228 info := &grpc.UnaryServerInfo{ 229 Server: srv, 230 FullMethod: WorkerService_QuitWorker_FullMethodName, 231 } 232 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 233 return srv.(WorkerServiceServer).QuitWorker(ctx, req.(*Void)) 234 } 235 return interceptor(ctx, in, info, handler) 236 } 237 238 // WorkerService_ServiceDesc is the grpc.ServiceDesc for WorkerService service. 239 // It's only intended for direct use with grpc.RegisterService, 240 // and not to be introspected or modified (even as a copy) 241 var WorkerService_ServiceDesc = grpc.ServiceDesc{ 242 ServiceName: "grpc.testing.WorkerService", 243 HandlerType: (*WorkerServiceServer)(nil), 244 Methods: []grpc.MethodDesc{ 245 { 246 MethodName: "CoreCount", 247 Handler: _WorkerService_CoreCount_Handler, 248 }, 249 { 250 MethodName: "QuitWorker", 251 Handler: _WorkerService_QuitWorker_Handler, 252 }, 253 }, 254 Streams: []grpc.StreamDesc{ 255 { 256 StreamName: "RunServer", 257 Handler: _WorkerService_RunServer_Handler, 258 ServerStreams: true, 259 ClientStreams: true, 260 }, 261 { 262 StreamName: "RunClient", 263 Handler: _WorkerService_RunClient_Handler, 264 ServerStreams: true, 265 ClientStreams: true, 266 }, 267 }, 268 Metadata: "grpc/testing/worker_service.proto", 269 }