github.com/google/martian/v3@v3.3.3/h2/testservice/test_service_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 3 package testservice 4 5 import ( 6 context "context" 7 grpc "google.golang.org/grpc" 8 codes "google.golang.org/grpc/codes" 9 status "google.golang.org/grpc/status" 10 ) 11 12 // This is a compile-time assertion to ensure that this generated file 13 // is compatible with the grpc package it is being compiled against. 14 // Requires gRPC-Go v1.32.0 or later. 15 const _ = grpc.SupportPackageIsVersion7 16 17 // TestServiceClient is the client API for TestService service. 18 // 19 // 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. 20 type TestServiceClient interface { 21 // The server returns the client message as-is. 22 Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) 23 // The server returns the sum of the input values. 24 Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOption) (*SumResponse, error) 25 // The server returns every message twice. 26 DoubleEcho(ctx context.Context, opts ...grpc.CallOption) (TestService_DoubleEchoClient, error) 27 } 28 29 type testServiceClient struct { 30 cc grpc.ClientConnInterface 31 } 32 33 func NewTestServiceClient(cc grpc.ClientConnInterface) TestServiceClient { 34 return &testServiceClient{cc} 35 } 36 37 func (c *testServiceClient) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) { 38 out := new(EchoResponse) 39 err := c.cc.Invoke(ctx, "/test_service.TestService/Echo", in, out, opts...) 40 if err != nil { 41 return nil, err 42 } 43 return out, nil 44 } 45 46 func (c *testServiceClient) Sum(ctx context.Context, in *SumRequest, opts ...grpc.CallOption) (*SumResponse, error) { 47 out := new(SumResponse) 48 err := c.cc.Invoke(ctx, "/test_service.TestService/Sum", in, out, opts...) 49 if err != nil { 50 return nil, err 51 } 52 return out, nil 53 } 54 55 func (c *testServiceClient) DoubleEcho(ctx context.Context, opts ...grpc.CallOption) (TestService_DoubleEchoClient, error) { 56 stream, err := c.cc.NewStream(ctx, &TestService_ServiceDesc.Streams[0], "/test_service.TestService/DoubleEcho", opts...) 57 if err != nil { 58 return nil, err 59 } 60 x := &testServiceDoubleEchoClient{stream} 61 return x, nil 62 } 63 64 type TestService_DoubleEchoClient interface { 65 Send(*EchoRequest) error 66 Recv() (*EchoResponse, error) 67 grpc.ClientStream 68 } 69 70 type testServiceDoubleEchoClient struct { 71 grpc.ClientStream 72 } 73 74 func (x *testServiceDoubleEchoClient) Send(m *EchoRequest) error { 75 return x.ClientStream.SendMsg(m) 76 } 77 78 func (x *testServiceDoubleEchoClient) Recv() (*EchoResponse, error) { 79 m := new(EchoResponse) 80 if err := x.ClientStream.RecvMsg(m); err != nil { 81 return nil, err 82 } 83 return m, nil 84 } 85 86 // TestServiceServer is the server API for TestService service. 87 // All implementations must embed UnimplementedTestServiceServer 88 // for forward compatibility 89 type TestServiceServer interface { 90 // The server returns the client message as-is. 91 Echo(context.Context, *EchoRequest) (*EchoResponse, error) 92 // The server returns the sum of the input values. 93 Sum(context.Context, *SumRequest) (*SumResponse, error) 94 // The server returns every message twice. 95 DoubleEcho(TestService_DoubleEchoServer) error 96 mustEmbedUnimplementedTestServiceServer() 97 } 98 99 // UnimplementedTestServiceServer must be embedded to have forward compatible implementations. 100 type UnimplementedTestServiceServer struct { 101 } 102 103 func (UnimplementedTestServiceServer) Echo(context.Context, *EchoRequest) (*EchoResponse, error) { 104 return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") 105 } 106 func (UnimplementedTestServiceServer) Sum(context.Context, *SumRequest) (*SumResponse, error) { 107 return nil, status.Errorf(codes.Unimplemented, "method Sum not implemented") 108 } 109 func (UnimplementedTestServiceServer) DoubleEcho(TestService_DoubleEchoServer) error { 110 return status.Errorf(codes.Unimplemented, "method DoubleEcho not implemented") 111 } 112 func (UnimplementedTestServiceServer) mustEmbedUnimplementedTestServiceServer() {} 113 114 // UnsafeTestServiceServer may be embedded to opt out of forward compatibility for this service. 115 // Use of this interface is not recommended, as added methods to TestServiceServer will 116 // result in compilation errors. 117 type UnsafeTestServiceServer interface { 118 mustEmbedUnimplementedTestServiceServer() 119 } 120 121 func RegisterTestServiceServer(s grpc.ServiceRegistrar, srv TestServiceServer) { 122 s.RegisterService(&TestService_ServiceDesc, srv) 123 } 124 125 func _TestService_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 126 in := new(EchoRequest) 127 if err := dec(in); err != nil { 128 return nil, err 129 } 130 if interceptor == nil { 131 return srv.(TestServiceServer).Echo(ctx, in) 132 } 133 info := &grpc.UnaryServerInfo{ 134 Server: srv, 135 FullMethod: "/test_service.TestService/Echo", 136 } 137 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 138 return srv.(TestServiceServer).Echo(ctx, req.(*EchoRequest)) 139 } 140 return interceptor(ctx, in, info, handler) 141 } 142 143 func _TestService_Sum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 144 in := new(SumRequest) 145 if err := dec(in); err != nil { 146 return nil, err 147 } 148 if interceptor == nil { 149 return srv.(TestServiceServer).Sum(ctx, in) 150 } 151 info := &grpc.UnaryServerInfo{ 152 Server: srv, 153 FullMethod: "/test_service.TestService/Sum", 154 } 155 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 156 return srv.(TestServiceServer).Sum(ctx, req.(*SumRequest)) 157 } 158 return interceptor(ctx, in, info, handler) 159 } 160 161 func _TestService_DoubleEcho_Handler(srv interface{}, stream grpc.ServerStream) error { 162 return srv.(TestServiceServer).DoubleEcho(&testServiceDoubleEchoServer{stream}) 163 } 164 165 type TestService_DoubleEchoServer interface { 166 Send(*EchoResponse) error 167 Recv() (*EchoRequest, error) 168 grpc.ServerStream 169 } 170 171 type testServiceDoubleEchoServer struct { 172 grpc.ServerStream 173 } 174 175 func (x *testServiceDoubleEchoServer) Send(m *EchoResponse) error { 176 return x.ServerStream.SendMsg(m) 177 } 178 179 func (x *testServiceDoubleEchoServer) Recv() (*EchoRequest, error) { 180 m := new(EchoRequest) 181 if err := x.ServerStream.RecvMsg(m); err != nil { 182 return nil, err 183 } 184 return m, nil 185 } 186 187 // TestService_ServiceDesc is the grpc.ServiceDesc for TestService service. 188 // It's only intended for direct use with grpc.RegisterService, 189 // and not to be introspected or modified (even as a copy) 190 var TestService_ServiceDesc = grpc.ServiceDesc{ 191 ServiceName: "test_service.TestService", 192 HandlerType: (*TestServiceServer)(nil), 193 Methods: []grpc.MethodDesc{ 194 { 195 MethodName: "Echo", 196 Handler: _TestService_Echo_Handler, 197 }, 198 { 199 MethodName: "Sum", 200 Handler: _TestService_Sum_Handler, 201 }, 202 }, 203 Streams: []grpc.StreamDesc{ 204 { 205 StreamName: "DoubleEcho", 206 Handler: _TestService_DoubleEcho_Handler, 207 ServerStreams: true, 208 ClientStreams: true, 209 }, 210 }, 211 Metadata: "test_service.proto", 212 }