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