rulexrpc

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

README

文档

支持 GRPC 用户自定义协议接入。

协议定义

syntax = "proto3";

option go_package = "./;xstream";
option java_multiple_files = false;
option java_package = "xstream";
option java_outer_classname = "RulexXStream";

package xstream;

service XStream {
  rpc OnStreamApproached (stream Data) returns (Response) {}
}

message Data {
  string value = 1;
}

message Response {
  int32 code = 1;
  string message = 2;
}

Documentation

Index

Constants

View Source
const (
	Codec_Decode_FullMethodName = "/rulexrpc.Codec/Decode"
	Codec_Encode_FullMethodName = "/rulexrpc.Codec/Encode"
)
View Source
const (
	RulexRpc_Work_FullMethodName = "/rulexrpc.RulexRpc/Work"
)

Variables

View Source
var Codec_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rulexrpc.Codec",
	HandlerType: (*CodecServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Decode",
			Handler:    _Codec_Decode_Handler,
		},
		{
			MethodName: "Encode",
			Handler:    _Codec_Encode_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "xcodec.proto",
}

Codec_ServiceDesc is the grpc.ServiceDesc for Codec 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_grpc_source_proto protoreflect.FileDescriptor
View Source
var File_xcodec_proto protoreflect.FileDescriptor
View Source
var RulexRpc_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rulexrpc.RulexRpc",
	HandlerType: (*RulexRpcServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Work",
			Handler:    _RulexRpc_Work_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc_source.proto",
}

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

Functions

func RegisterCodecServer

func RegisterCodecServer(s grpc.ServiceRegistrar, srv CodecServer)

func RegisterRulexRpcServer

func RegisterRulexRpcServer(s grpc.ServiceRegistrar, srv RulexRpcServer)

Types

type CodecClient

type CodecClient interface {
	// 编码
	Decode(ctx context.Context, in *CodecRequest, opts ...grpc.CallOption) (*CodecResponse, error)
	// 解码
	Encode(ctx context.Context, in *CodecRequest, opts ...grpc.CallOption) (*CodecResponse, error)
}

CodecClient is the client API for Codec 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 NewCodecClient

func NewCodecClient(cc grpc.ClientConnInterface) CodecClient

type CodecRequest

type CodecRequest struct {
	Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*CodecRequest) Descriptor deprecated

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

Deprecated: Use CodecRequest.ProtoReflect.Descriptor instead.

func (*CodecRequest) GetValue

func (x *CodecRequest) GetValue() []byte

func (*CodecRequest) ProtoMessage

func (*CodecRequest) ProtoMessage()

func (*CodecRequest) ProtoReflect

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

func (*CodecRequest) Reset

func (x *CodecRequest) Reset()

func (*CodecRequest) String

func (x *CodecRequest) String() string

type CodecResponse

type CodecResponse struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Data    []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*CodecResponse) Descriptor deprecated

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

Deprecated: Use CodecResponse.ProtoReflect.Descriptor instead.

func (*CodecResponse) GetCode

func (x *CodecResponse) GetCode() int32

func (*CodecResponse) GetData

func (x *CodecResponse) GetData() []byte

func (*CodecResponse) GetMessage

func (x *CodecResponse) GetMessage() string

func (*CodecResponse) ProtoMessage

func (*CodecResponse) ProtoMessage()

func (*CodecResponse) ProtoReflect

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

func (*CodecResponse) Reset

func (x *CodecResponse) Reset()

func (*CodecResponse) String

func (x *CodecResponse) String() string

type CodecServer

type CodecServer interface {
	// 编码
	Decode(context.Context, *CodecRequest) (*CodecResponse, error)
	// 解码
	Encode(context.Context, *CodecRequest) (*CodecResponse, error)
	// contains filtered or unexported methods
}

CodecServer is the server API for Codec service. All implementations must embed UnimplementedCodecServer for forward compatibility

type Data

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

func (*Data) Descriptor deprecated

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

Deprecated: Use Data.ProtoReflect.Descriptor instead.

func (*Data) GetValue

func (x *Data) GetValue() string

func (*Data) ProtoMessage

func (*Data) ProtoMessage()

func (*Data) ProtoReflect

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

func (*Data) Reset

func (x *Data) Reset()

func (*Data) String

func (x *Data) String() string

type Response

type Response struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() int32

func (*Response) GetMessage

func (x *Response) GetMessage() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type RulexRpcClient

type RulexRpcClient interface {
	Work(ctx context.Context, in *Data, opts ...grpc.CallOption) (*Response, error)
}

RulexRpcClient is the client API for RulexRpc 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 NewRulexRpcClient

func NewRulexRpcClient(cc grpc.ClientConnInterface) RulexRpcClient

type RulexRpcServer

type RulexRpcServer interface {
	Work(context.Context, *Data) (*Response, error)
	// contains filtered or unexported methods
}

RulexRpcServer is the server API for RulexRpc service. All implementations must embed UnimplementedRulexRpcServer for forward compatibility

type UnimplementedCodecServer

type UnimplementedCodecServer struct {
}

UnimplementedCodecServer must be embedded to have forward compatible implementations.

func (UnimplementedCodecServer) Decode

func (UnimplementedCodecServer) Encode

type UnimplementedRulexRpcServer

type UnimplementedRulexRpcServer struct {
}

UnimplementedRulexRpcServer must be embedded to have forward compatible implementations.

func (UnimplementedRulexRpcServer) Work

type UnsafeCodecServer

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

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

type UnsafeRulexRpcServer

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

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

Jump to

Keyboard shortcuts

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