test_grpc.pb.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. // Copyright 2017 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. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  15. // versions:
  16. // - protoc-gen-go-grpc v1.3.0
  17. // - protoc v4.22.0
  18. // source: reflection/grpc_testing/test.proto
  19. package grpc_testing
  20. import (
  21. context "context"
  22. grpc "google.golang.org/grpc"
  23. codes "google.golang.org/grpc/codes"
  24. status "google.golang.org/grpc/status"
  25. )
  26. // This is a compile-time assertion to ensure that this generated file
  27. // is compatible with the grpc package it is being compiled against.
  28. // Requires gRPC-Go v1.32.0 or later.
  29. const _ = grpc.SupportPackageIsVersion7
  30. const (
  31. SearchService_Search_FullMethodName = "/grpc.testing.SearchService/Search"
  32. SearchService_StreamingSearch_FullMethodName = "/grpc.testing.SearchService/StreamingSearch"
  33. )
  34. // SearchServiceClient is the client API for SearchService service.
  35. //
  36. // 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.
  37. type SearchServiceClient interface {
  38. Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error)
  39. StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error)
  40. }
  41. type searchServiceClient struct {
  42. cc grpc.ClientConnInterface
  43. }
  44. func NewSearchServiceClient(cc grpc.ClientConnInterface) SearchServiceClient {
  45. return &searchServiceClient{cc}
  46. }
  47. func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) {
  48. out := new(SearchResponse)
  49. err := c.cc.Invoke(ctx, SearchService_Search_FullMethodName, in, out, opts...)
  50. if err != nil {
  51. return nil, err
  52. }
  53. return out, nil
  54. }
  55. func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) {
  56. stream, err := c.cc.NewStream(ctx, &SearchService_ServiceDesc.Streams[0], SearchService_StreamingSearch_FullMethodName, opts...)
  57. if err != nil {
  58. return nil, err
  59. }
  60. x := &searchServiceStreamingSearchClient{stream}
  61. return x, nil
  62. }
  63. type SearchService_StreamingSearchClient interface {
  64. Send(*SearchRequest) error
  65. Recv() (*SearchResponse, error)
  66. grpc.ClientStream
  67. }
  68. type searchServiceStreamingSearchClient struct {
  69. grpc.ClientStream
  70. }
  71. func (x *searchServiceStreamingSearchClient) Send(m *SearchRequest) error {
  72. return x.ClientStream.SendMsg(m)
  73. }
  74. func (x *searchServiceStreamingSearchClient) Recv() (*SearchResponse, error) {
  75. m := new(SearchResponse)
  76. if err := x.ClientStream.RecvMsg(m); err != nil {
  77. return nil, err
  78. }
  79. return m, nil
  80. }
  81. // SearchServiceServer is the server API for SearchService service.
  82. // All implementations must embed UnimplementedSearchServiceServer
  83. // for forward compatibility
  84. type SearchServiceServer interface {
  85. Search(context.Context, *SearchRequest) (*SearchResponse, error)
  86. StreamingSearch(SearchService_StreamingSearchServer) error
  87. mustEmbedUnimplementedSearchServiceServer()
  88. }
  89. // UnimplementedSearchServiceServer must be embedded to have forward compatible implementations.
  90. type UnimplementedSearchServiceServer struct {
  91. }
  92. func (UnimplementedSearchServiceServer) Search(context.Context, *SearchRequest) (*SearchResponse, error) {
  93. return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
  94. }
  95. func (UnimplementedSearchServiceServer) StreamingSearch(SearchService_StreamingSearchServer) error {
  96. return status.Errorf(codes.Unimplemented, "method StreamingSearch not implemented")
  97. }
  98. func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {}
  99. // UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service.
  100. // Use of this interface is not recommended, as added methods to SearchServiceServer will
  101. // result in compilation errors.
  102. type UnsafeSearchServiceServer interface {
  103. mustEmbedUnimplementedSearchServiceServer()
  104. }
  105. func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) {
  106. s.RegisterService(&SearchService_ServiceDesc, srv)
  107. }
  108. func _SearchService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  109. in := new(SearchRequest)
  110. if err := dec(in); err != nil {
  111. return nil, err
  112. }
  113. if interceptor == nil {
  114. return srv.(SearchServiceServer).Search(ctx, in)
  115. }
  116. info := &grpc.UnaryServerInfo{
  117. Server: srv,
  118. FullMethod: SearchService_Search_FullMethodName,
  119. }
  120. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  121. return srv.(SearchServiceServer).Search(ctx, req.(*SearchRequest))
  122. }
  123. return interceptor(ctx, in, info, handler)
  124. }
  125. func _SearchService_StreamingSearch_Handler(srv interface{}, stream grpc.ServerStream) error {
  126. return srv.(SearchServiceServer).StreamingSearch(&searchServiceStreamingSearchServer{stream})
  127. }
  128. type SearchService_StreamingSearchServer interface {
  129. Send(*SearchResponse) error
  130. Recv() (*SearchRequest, error)
  131. grpc.ServerStream
  132. }
  133. type searchServiceStreamingSearchServer struct {
  134. grpc.ServerStream
  135. }
  136. func (x *searchServiceStreamingSearchServer) Send(m *SearchResponse) error {
  137. return x.ServerStream.SendMsg(m)
  138. }
  139. func (x *searchServiceStreamingSearchServer) Recv() (*SearchRequest, error) {
  140. m := new(SearchRequest)
  141. if err := x.ServerStream.RecvMsg(m); err != nil {
  142. return nil, err
  143. }
  144. return m, nil
  145. }
  146. // SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service.
  147. // It's only intended for direct use with grpc.RegisterService,
  148. // and not to be introspected or modified (even as a copy)
  149. var SearchService_ServiceDesc = grpc.ServiceDesc{
  150. ServiceName: "grpc.testing.SearchService",
  151. HandlerType: (*SearchServiceServer)(nil),
  152. Methods: []grpc.MethodDesc{
  153. {
  154. MethodName: "Search",
  155. Handler: _SearchService_Search_Handler,
  156. },
  157. },
  158. Streams: []grpc.StreamDesc{
  159. {
  160. StreamName: "StreamingSearch",
  161. Handler: _SearchService_StreamingSearch_Handler,
  162. ServerStreams: true,
  163. ClientStreams: true,
  164. },
  165. },
  166. Metadata: "reflection/grpc_testing/test.proto",
  167. }