nh

package
v0.0.0-...-7483216 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: BSD-3-Clause Imports: 13 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// NodeServiceCode 节点管理服务,每个内部节点都会内置这个grpc服务
	NodeServiceCode int32 = -1
	// GatewayServiceCode 网关服务代码,每个网关节点都会内置这个grpc服务
	GatewayServiceCode int32 = -2
)
View Source
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"
)
View Source
const (
	Node_ChangeState_FullMethodName = "/nodehub.Node/ChangeState"
	Node_Shutdown_FullMethodName    = "/nodehub.Node/Shutdown"
)

Variables

View Source
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.

View Source
var (
	// EmptyReply 空响应
	EmptyReply = &emptypb.Empty{}
)
View Source
var File_nodehub_client_proto protoreflect.FileDescriptor
View Source
var File_nodehub_gateway_proto protoreflect.FileDescriptor
View Source
var File_nodehub_services_proto protoreflect.FileDescriptor
View Source
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)

View Source
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

func GetReplyType(serviceCode int32, code int32) (reflect.Type, bool)

GetReplyType 根据编码获取对应的响应数据类型

func RegisterGatewayServer

func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer)

func RegisterNodeServer

func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer)

func RegisterReplyType

func RegisterReplyType(serviceCode int32, code int32, message proto.Message)

RegisterReplyType 注册响应数据编码及类型

func ResetReply

func ResetReply(resp *Reply)

ResetReply 重置响应对象

func ResetRequest

func ResetRequest(req *Request)

ResetRequest 重置请求对象

func UnpackReply

func UnpackReply(reply *Reply) (msg proto.Message, ok bool, err error)

UnpackReply 解包Reply

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

func NewMulticast(receiver []string, content *Reply) *Multicast

NewMulticast 创建push消息

func (*Multicast) Descriptor deprecated

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

Deprecated: Use Multicast.ProtoReflect.Descriptor instead.

func (*Multicast) GetContent

func (x *Multicast) GetContent() *Reply

func (*Multicast) GetReceiver

func (x *Multicast) GetReceiver() []string

func (*Multicast) GetStream

func (x *Multicast) GetStream() string

func (*Multicast) GetTime

func (x *Multicast) GetTime() *timestamppb.Timestamp

func (*Multicast) GetToEveryone

func (x *Multicast) GetToEveryone() bool

func (*Multicast) ProtoMessage

func (*Multicast) ProtoMessage()

func (*Multicast) ProtoReflect

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

func (*Multicast) Reset

func (x *Multicast) Reset()

func (*Multicast) String

func (x *Multicast) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use RPCError.ProtoReflect.Descriptor instead.

func (*RPCError) GetRequestMethod

func (x *RPCError) GetRequestMethod() string

func (*RPCError) GetRequestService

func (x *RPCError) GetRequestService() int32

func (*RPCError) GetStatus

func (x *RPCError) GetStatus() *status.Status

func (*RPCError) ProtoMessage

func (*RPCError) ProtoMessage()

func (*RPCError) ProtoReflect

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

func (*RPCError) Reset

func (x *RPCError) Reset()

func (*RPCError) String

func (x *RPCError) String() string

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 (*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 (*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 NewReply

func NewReply(code int32, msg proto.Message) (*Reply, error)

NewReply 把proto message打包Reply

func (*Reply) Descriptor deprecated

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

Deprecated: Use Reply.ProtoReflect.Descriptor instead.

func (*Reply) GetCode

func (x *Reply) GetCode() int32

func (*Reply) GetData

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

func (*Reply) GetRequestId

func (x *Reply) GetRequestId() uint32

func (*Reply) GetServiceCode

func (x *Reply) GetServiceCode() int32

func (*Reply) LogValue

func (x *Reply) LogValue() slog.Value

LogValue implements slog.LogValuer

func (*Reply) ProtoMessage

func (*Reply) ProtoMessage()

func (*Reply) ProtoReflect

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

func (*Reply) Reset

func (x *Reply) Reset()

func (*Reply) String

func (x *Reply) String() string

type ReplyCode

type ReplyCode int32
const (
	ReplyCode_UNSPECIFIED ReplyCode = 0
	ReplyCode_RPC_ERROR   ReplyCode = 1
)

func (ReplyCode) Descriptor

func (ReplyCode) Descriptor() protoreflect.EnumDescriptor

func (ReplyCode) Enum

func (x ReplyCode) Enum() *ReplyCode

func (ReplyCode) EnumDescriptor deprecated

func (ReplyCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ReplyCode.Descriptor instead.

func (ReplyCode) Number

func (x ReplyCode) Number() protoreflect.EnumNumber

func (ReplyCode) String

func (x ReplyCode) String() string

func (ReplyCode) Type

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) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetData

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

func (*Request) GetId

func (x *Request) GetId() uint32

func (*Request) GetMethod

func (x *Request) GetMethod() string

func (*Request) GetNoReply

func (x *Request) GetNoReply() bool

func (*Request) GetNodeId

func (x *Request) GetNodeId() string

func (*Request) GetServiceCode

func (x *Request) GetServiceCode() int32

func (*Request) GetStream

func (x *Request) GetStream() string

func (*Request) LogValue

func (x *Request) LogValue() slog.Value

LogValue implements slog.LogValuer

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

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) IsSessionExist

func (UnimplementedGatewayServer) RemoveServiceRoute

func (UnimplementedGatewayServer) ReplaceServiceRoute

func (UnimplementedGatewayServer) SendReply

func (UnimplementedGatewayServer) SessionCount

func (UnimplementedGatewayServer) SetServiceRoute

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) Shutdown

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.

Jump to

Keyboard shortcuts

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