grpcserver

package
v0.0.0-...-1d9caf3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package grpcserver is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var FibonacciService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "main.FibonacciService",
	HandlerType: (*FibonacciServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "FibonacciSlice",
			Handler:       _FibonacciService_FibonacciSlice_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "fibonacci.proto",
}

FibonacciService_ServiceDesc is the grpc.ServiceDesc for FibonacciService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_fibonacci_proto protoreflect.FileDescriptor

Functions

func RegisterFibonacciServiceHandler

func RegisterFibonacciServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterFibonacciServiceHandler registers the http handlers for service FibonacciService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterFibonacciServiceHandlerClient

func RegisterFibonacciServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FibonacciServiceClient) error

RegisterFibonacciServiceHandlerClient registers the http handlers for service FibonacciService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FibonacciServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FibonacciServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "FibonacciServiceClient" to call the correct interceptors.

func RegisterFibonacciServiceHandlerFromEndpoint

func RegisterFibonacciServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterFibonacciServiceHandlerFromEndpoint is same as RegisterFibonacciServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterFibonacciServiceHandlerServer

func RegisterFibonacciServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FibonacciServiceServer) error

RegisterFibonacciServiceHandlerServer registers the http handlers for service FibonacciService to "mux". UnaryRPC :call FibonacciServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFibonacciServiceHandlerFromEndpoint instead.

func RegisterFibonacciServiceServer

func RegisterFibonacciServiceServer(s grpc.ServiceRegistrar, srv FibonacciServiceServer)

Types

type FibonacciRequest

type FibonacciRequest struct {
	Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
	End   int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"`
	// contains filtered or unexported fields
}

func (*FibonacciRequest) Descriptor deprecated

func (*FibonacciRequest) Descriptor() ([]byte, []int)

Deprecated: Use FibonacciRequest.ProtoReflect.Descriptor instead.

func (*FibonacciRequest) GetEnd

func (x *FibonacciRequest) GetEnd() int64

func (*FibonacciRequest) GetStart

func (x *FibonacciRequest) GetStart() int64

func (*FibonacciRequest) ProtoMessage

func (*FibonacciRequest) ProtoMessage()

func (*FibonacciRequest) ProtoReflect

func (x *FibonacciRequest) ProtoReflect() protoreflect.Message

func (*FibonacciRequest) Reset

func (x *FibonacciRequest) Reset()

func (*FibonacciRequest) String

func (x *FibonacciRequest) String() string

type FibonacciServiceClient

type FibonacciServiceClient interface {
	FibonacciSlice(ctx context.Context, in *FibonacciRequest, opts ...grpc.CallOption) (FibonacciService_FibonacciSliceClient, error)
}

FibonacciServiceClient is the client API for FibonacciService service.

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.

type FibonacciServiceServer

type FibonacciServiceServer interface {
	FibonacciSlice(*FibonacciRequest, FibonacciService_FibonacciSliceServer) error
	// contains filtered or unexported methods
}

FibonacciServiceServer is the server API for FibonacciService service. All implementations must embed UnimplementedFibonacciServiceServer for forward compatibility

type FibonacciService_FibonacciSliceClient

type FibonacciService_FibonacciSliceClient interface {
	Recv() (*Item, error)
	grpc.ClientStream
}

type FibonacciService_FibonacciSliceServer

type FibonacciService_FibonacciSliceServer interface {
	Send(*Item) error
	grpc.ServerStream
}

type Item

type Item struct {
	Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Item) Descriptor deprecated

func (*Item) Descriptor() ([]byte, []int)

Deprecated: Use Item.ProtoReflect.Descriptor instead.

func (*Item) GetValue

func (x *Item) GetValue() int64

func (*Item) ProtoMessage

func (*Item) ProtoMessage()

func (*Item) ProtoReflect

func (x *Item) ProtoReflect() protoreflect.Message

func (*Item) Reset

func (x *Item) Reset()

func (*Item) String

func (x *Item) String() string

type UnimplementedFibonacciServiceServer

type UnimplementedFibonacciServiceServer struct {
}

UnimplementedFibonacciServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedFibonacciServiceServer) FibonacciSlice

type UnsafeFibonacciServiceServer

type UnsafeFibonacciServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeFibonacciServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to FibonacciServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL