Documentation
¶
Index ¶
- Constants
- Variables
- func GetReplyType(serviceCode int32, code int32) (reflect.Type, bool)
- func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer)
- func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
- func RegisterReplyType(serviceCode int32, code int32, message proto.Message)
- func ResetReply(resp *Reply)
- func ResetRequest(req *Request)
- func UnpackReply(reply *Reply) (msg proto.Message, ok bool, err error)
- type ChangeStateRequest
- func (*ChangeStateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ChangeStateRequest) GetState() string
- func (*ChangeStateRequest) ProtoMessage()
- func (x *ChangeStateRequest) ProtoReflect() protoreflect.Message
- func (x *ChangeStateRequest) Reset()
- func (x *ChangeStateRequest) String() string
- type CloseSessionRequest
- func (*CloseSessionRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CloseSessionRequest) GetSessionId() string
- func (*CloseSessionRequest) ProtoMessage()
- func (x *CloseSessionRequest) ProtoReflect() protoreflect.Message
- func (x *CloseSessionRequest) Reset()
- func (x *CloseSessionRequest) String() string
- type CloseSessionResponse
- func (*CloseSessionResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CloseSessionResponse) GetSuccess() bool
- func (*CloseSessionResponse) ProtoMessage()
- func (x *CloseSessionResponse) ProtoReflect() protoreflect.Message
- func (x *CloseSessionResponse) Reset()
- func (x *CloseSessionResponse) String() string
- type GatewayClient
- type GatewayServer
- type IsSessionExistRequest
- func (*IsSessionExistRequest) Descriptor() ([]byte, []int)deprecated
- func (x *IsSessionExistRequest) GetSessionId() string
- func (*IsSessionExistRequest) ProtoMessage()
- func (x *IsSessionExistRequest) ProtoReflect() protoreflect.Message
- func (x *IsSessionExistRequest) Reset()
- func (x *IsSessionExistRequest) String() string
- type IsSessionExistResponse
- func (*IsSessionExistResponse) Descriptor() ([]byte, []int)deprecated
- func (x *IsSessionExistResponse) GetExist() bool
- func (*IsSessionExistResponse) ProtoMessage()
- func (x *IsSessionExistResponse) ProtoReflect() protoreflect.Message
- func (x *IsSessionExistResponse) Reset()
- func (x *IsSessionExistResponse) String() string
- type Multicast
- func (*Multicast) Descriptor() ([]byte, []int)deprecated
- func (x *Multicast) GetContent() *Reply
- func (x *Multicast) GetReceiver() []string
- func (x *Multicast) GetStream() string
- func (x *Multicast) GetTime() *timestamppb.Timestamp
- func (x *Multicast) GetToEveryone() bool
- func (*Multicast) ProtoMessage()
- func (x *Multicast) ProtoReflect() protoreflect.Message
- func (x *Multicast) Reset()
- func (x *Multicast) String() string
- type NodeClient
- type NodeServer
- type RPCError
- func (*RPCError) Descriptor() ([]byte, []int)deprecated
- func (x *RPCError) GetRequestMethod() string
- func (x *RPCError) GetRequestService() int32
- func (x *RPCError) GetStatus() *status.Status
- func (*RPCError) ProtoMessage()
- func (x *RPCError) ProtoReflect() protoreflect.Message
- func (x *RPCError) Reset()
- func (x *RPCError) String() string
- type RemoveServiceRouteRequest
- func (*RemoveServiceRouteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RemoveServiceRouteRequest) GetServiceCode() int32
- func (x *RemoveServiceRouteRequest) GetSessionId() string
- func (*RemoveServiceRouteRequest) ProtoMessage()
- func (x *RemoveServiceRouteRequest) ProtoReflect() protoreflect.Message
- func (x *RemoveServiceRouteRequest) Reset()
- func (x *RemoveServiceRouteRequest) String() string
- type ReplaceServiceRouteRequest
- func (*ReplaceServiceRouteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ReplaceServiceRouteRequest) GetNewNodeId() string
- func (x *ReplaceServiceRouteRequest) GetOldNodeId() string
- func (*ReplaceServiceRouteRequest) ProtoMessage()
- func (x *ReplaceServiceRouteRequest) ProtoReflect() protoreflect.Message
- func (x *ReplaceServiceRouteRequest) Reset()
- func (x *ReplaceServiceRouteRequest) String() string
- type Reply
- func (*Reply) Descriptor() ([]byte, []int)deprecated
- func (x *Reply) GetCode() int32
- func (x *Reply) GetData() []byte
- func (x *Reply) GetRequestId() uint32
- func (x *Reply) GetServiceCode() int32
- func (x *Reply) LogValue() slog.Value
- func (*Reply) ProtoMessage()
- func (x *Reply) ProtoReflect() protoreflect.Message
- func (x *Reply) Reset()
- func (x *Reply) String() string
- type ReplyCode
- type Request
- func (*Request) Descriptor() ([]byte, []int)deprecated
- func (x *Request) GetData() []byte
- func (x *Request) GetId() uint32
- func (x *Request) GetMethod() string
- func (x *Request) GetNoReply() bool
- func (x *Request) GetNodeId() string
- func (x *Request) GetServiceCode() int32
- func (x *Request) GetStream() string
- func (x *Request) LogValue() slog.Value
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- type SendReplyRequest
- func (*SendReplyRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SendReplyRequest) GetReply() *Reply
- func (x *SendReplyRequest) GetSessionId() string
- func (*SendReplyRequest) ProtoMessage()
- func (x *SendReplyRequest) ProtoReflect() protoreflect.Message
- func (x *SendReplyRequest) Reset()
- func (x *SendReplyRequest) String() string
- type SendReplyResponse
- type SessionCountResponse
- func (*SessionCountResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SessionCountResponse) GetCount() int32
- func (*SessionCountResponse) ProtoMessage()
- func (x *SessionCountResponse) ProtoReflect() protoreflect.Message
- func (x *SessionCountResponse) Reset()
- func (x *SessionCountResponse) String() string
- type SetServiceRouteRequest
- func (*SetServiceRouteRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SetServiceRouteRequest) GetNodeId() string
- func (x *SetServiceRouteRequest) GetServiceCode() int32
- func (x *SetServiceRouteRequest) GetSessionId() string
- func (*SetServiceRouteRequest) ProtoMessage()
- func (x *SetServiceRouteRequest) ProtoReflect() protoreflect.Message
- func (x *SetServiceRouteRequest) Reset()
- func (x *SetServiceRouteRequest) String() string
- type UnimplementedGatewayServer
- func (UnimplementedGatewayServer) CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error)
- func (UnimplementedGatewayServer) IsSessionExist(context.Context, *IsSessionExistRequest) (*IsSessionExistResponse, error)
- func (UnimplementedGatewayServer) RemoveServiceRoute(context.Context, *RemoveServiceRouteRequest) (*emptypb.Empty, error)
- func (UnimplementedGatewayServer) ReplaceServiceRoute(context.Context, *ReplaceServiceRouteRequest) (*emptypb.Empty, error)
- func (UnimplementedGatewayServer) SendReply(context.Context, *SendReplyRequest) (*SendReplyResponse, error)
- func (UnimplementedGatewayServer) SessionCount(context.Context, *emptypb.Empty) (*SessionCountResponse, error)
- func (UnimplementedGatewayServer) SetServiceRoute(context.Context, *SetServiceRouteRequest) (*emptypb.Empty, error)
- type UnimplementedNodeServer
- type UnsafeGatewayServer
- type UnsafeNodeServer
Constants ¶
const ( // NodeServiceCode 节点管理服务,每个内部节点都会内置这个grpc服务 NodeServiceCode int32 = -1 // GatewayServiceCode 网关服务代码,每个网关节点都会内置这个grpc服务 GatewayServiceCode int32 = -2 )
const ( Gateway_IsSessionExist_FullMethodName = "/nodehub.Gateway/IsSessionExist" Gateway_SessionCount_FullMethodName = "/nodehub.Gateway/SessionCount" Gateway_CloseSession_FullMethodName = "/nodehub.Gateway/CloseSession" Gateway_SetServiceRoute_FullMethodName = "/nodehub.Gateway/SetServiceRoute" Gateway_RemoveServiceRoute_FullMethodName = "/nodehub.Gateway/RemoveServiceRoute" Gateway_ReplaceServiceRoute_FullMethodName = "/nodehub.Gateway/ReplaceServiceRoute" Gateway_SendReply_FullMethodName = "/nodehub.Gateway/SendReply" )
const ( Node_ChangeState_FullMethodName = "/nodehub.Node/ChangeState" Node_Shutdown_FullMethodName = "/nodehub.Node/Shutdown" )
Variables ¶
var ( ReplyCode_name = map[int32]string{ 0: "UNSPECIFIED", 1: "RPC_ERROR", } ReplyCode_value = map[string]int32{ "UNSPECIFIED": 0, "RPC_ERROR": 1, } )
Enum value maps for ReplyCode.
var ( // EmptyReply 空响应 EmptyReply = &emptypb.Empty{} )
var File_nodehub_client_proto protoreflect.FileDescriptor
var File_nodehub_gateway_proto protoreflect.FileDescriptor
var File_nodehub_services_proto protoreflect.FileDescriptor
var Gateway_ServiceDesc = grpc.ServiceDesc{ ServiceName: "nodehub.Gateway", HandlerType: (*GatewayServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "IsSessionExist", Handler: _Gateway_IsSessionExist_Handler, }, { MethodName: "SessionCount", Handler: _Gateway_SessionCount_Handler, }, { MethodName: "CloseSession", Handler: _Gateway_CloseSession_Handler, }, { MethodName: "SetServiceRoute", Handler: _Gateway_SetServiceRoute_Handler, }, { MethodName: "RemoveServiceRoute", Handler: _Gateway_RemoveServiceRoute_Handler, }, { MethodName: "ReplaceServiceRoute", Handler: _Gateway_ReplaceServiceRoute_Handler, }, { MethodName: "SendReply", Handler: _Gateway_SendReply_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "nodehub/services.proto", }
Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var Node_ServiceDesc = grpc.ServiceDesc{ ServiceName: "nodehub.Node", HandlerType: (*NodeServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ChangeState", Handler: _Node_ChangeState_Handler, }, { MethodName: "Shutdown", Handler: _Node_Shutdown_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "nodehub/services.proto", }
Node_ServiceDesc is the grpc.ServiceDesc for Node service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func GetReplyType ¶
GetReplyType 根据编码获取对应的响应数据类型
func RegisterGatewayServer ¶
func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer)
func RegisterNodeServer ¶
func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
func RegisterReplyType ¶
RegisterReplyType 注册响应数据编码及类型
Types ¶
type ChangeStateRequest ¶
type ChangeStateRequest struct { State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` // contains filtered or unexported fields }
func (*ChangeStateRequest) Descriptor
deprecated
func (*ChangeStateRequest) Descriptor() ([]byte, []int)
Deprecated: Use ChangeStateRequest.ProtoReflect.Descriptor instead.
func (*ChangeStateRequest) GetState ¶
func (x *ChangeStateRequest) GetState() string
func (*ChangeStateRequest) ProtoMessage ¶
func (*ChangeStateRequest) ProtoMessage()
func (*ChangeStateRequest) ProtoReflect ¶
func (x *ChangeStateRequest) ProtoReflect() protoreflect.Message
func (*ChangeStateRequest) Reset ¶
func (x *ChangeStateRequest) Reset()
func (*ChangeStateRequest) String ¶
func (x *ChangeStateRequest) String() string
type CloseSessionRequest ¶
type CloseSessionRequest struct { SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // contains filtered or unexported fields }
func (*CloseSessionRequest) Descriptor
deprecated
func (*CloseSessionRequest) Descriptor() ([]byte, []int)
Deprecated: Use CloseSessionRequest.ProtoReflect.Descriptor instead.
func (*CloseSessionRequest) GetSessionId ¶
func (x *CloseSessionRequest) GetSessionId() string
func (*CloseSessionRequest) ProtoMessage ¶
func (*CloseSessionRequest) ProtoMessage()
func (*CloseSessionRequest) ProtoReflect ¶
func (x *CloseSessionRequest) ProtoReflect() protoreflect.Message
func (*CloseSessionRequest) Reset ¶
func (x *CloseSessionRequest) Reset()
func (*CloseSessionRequest) String ¶
func (x *CloseSessionRequest) String() string
type CloseSessionResponse ¶
type CloseSessionResponse struct { // success 为 false 时,表示会话不存在 Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*CloseSessionResponse) Descriptor
deprecated
func (*CloseSessionResponse) Descriptor() ([]byte, []int)
Deprecated: Use CloseSessionResponse.ProtoReflect.Descriptor instead.
func (*CloseSessionResponse) GetSuccess ¶
func (x *CloseSessionResponse) GetSuccess() bool
func (*CloseSessionResponse) ProtoMessage ¶
func (*CloseSessionResponse) ProtoMessage()
func (*CloseSessionResponse) ProtoReflect ¶
func (x *CloseSessionResponse) ProtoReflect() protoreflect.Message
func (*CloseSessionResponse) Reset ¶
func (x *CloseSessionResponse) Reset()
func (*CloseSessionResponse) String ¶
func (x *CloseSessionResponse) String() string
type GatewayClient ¶
type GatewayClient interface { // 会话是否存在 IsSessionExist(ctx context.Context, in *IsSessionExistRequest, opts ...grpc.CallOption) (*IsSessionExistResponse, error) // 会话数量 SessionCount(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SessionCountResponse, error) // 关闭会话连接,踢下线 CloseSession(ctx context.Context, in *CloseSessionRequest, opts ...grpc.CallOption) (*CloseSessionResponse, error) // 修改状态服务路由 SetServiceRoute(ctx context.Context, in *SetServiceRouteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // 删除状态服务路由 RemoveServiceRoute(ctx context.Context, in *RemoveServiceRouteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // 替换状态服务路由节点 ReplaceServiceRoute(ctx context.Context, in *ReplaceServiceRouteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // 向指定会话推送消息 SendReply(ctx context.Context, in *SendReplyRequest, opts ...grpc.CallOption) (*SendReplyResponse, error) }
GatewayClient is the client API for Gateway 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 NewGatewayClient ¶
func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient
type GatewayServer ¶
type GatewayServer interface { // 会话是否存在 IsSessionExist(context.Context, *IsSessionExistRequest) (*IsSessionExistResponse, error) // 会话数量 SessionCount(context.Context, *emptypb.Empty) (*SessionCountResponse, error) // 关闭会话连接,踢下线 CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error) // 修改状态服务路由 SetServiceRoute(context.Context, *SetServiceRouteRequest) (*emptypb.Empty, error) // 删除状态服务路由 RemoveServiceRoute(context.Context, *RemoveServiceRouteRequest) (*emptypb.Empty, error) // 替换状态服务路由节点 ReplaceServiceRoute(context.Context, *ReplaceServiceRouteRequest) (*emptypb.Empty, error) // 向指定会话推送消息 SendReply(context.Context, *SendReplyRequest) (*SendReplyResponse, error) // contains filtered or unexported methods }
GatewayServer is the server API for Gateway service. All implementations must embed UnimplementedGatewayServer for forward compatibility.
网关功能接口,供内部服务调用 每个网关节点都会自动内置此服务
type IsSessionExistRequest ¶
type IsSessionExistRequest struct { SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // contains filtered or unexported fields }
func (*IsSessionExistRequest) Descriptor
deprecated
func (*IsSessionExistRequest) Descriptor() ([]byte, []int)
Deprecated: Use IsSessionExistRequest.ProtoReflect.Descriptor instead.
func (*IsSessionExistRequest) GetSessionId ¶
func (x *IsSessionExistRequest) GetSessionId() string
func (*IsSessionExistRequest) ProtoMessage ¶
func (*IsSessionExistRequest) ProtoMessage()
func (*IsSessionExistRequest) ProtoReflect ¶
func (x *IsSessionExistRequest) ProtoReflect() protoreflect.Message
func (*IsSessionExistRequest) Reset ¶
func (x *IsSessionExistRequest) Reset()
func (*IsSessionExistRequest) String ¶
func (x *IsSessionExistRequest) String() string
type IsSessionExistResponse ¶
type IsSessionExistResponse struct { Exist bool `protobuf:"varint,1,opt,name=exist,proto3" json:"exist,omitempty"` // contains filtered or unexported fields }
func (*IsSessionExistResponse) Descriptor
deprecated
func (*IsSessionExistResponse) Descriptor() ([]byte, []int)
Deprecated: Use IsSessionExistResponse.ProtoReflect.Descriptor instead.
func (*IsSessionExistResponse) GetExist ¶
func (x *IsSessionExistResponse) GetExist() bool
func (*IsSessionExistResponse) ProtoMessage ¶
func (*IsSessionExistResponse) ProtoMessage()
func (*IsSessionExistResponse) ProtoReflect ¶
func (x *IsSessionExistResponse) ProtoReflect() protoreflect.Message
func (*IsSessionExistResponse) Reset ¶
func (x *IsSessionExistResponse) Reset()
func (*IsSessionExistResponse) String ¶
func (x *IsSessionExistResponse) String() string
type Multicast ¶
type Multicast struct { // 消息接收者,网关节点根据user_id找到对应的客户端连接 Receiver []string `protobuf:"bytes,1,rep,name=receiver,proto3" json:"receiver,omitempty"` // 消息发布时间 Time *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"` // 消息内容 Content *Reply `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // 可选,同一个stream的消息会严格按照顺序处理 Stream string `protobuf:"bytes,4,opt,name=stream,proto3" json:"stream,omitempty"` // 可选,是否广播给所有人 // 如果 receiver 有值,则忽略此字段 ToEveryone bool `protobuf:"varint,5,opt,name=to_everyone,json=toEveryone,proto3" json:"to_everyone,omitempty"` // contains filtered or unexported fields }
用于内部节点主动向客户端发送消息 内部节点把消息打包为Multicast,然后push到消息队列 网关节点从消息队列中获取Multicast,然后push到客户端
func NewMulticast ¶
NewMulticast 创建push消息
func (*Multicast) Descriptor
deprecated
func (*Multicast) GetContent ¶
func (*Multicast) GetReceiver ¶
func (*Multicast) GetTime ¶
func (x *Multicast) GetTime() *timestamppb.Timestamp
func (*Multicast) GetToEveryone ¶
func (*Multicast) ProtoMessage ¶
func (*Multicast) ProtoMessage()
func (*Multicast) ProtoReflect ¶
func (x *Multicast) ProtoReflect() protoreflect.Message
type NodeClient ¶
type NodeClient interface { // 改变节点状态 ChangeState(ctx context.Context, in *ChangeStateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) // 关闭服务 Shutdown(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) }
NodeClient is the client API for Node 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 NewNodeClient ¶
func NewNodeClient(cc grpc.ClientConnInterface) NodeClient
type NodeServer ¶
type NodeServer interface { // 改变节点状态 ChangeState(context.Context, *ChangeStateRequest) (*emptypb.Empty, error) // 关闭服务 Shutdown(context.Context, *emptypb.Empty) (*emptypb.Empty, error) // contains filtered or unexported methods }
NodeServer is the server API for Node service. All implementations must embed UnimplementedNodeServer for forward compatibility.
节点管理接口,供内部服务调用 每个内部服务节点都会内置此服务
type RPCError ¶
type RPCError struct { // request消息请求的服务 RequestService int32 `protobuf:"varint,1,opt,name=request_service,json=requestService,proto3" json:"request_service,omitempty"` // request消息请求的方法 RequestMethod string `protobuf:"bytes,2,opt,name=request_method,json=requestMethod,proto3" json:"request_method,omitempty"` // 详细错误信息 Status *status.Status `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
网关透传grpc请求后,返回的grpc错误
func (*RPCError) Descriptor
deprecated
func (*RPCError) GetRequestMethod ¶
func (*RPCError) GetRequestService ¶
func (*RPCError) ProtoMessage ¶
func (*RPCError) ProtoMessage()
func (*RPCError) ProtoReflect ¶
func (x *RPCError) ProtoReflect() protoreflect.Message
type RemoveServiceRouteRequest ¶
type RemoveServiceRouteRequest struct { ServiceCode int32 `protobuf:"varint,1,opt,name=service_code,json=serviceCode,proto3" json:"service_code,omitempty"` SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // contains filtered or unexported fields }
func (*RemoveServiceRouteRequest) Descriptor
deprecated
func (*RemoveServiceRouteRequest) Descriptor() ([]byte, []int)
Deprecated: Use RemoveServiceRouteRequest.ProtoReflect.Descriptor instead.
func (*RemoveServiceRouteRequest) GetServiceCode ¶
func (x *RemoveServiceRouteRequest) GetServiceCode() int32
func (*RemoveServiceRouteRequest) GetSessionId ¶
func (x *RemoveServiceRouteRequest) GetSessionId() string
func (*RemoveServiceRouteRequest) ProtoMessage ¶
func (*RemoveServiceRouteRequest) ProtoMessage()
func (*RemoveServiceRouteRequest) ProtoReflect ¶
func (x *RemoveServiceRouteRequest) ProtoReflect() protoreflect.Message
func (*RemoveServiceRouteRequest) Reset ¶
func (x *RemoveServiceRouteRequest) Reset()
func (*RemoveServiceRouteRequest) String ¶
func (x *RemoveServiceRouteRequest) String() string
type ReplaceServiceRouteRequest ¶
type ReplaceServiceRouteRequest struct { OldNodeId string `protobuf:"bytes,1,opt,name=old_node_id,json=oldNodeId,proto3" json:"old_node_id,omitempty"` NewNodeId string `protobuf:"bytes,2,opt,name=new_node_id,json=newNodeId,proto3" json:"new_node_id,omitempty"` // contains filtered or unexported fields }
func (*ReplaceServiceRouteRequest) Descriptor
deprecated
func (*ReplaceServiceRouteRequest) Descriptor() ([]byte, []int)
Deprecated: Use ReplaceServiceRouteRequest.ProtoReflect.Descriptor instead.
func (*ReplaceServiceRouteRequest) GetNewNodeId ¶
func (x *ReplaceServiceRouteRequest) GetNewNodeId() string
func (*ReplaceServiceRouteRequest) GetOldNodeId ¶
func (x *ReplaceServiceRouteRequest) GetOldNodeId() string
func (*ReplaceServiceRouteRequest) ProtoMessage ¶
func (*ReplaceServiceRouteRequest) ProtoMessage()
func (*ReplaceServiceRouteRequest) ProtoReflect ¶
func (x *ReplaceServiceRouteRequest) ProtoReflect() protoreflect.Message
func (*ReplaceServiceRouteRequest) Reset ¶
func (x *ReplaceServiceRouteRequest) Reset()
func (*ReplaceServiceRouteRequest) String ¶
func (x *ReplaceServiceRouteRequest) String() string
type Reply ¶
type Reply struct { // 触发此次请求的request_id // 网关会自动给这个字段赋值 // 如果是服务器端主动下发,request_id = 0 RequestId uint32 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // 服务ID,对应内部节点的每种grpc服务 // 标识这个消息来自于哪个内部服务 // grpc调用返回结果,网关会自动给这个字段赋值 // 如果是服务器端主动下发,需要自行赋值 // service_code = 0,表示这个消息来自于网关本身 ServiceCode int32 `protobuf:"varint,2,opt,name=service_code,json=serviceCode,proto3" json:"service_code,omitempty"` // 消息类型代码 // code = 0,表示这是google.protobuf.Empty类型的空消息 Code int32 `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty"` // 下行protobuf message序列化之后的数据 // 客户端需要根据code字段判断具体反序列化成哪个protobuf message Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
来自服务器端下行的消息
func (*Reply) Descriptor
deprecated
func (*Reply) GetRequestId ¶
func (*Reply) GetServiceCode ¶
func (*Reply) ProtoMessage ¶
func (*Reply) ProtoMessage()
func (*Reply) ProtoReflect ¶
func (x *Reply) ProtoReflect() protoreflect.Message
type ReplyCode ¶
type ReplyCode int32
func (ReplyCode) Descriptor ¶
func (ReplyCode) Descriptor() protoreflect.EnumDescriptor
func (ReplyCode) EnumDescriptor
deprecated
func (ReplyCode) Number ¶
func (x ReplyCode) Number() protoreflect.EnumNumber
func (ReplyCode) Type ¶
func (ReplyCode) Type() protoreflect.EnumType
type Request ¶
type Request struct { // id应该按照发送顺序自增长 // 网关会在每个request对应的reply.request_id内原样返回这个值 Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 服务ID,对应内部节点的每种grpc服务 // 内部节点在注册服务发现时,会将服务ID注册到etcd中 // 网关根据service字段将请求转发到对应的内部服务 ServiceCode int32 `protobuf:"varint,2,opt,name=service_code,json=serviceCode,proto3" json:"service_code,omitempty"` // grpc方法名,大小写敏感,例如: SayHello Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` // grpc方法对应的protobuf message序列化之后的数据 // 具体对应关系需要自行查看grpc服务的protobuf文件 Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` // 节点ID // 如果有值,网关会把本次请求直接转发到指定的节点 // 仅仅在有状态服务的allocation配置为client时有效 NodeId string `protobuf:"bytes,5,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` // 是否需要网关返回response NoReply bool `protobuf:"varint,6,opt,name=no_reply,json=noReply,proto3" json:"no_reply,omitempty"` // 如果不设置值,网关会以并发的方式处理这个请求 // 如果设置了值,网关会严格按照接收顺序处理同一个流的所有的请求 // 使用了流以后,性能会受到一定影响,因为网关会等待上一个请求的返回之后才会处理下一个请求 // 不同客户端以及不同的流之间不会互相影响 // 例如:stream = "stream1",表示这个请求属于stream1这个流 Stream string `protobuf:"bytes,7,opt,name=stream,proto3" json:"stream,omitempty"` // contains filtered or unexported fields }
客户端上行消息 请求会被网关转换为grpc请求转发到内部服务
func (*Request) Descriptor
deprecated
func (*Request) GetNoReply ¶
func (*Request) GetServiceCode ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type SendReplyRequest ¶
type SendReplyRequest struct { SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` Reply *Reply `protobuf:"bytes,2,opt,name=reply,proto3" json:"reply,omitempty"` // contains filtered or unexported fields }
func (*SendReplyRequest) Descriptor
deprecated
func (*SendReplyRequest) Descriptor() ([]byte, []int)
Deprecated: Use SendReplyRequest.ProtoReflect.Descriptor instead.
func (*SendReplyRequest) GetReply ¶
func (x *SendReplyRequest) GetReply() *Reply
func (*SendReplyRequest) GetSessionId ¶
func (x *SendReplyRequest) GetSessionId() string
func (*SendReplyRequest) ProtoMessage ¶
func (*SendReplyRequest) ProtoMessage()
func (*SendReplyRequest) ProtoReflect ¶
func (x *SendReplyRequest) ProtoReflect() protoreflect.Message
func (*SendReplyRequest) Reset ¶
func (x *SendReplyRequest) Reset()
func (*SendReplyRequest) String ¶
func (x *SendReplyRequest) String() string
type SendReplyResponse ¶
type SendReplyResponse struct { // success 为 false 时,表示会话不存在 Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*SendReplyResponse) Descriptor
deprecated
func (*SendReplyResponse) Descriptor() ([]byte, []int)
Deprecated: Use SendReplyResponse.ProtoReflect.Descriptor instead.
func (*SendReplyResponse) GetSuccess ¶
func (x *SendReplyResponse) GetSuccess() bool
func (*SendReplyResponse) ProtoMessage ¶
func (*SendReplyResponse) ProtoMessage()
func (*SendReplyResponse) ProtoReflect ¶
func (x *SendReplyResponse) ProtoReflect() protoreflect.Message
func (*SendReplyResponse) Reset ¶
func (x *SendReplyResponse) Reset()
func (*SendReplyResponse) String ¶
func (x *SendReplyResponse) String() string
type SessionCountResponse ¶
type SessionCountResponse struct { Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` // contains filtered or unexported fields }
func (*SessionCountResponse) Descriptor
deprecated
func (*SessionCountResponse) Descriptor() ([]byte, []int)
Deprecated: Use SessionCountResponse.ProtoReflect.Descriptor instead.
func (*SessionCountResponse) GetCount ¶
func (x *SessionCountResponse) GetCount() int32
func (*SessionCountResponse) ProtoMessage ¶
func (*SessionCountResponse) ProtoMessage()
func (*SessionCountResponse) ProtoReflect ¶
func (x *SessionCountResponse) ProtoReflect() protoreflect.Message
func (*SessionCountResponse) Reset ¶
func (x *SessionCountResponse) Reset()
func (*SessionCountResponse) String ¶
func (x *SessionCountResponse) String() string
type SetServiceRouteRequest ¶
type SetServiceRouteRequest struct { ServiceCode int32 `protobuf:"varint,1,opt,name=service_code,json=serviceCode,proto3" json:"service_code,omitempty"` SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` NodeId string `protobuf:"bytes,3,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` // contains filtered or unexported fields }
func (*SetServiceRouteRequest) Descriptor
deprecated
func (*SetServiceRouteRequest) Descriptor() ([]byte, []int)
Deprecated: Use SetServiceRouteRequest.ProtoReflect.Descriptor instead.
func (*SetServiceRouteRequest) GetNodeId ¶
func (x *SetServiceRouteRequest) GetNodeId() string
func (*SetServiceRouteRequest) GetServiceCode ¶
func (x *SetServiceRouteRequest) GetServiceCode() int32
func (*SetServiceRouteRequest) GetSessionId ¶
func (x *SetServiceRouteRequest) GetSessionId() string
func (*SetServiceRouteRequest) ProtoMessage ¶
func (*SetServiceRouteRequest) ProtoMessage()
func (*SetServiceRouteRequest) ProtoReflect ¶
func (x *SetServiceRouteRequest) ProtoReflect() protoreflect.Message
func (*SetServiceRouteRequest) Reset ¶
func (x *SetServiceRouteRequest) Reset()
func (*SetServiceRouteRequest) String ¶
func (x *SetServiceRouteRequest) String() string
type UnimplementedGatewayServer ¶
type UnimplementedGatewayServer struct{}
UnimplementedGatewayServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedGatewayServer) CloseSession ¶
func (UnimplementedGatewayServer) CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error)
func (UnimplementedGatewayServer) IsSessionExist ¶
func (UnimplementedGatewayServer) IsSessionExist(context.Context, *IsSessionExistRequest) (*IsSessionExistResponse, error)
func (UnimplementedGatewayServer) RemoveServiceRoute ¶
func (UnimplementedGatewayServer) RemoveServiceRoute(context.Context, *RemoveServiceRouteRequest) (*emptypb.Empty, error)
func (UnimplementedGatewayServer) ReplaceServiceRoute ¶
func (UnimplementedGatewayServer) ReplaceServiceRoute(context.Context, *ReplaceServiceRouteRequest) (*emptypb.Empty, error)
func (UnimplementedGatewayServer) SendReply ¶
func (UnimplementedGatewayServer) SendReply(context.Context, *SendReplyRequest) (*SendReplyResponse, error)
func (UnimplementedGatewayServer) SessionCount ¶
func (UnimplementedGatewayServer) SessionCount(context.Context, *emptypb.Empty) (*SessionCountResponse, error)
func (UnimplementedGatewayServer) SetServiceRoute ¶
func (UnimplementedGatewayServer) SetServiceRoute(context.Context, *SetServiceRouteRequest) (*emptypb.Empty, error)
type UnimplementedNodeServer ¶
type UnimplementedNodeServer struct{}
UnimplementedNodeServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedNodeServer) ChangeState ¶
func (UnimplementedNodeServer) ChangeState(context.Context, *ChangeStateRequest) (*emptypb.Empty, error)
type UnsafeGatewayServer ¶
type UnsafeGatewayServer interface {
// contains filtered or unexported methods
}
UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GatewayServer will result in compilation errors.
type UnsafeNodeServer ¶
type UnsafeNodeServer interface {
// contains filtered or unexported methods
}
UnsafeNodeServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NodeServer will result in compilation errors.