...

Source file src/google.golang.org/grpc/reflection/grpc_testing/test_grpc.pb.go

Documentation: google.golang.org/grpc/reflection/grpc_testing

     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.3.0
    18  // - protoc             v4.25.2
    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 forward compatible implementations.
    89  type UnimplementedSearchServiceServer struct {
    90  }
    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(grpc.BidiStreamingServer[SearchRequest, SearchResponse]) error {
    96  	return status.Errorf(codes.Unimplemented, "method StreamingSearch not implemented")
    97  }
    98  func (UnimplementedSearchServiceServer) mustEmbedUnimplementedSearchServiceServer() {}
    99  
   100  // UnsafeSearchServiceServer may be embedded to opt out of forward compatibility for this service.
   101  // Use of this interface is not recommended, as added methods to SearchServiceServer will
   102  // result in compilation errors.
   103  type UnsafeSearchServiceServer interface {
   104  	mustEmbedUnimplementedSearchServiceServer()
   105  }
   106  
   107  func RegisterSearchServiceServer(s grpc.ServiceRegistrar, srv SearchServiceServer) {
   108  	s.RegisterService(&SearchService_ServiceDesc, srv)
   109  }
   110  
   111  func _SearchService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   112  	in := new(SearchRequest)
   113  	if err := dec(in); err != nil {
   114  		return nil, err
   115  	}
   116  	if interceptor == nil {
   117  		return srv.(SearchServiceServer).Search(ctx, in)
   118  	}
   119  	info := &grpc.UnaryServerInfo{
   120  		Server:     srv,
   121  		FullMethod: SearchService_Search_FullMethodName,
   122  	}
   123  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   124  		return srv.(SearchServiceServer).Search(ctx, req.(*SearchRequest))
   125  	}
   126  	return interceptor(ctx, in, info, handler)
   127  }
   128  
   129  func _SearchService_StreamingSearch_Handler(srv interface{}, stream grpc.ServerStream) error {
   130  	return srv.(SearchServiceServer).StreamingSearch(&grpc.GenericServerStream[SearchRequest, SearchResponse]{ServerStream: stream})
   131  }
   132  
   133  // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
   134  type SearchService_StreamingSearchServer = grpc.BidiStreamingServer[SearchRequest, SearchResponse]
   135  
   136  // SearchService_ServiceDesc is the grpc.ServiceDesc for SearchService service.
   137  // It's only intended for direct use with grpc.RegisterService,
   138  // and not to be introspected or modified (even as a copy)
   139  var SearchService_ServiceDesc = grpc.ServiceDesc{
   140  	ServiceName: "grpc.testing.SearchService",
   141  	HandlerType: (*SearchServiceServer)(nil),
   142  	Methods: []grpc.MethodDesc{
   143  		{
   144  			MethodName: "Search",
   145  			Handler:    _SearchService_Search_Handler,
   146  		},
   147  	},
   148  	Streams: []grpc.StreamDesc{
   149  		{
   150  			StreamName:    "StreamingSearch",
   151  			Handler:       _SearchService_StreamingSearch_Handler,
   152  			ServerStreams: true,
   153  			ClientStreams: true,
   154  		},
   155  	},
   156  	Metadata: "reflection/grpc_testing/test.proto",
   157  }
   158  

View as plain text