protos

package
v0.0.0-...-33cbb82 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

README

NOTICE

EN

  • using go type to generating protobuf files;run make go-to-protobuf after defined some new types
  • defined server rpc interface is this dir
  • define grpc & gateway request and response types in the types dir

ZH

  • 用go的定义替代protobuf proto定义,重新定义新的结构后,运行make go-to-protobuf生成
  • 当前目录定义server的一些rpc接口
  • types目录定义一些rpc和gateway的request和response的结构

Documentation

Overview

Package protos is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_pkg_protos_server_proto protoreflect.FileDescriptor
View Source
var Server_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "github.com.LTitan.Mebius.pkg.protos.Server",
	HandlerType: (*ServerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetMachine",
			Handler:    _Server_GetMachine_Handler,
		},
		{
			MethodName: "Heartbeat",
			Handler:    _Server_Heartbeat_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "pkg/protos/server.proto",
}

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

Functions

func RegisterServerHandler

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

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

func RegisterServerHandlerClient

func RegisterServerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServerClient) error

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

func RegisterServerHandlerFromEndpoint

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

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

func RegisterServerHandlerServer

func RegisterServerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServerServer) error

RegisterServerHandlerServer registers the http handlers for service Server to "mux". UnaryRPC :call ServerServer 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 RegisterServerHandlerFromEndpoint instead.

func RegisterServerServer

func RegisterServerServer(s grpc.ServiceRegistrar, srv ServerServer)

Types

type ServerClient

type ServerClient interface {
	GetMachine(ctx context.Context, in *types.ExampleRequest, opts ...grpc.CallOption) (*types.ExampleResponse, error)
	Heartbeat(ctx context.Context, in *types.HeartbeatRequest, opts ...grpc.CallOption) (*types.HeartbeatResponse, error)
}

ServerClient is the client API for Server 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.

func NewServerClient

func NewServerClient(cc grpc.ClientConnInterface) ServerClient

type ServerServer

type ServerServer interface {
	GetMachine(context.Context, *types.ExampleRequest) (*types.ExampleResponse, error)
	Heartbeat(context.Context, *types.HeartbeatRequest) (*types.HeartbeatResponse, error)
}

ServerServer is the server API for Server service. All implementations should embed UnimplementedServerServer for forward compatibility

type UnimplementedServerServer

type UnimplementedServerServer struct {
}

UnimplementedServerServer should be embedded to have forward compatible implementations.

func (UnimplementedServerServer) GetMachine

func (UnimplementedServerServer) Heartbeat

type UnsafeServerServer

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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