github.com/ava-labs/avalanchego@v1.11.11/proto/pb/http/http_grpc.pb.go (about)

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  // versions:
     3  // - protoc-gen-go-grpc v1.3.0
     4  // - protoc             (unknown)
     5  // source: http/http.proto
     6  
     7  package http
     8  
     9  import (
    10  	context "context"
    11  	grpc "google.golang.org/grpc"
    12  	codes "google.golang.org/grpc/codes"
    13  	status "google.golang.org/grpc/status"
    14  	emptypb "google.golang.org/protobuf/types/known/emptypb"
    15  )
    16  
    17  // This is a compile-time assertion to ensure that this generated file
    18  // is compatible with the grpc package it is being compiled against.
    19  // Requires gRPC-Go v1.32.0 or later.
    20  const _ = grpc.SupportPackageIsVersion7
    21  
    22  const (
    23  	HTTP_Handle_FullMethodName       = "/http.HTTP/Handle"
    24  	HTTP_HandleSimple_FullMethodName = "/http.HTTP/HandleSimple"
    25  )
    26  
    27  // HTTPClient is the client API for HTTP service.
    28  //
    29  // 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.
    30  type HTTPClient interface {
    31  	// Handle wraps http1 over http2 and provides support for websockets by implementing
    32  	// net conn and responsewriter in http2.
    33  	Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
    34  	// HandleSimple wraps http1 requests over http2 similar to Handle but only passes headers
    35  	// and body bytes. Because the request and response are single protos with no inline
    36  	// gRPC servers the CPU cost as well as file descriptor overhead is less
    37  	// (no additional goroutines).
    38  	HandleSimple(ctx context.Context, in *HandleSimpleHTTPRequest, opts ...grpc.CallOption) (*HandleSimpleHTTPResponse, error)
    39  }
    40  
    41  type hTTPClient struct {
    42  	cc grpc.ClientConnInterface
    43  }
    44  
    45  func NewHTTPClient(cc grpc.ClientConnInterface) HTTPClient {
    46  	return &hTTPClient{cc}
    47  }
    48  
    49  func (c *hTTPClient) Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
    50  	out := new(emptypb.Empty)
    51  	err := c.cc.Invoke(ctx, HTTP_Handle_FullMethodName, in, out, opts...)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	return out, nil
    56  }
    57  
    58  func (c *hTTPClient) HandleSimple(ctx context.Context, in *HandleSimpleHTTPRequest, opts ...grpc.CallOption) (*HandleSimpleHTTPResponse, error) {
    59  	out := new(HandleSimpleHTTPResponse)
    60  	err := c.cc.Invoke(ctx, HTTP_HandleSimple_FullMethodName, in, out, opts...)
    61  	if err != nil {
    62  		return nil, err
    63  	}
    64  	return out, nil
    65  }
    66  
    67  // HTTPServer is the server API for HTTP service.
    68  // All implementations must embed UnimplementedHTTPServer
    69  // for forward compatibility
    70  type HTTPServer interface {
    71  	// Handle wraps http1 over http2 and provides support for websockets by implementing
    72  	// net conn and responsewriter in http2.
    73  	Handle(context.Context, *HTTPRequest) (*emptypb.Empty, error)
    74  	// HandleSimple wraps http1 requests over http2 similar to Handle but only passes headers
    75  	// and body bytes. Because the request and response are single protos with no inline
    76  	// gRPC servers the CPU cost as well as file descriptor overhead is less
    77  	// (no additional goroutines).
    78  	HandleSimple(context.Context, *HandleSimpleHTTPRequest) (*HandleSimpleHTTPResponse, error)
    79  	mustEmbedUnimplementedHTTPServer()
    80  }
    81  
    82  // UnimplementedHTTPServer must be embedded to have forward compatible implementations.
    83  type UnimplementedHTTPServer struct {
    84  }
    85  
    86  func (UnimplementedHTTPServer) Handle(context.Context, *HTTPRequest) (*emptypb.Empty, error) {
    87  	return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented")
    88  }
    89  func (UnimplementedHTTPServer) HandleSimple(context.Context, *HandleSimpleHTTPRequest) (*HandleSimpleHTTPResponse, error) {
    90  	return nil, status.Errorf(codes.Unimplemented, "method HandleSimple not implemented")
    91  }
    92  func (UnimplementedHTTPServer) mustEmbedUnimplementedHTTPServer() {}
    93  
    94  // UnsafeHTTPServer may be embedded to opt out of forward compatibility for this service.
    95  // Use of this interface is not recommended, as added methods to HTTPServer will
    96  // result in compilation errors.
    97  type UnsafeHTTPServer interface {
    98  	mustEmbedUnimplementedHTTPServer()
    99  }
   100  
   101  func RegisterHTTPServer(s grpc.ServiceRegistrar, srv HTTPServer) {
   102  	s.RegisterService(&HTTP_ServiceDesc, srv)
   103  }
   104  
   105  func _HTTP_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   106  	in := new(HTTPRequest)
   107  	if err := dec(in); err != nil {
   108  		return nil, err
   109  	}
   110  	if interceptor == nil {
   111  		return srv.(HTTPServer).Handle(ctx, in)
   112  	}
   113  	info := &grpc.UnaryServerInfo{
   114  		Server:     srv,
   115  		FullMethod: HTTP_Handle_FullMethodName,
   116  	}
   117  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   118  		return srv.(HTTPServer).Handle(ctx, req.(*HTTPRequest))
   119  	}
   120  	return interceptor(ctx, in, info, handler)
   121  }
   122  
   123  func _HTTP_HandleSimple_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   124  	in := new(HandleSimpleHTTPRequest)
   125  	if err := dec(in); err != nil {
   126  		return nil, err
   127  	}
   128  	if interceptor == nil {
   129  		return srv.(HTTPServer).HandleSimple(ctx, in)
   130  	}
   131  	info := &grpc.UnaryServerInfo{
   132  		Server:     srv,
   133  		FullMethod: HTTP_HandleSimple_FullMethodName,
   134  	}
   135  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   136  		return srv.(HTTPServer).HandleSimple(ctx, req.(*HandleSimpleHTTPRequest))
   137  	}
   138  	return interceptor(ctx, in, info, handler)
   139  }
   140  
   141  // HTTP_ServiceDesc is the grpc.ServiceDesc for HTTP service.
   142  // It's only intended for direct use with grpc.RegisterService,
   143  // and not to be introspected or modified (even as a copy)
   144  var HTTP_ServiceDesc = grpc.ServiceDesc{
   145  	ServiceName: "http.HTTP",
   146  	HandlerType: (*HTTPServer)(nil),
   147  	Methods: []grpc.MethodDesc{
   148  		{
   149  			MethodName: "Handle",
   150  			Handler:    _HTTP_Handle_Handler,
   151  		},
   152  		{
   153  			MethodName: "HandleSimple",
   154  			Handler:    _HTTP_HandleSimple_Handler,
   155  		},
   156  	},
   157  	Streams:  []grpc.StreamDesc{},
   158  	Metadata: "http/http.proto",
   159  }