Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer)
- func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
- func ResetReply(resp *Reply)
- func ResetRequest(req *Request)
- 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) GetSessionId() string
- 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 (x *IsSessionExistResponse) GetSessionId() string
- 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) GetTime() *timestamppb.Timestamp
- func (*Multicast) ProtoMessage()
- func (x *Multicast) ProtoReflect() protoreflect.Message
- func (x *Multicast) Reset()
- func (x *Multicast) String() string
- type NodeClient
- type NodeServer
- type Protocol
- type PushMessageRequest
- func (*PushMessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PushMessageRequest) GetReply() *Reply
- func (x *PushMessageRequest) GetSessionId() string
- func (*PushMessageRequest) ProtoMessage()
- func (x *PushMessageRequest) ProtoReflect() protoreflect.Message
- func (x *PushMessageRequest) Reset()
- func (x *PushMessageRequest) String() string
- type PushMessageResponse
- func (*PushMessageResponse) Descriptor() ([]byte, []int)deprecated
- func (x *PushMessageResponse) GetSessionId() string
- func (x *PushMessageResponse) GetSuccess() bool
- func (*PushMessageResponse) ProtoMessage()
- func (x *PushMessageResponse) ProtoReflect() protoreflect.Message
- func (x *PushMessageResponse) Reset()
- func (x *PushMessageResponse) String() string
- 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 Reply
- func (*Reply) Descriptor() ([]byte, []int)deprecated
- func (x *Reply) GetData() []byte
- func (x *Reply) GetFromService() int32
- func (x *Reply) GetMessageType() int32
- func (x *Reply) GetRequestId() uint32
- func (*Reply) ProtoMessage()
- func (x *Reply) ProtoReflect() protoreflect.Message
- func (x *Reply) Reset()
- func (x *Reply) String() string
- 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) LogValue() slog.Value
- func (*Request) ProtoMessage()
- func (x *Request) ProtoReflect() protoreflect.Message
- func (x *Request) Reset()
- func (x *Request) String() string
- 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) PushMessage(context.Context, *PushMessageRequest) (*PushMessageResponse, error)
- func (UnimplementedGatewayServer) RemoveServiceRoute(context.Context, *RemoveServiceRouteRequest) (*emptypb.Empty, 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_PushMessage_FullMethodName = "/nodehub.Gateway/PushMessage" )
const ( Node_ChangeState_FullMethodName = "/nodehub.Node/ChangeState" Node_Shutdown_FullMethodName = "/nodehub.Node/Shutdown" )
Variables ¶
var ( Protocol_name = map[int32]string{ 0: "UNSPECIFIED", 1: "RPC_ERROR", } Protocol_value = map[string]int32{ "UNSPECIFIED": 0, "RPC_ERROR": 1, } )
Enum value maps for Protocol.
var File_nodehub_client_proto protoreflect.FileDescriptor
var File_nodehub_gateway_proto protoreflect.FileDescriptor
var File_nodehub_gateway_service_proto protoreflect.FileDescriptor
var File_nodehub_node_service_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: "PushMessage", Handler: _Gateway_PushMessage_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "nodehub/gateway_service.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/node_service.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 RegisterGatewayServer ¶
func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer)
func RegisterNodeServer ¶
func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)
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 { SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // success 为 false 时,表示会话不存在 Success bool `protobuf:"varint,2,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) GetSessionId ¶
func (x *CloseSessionResponse) GetSessionId() string
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) // 向指定会话推送消息 PushMessage(ctx context.Context, in *PushMessageRequest, opts ...grpc.CallOption) (*PushMessageResponse, 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) // 向指定会话推送消息 PushMessage(context.Context, *PushMessageRequest) (*PushMessageResponse, 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 { SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` Exist bool `protobuf:"varint,2,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) GetSessionId ¶
func (x *IsSessionExistResponse) GetSessionId() string
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"` // 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) 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 Protocol ¶
type Protocol int32
func (Protocol) Descriptor ¶
func (Protocol) Descriptor() protoreflect.EnumDescriptor
func (Protocol) EnumDescriptor
deprecated
func (Protocol) Number ¶
func (x Protocol) Number() protoreflect.EnumNumber
func (Protocol) Type ¶
func (Protocol) Type() protoreflect.EnumType
type PushMessageRequest ¶
type PushMessageRequest 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 (*PushMessageRequest) Descriptor
deprecated
func (*PushMessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use PushMessageRequest.ProtoReflect.Descriptor instead.
func (*PushMessageRequest) GetReply ¶
func (x *PushMessageRequest) GetReply() *Reply
func (*PushMessageRequest) GetSessionId ¶
func (x *PushMessageRequest) GetSessionId() string
func (*PushMessageRequest) ProtoMessage ¶
func (*PushMessageRequest) ProtoMessage()
func (*PushMessageRequest) ProtoReflect ¶
func (x *PushMessageRequest) ProtoReflect() protoreflect.Message
func (*PushMessageRequest) Reset ¶
func (x *PushMessageRequest) Reset()
func (*PushMessageRequest) String ¶
func (x *PushMessageRequest) String() string
type PushMessageResponse ¶
type PushMessageResponse struct { SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // success 为 false 时,表示会话不存在 Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"` // contains filtered or unexported fields }
func (*PushMessageResponse) Descriptor
deprecated
func (*PushMessageResponse) Descriptor() ([]byte, []int)
Deprecated: Use PushMessageResponse.ProtoReflect.Descriptor instead.
func (*PushMessageResponse) GetSessionId ¶
func (x *PushMessageResponse) GetSessionId() string
func (*PushMessageResponse) GetSuccess ¶
func (x *PushMessageResponse) GetSuccess() bool
func (*PushMessageResponse) ProtoMessage ¶
func (*PushMessageResponse) ProtoMessage()
func (*PushMessageResponse) ProtoReflect ¶
func (x *PushMessageResponse) ProtoReflect() protoreflect.Message
func (*PushMessageResponse) Reset ¶
func (x *PushMessageResponse) Reset()
func (*PushMessageResponse) String ¶
func (x *PushMessageResponse) String() string
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 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调用返回结果,网关会自动给这个字段赋值 // 如果是服务器端主动下发,需要自行赋值 // from_service = 0,表示这个消息来自于网关本身 FromService int32 `protobuf:"varint,2,opt,name=from_service,json=fromService,proto3" json:"from_service,omitempty"` // 消息类型ID,可以是集群范围唯一,也可以是服务范围唯一 // 需要下发时自行指定 // message_type = 0,表示这是google.protobuf.Empty类型的空消息 MessageType int32 `protobuf:"varint,3,opt,name=message_type,json=messageType,proto3" json:"message_type,omitempty"` // 下行protobuf message序列化之后的数据 // 客户端需要根据message_type字段判断具体反序列化成哪个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) GetFromService ¶
func (*Reply) GetMessageType ¶
func (*Reply) GetRequestId ¶
func (*Reply) ProtoMessage ¶
func (*Reply) ProtoMessage()
func (*Reply) ProtoReflect ¶
func (x *Reply) ProtoReflect() protoreflect.Message
type Request ¶
type Request struct { // 由客户端生成,网关会在response内原样返回 // id是会话级别唯一的 Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 节点ID // 如果有值,网关会把本次请求直接转发到指定的节点 // 仅仅在有状态服务的allocation配置为client时有效 NodeId string `protobuf:"bytes,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` // 服务ID,对应内部节点的每种grpc服务 // 内部节点在注册服务发现时,会将服务ID注册到etcd中 // 网关根据service_code字段将请求转发到对应的内部服务 ServiceCode int32 `protobuf:"varint,3,opt,name=service_code,json=serviceCode,proto3" json:"service_code,omitempty"` // grpc方法名,大小写敏感,例如: SayHello Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"` // grpc方法对应的protobuf message序列化之后的数据 // 具体对应关系需要自行查看grpc服务的protobuf文件 Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // 是否需要网关返回response NoReply bool `protobuf:"varint,6,opt,name=no_reply,json=noReply,proto3" json:"no_reply,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 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.
func (UnimplementedGatewayServer) CloseSession ¶
func (UnimplementedGatewayServer) CloseSession(context.Context, *CloseSessionRequest) (*CloseSessionResponse, error)
func (UnimplementedGatewayServer) IsSessionExist ¶
func (UnimplementedGatewayServer) IsSessionExist(context.Context, *IsSessionExistRequest) (*IsSessionExistResponse, error)
func (UnimplementedGatewayServer) PushMessage ¶
func (UnimplementedGatewayServer) PushMessage(context.Context, *PushMessageRequest) (*PushMessageResponse, error)
func (UnimplementedGatewayServer) RemoveServiceRoute ¶
func (UnimplementedGatewayServer) RemoveServiceRoute(context.Context, *RemoveServiceRouteRequest) (*emptypb.Empty, 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.
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.