Documentation ¶
Index ¶
- Constants
- func GatewayIDInContext(ctx context.Context) ulid.ULID
- func LogUnary(l logger.Logger) 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) error
- 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 GatewayIDInContext ¶
GatewayIDInContext 从context中获取gateway id
func SessionIDInContext ¶
SessionIDInContext 从context中获取session id
Types ¶
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
GRPCServer 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 注册服务
type Option ¶
type Option func(desc cluster.GRPCServiceDesc) cluster.GRPCServiceDesc
Option 配置
func WithPipeline ¶
WithPipeline 设置管道名称
设置了管道名称的请求会按照时序性顺序处理,没有设置管道的请求会并发处理
多个服务可以声明同一个管道名称,这样请求会被分配到同一个管道中
Click to show internal directories.
Click to hide internal directories.