Documentation
¶
Index ¶
- Constants
- func ErrorWithDetail(err error, details ...protoadapt.MessageV1) error
- func GatewayIDInContext(ctx context.Context) ulid.ULID
- func LogUnary(l logger.Logger) grpc.UnaryServerInterceptor
- func NewError(code codes.Code, msg string, details ...protoadapt.MessageV1) error
- func PackReply(replyCodes ...map[string]int32) grpc.UnaryServerInterceptor
- func SessionIDInContext(ctx context.Context) string
- type GRPCServer
- func (gs *GRPCServer) CompleteNodeEntry(entry *cluster.NodeEntry)
- func (gs *GRPCServer) Name() string
- func (gs *GRPCServer) RegisterService(code int32, desc grpc.ServiceDesc, impl any, options ...Option) error
- func (gs *GRPCServer) Start(ctx context.Context) error
- func (gs *GRPCServer) Stop(ctx context.Context)
- type Option
Constants ¶
View Source
const ( // MDSessID grpc metadata中的session id key MDSessID = "x-sess" // MDTransactionID grpc metadata中的transaction id key,用于跟踪请求 MDTransactionID = "x-trans" // MDGateway grpc metadata中的gateway key,用于标识请求来自哪个网关 MDGateway = "x-gw" )
Variables ¶
This section is empty.
Functions ¶
func ErrorWithDetail ¶
func ErrorWithDetail(err error, details ...protoadapt.MessageV1) error
ErrorWithDetail adds details to an existing error.
func GatewayIDInContext ¶
GatewayIDInContext 从context中获取gateway id
func PackReply ¶
func PackReply(replyCodes ...map[string]int32) grpc.UnaryServerInterceptor
PackReply 自动把返回值转换为nodehub.Reply
func SessionIDInContext ¶
SessionIDInContext 从context中获取session id
Types ¶
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
GRPCServer grpc服务
func BindGRPCServer ¶
func BindGRPCServer(listener net.Listener, opts ...grpc.ServerOption) *GRPCServer
BindGRPCServer 绑定grpc服务器
func NewGRPCServer ¶
func NewGRPCServer(listenAddr string, opts ...grpc.ServerOption) *GRPCServer
NewGRPCServer 构造函数
func (*GRPCServer) CompleteNodeEntry ¶
func (gs *GRPCServer) CompleteNodeEntry(entry *cluster.NodeEntry)
CompleteNodeEntry 设置条目中的grpc信息
func (*GRPCServer) RegisterService ¶
func (gs *GRPCServer) RegisterService(code int32, desc grpc.ServiceDesc, impl any, options ...Option) error
RegisterService 注册服务
Click to show internal directories.
Click to hide internal directories.