Documentation ¶
Index ¶
- Constants
- func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
- func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
- func GRPCHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler
- func GetGrpcService() *grpc.Server
- func HeaderMatch(key string) (string, bool)
- func ParseHeader(ctx Environment) error
- type ChanFn
- type Environment
- type FuncHandler
- type ServiceInfo
- type Structure
- func (s *Structure) Deadline() (deadline time.Time, ok bool)
- func (s *Structure) Done() <-chan struct{}
- func (s *Structure) Err() error
- func (s *Structure) GetAuth() string
- func (s *Structure) GetIP() string
- func (s *Structure) GetMac() string
- func (s *Structure) GetMode() string
- func (s *Structure) GetRID() string
- func (s *Structure) SetAuth(m string)
- func (s *Structure) SetIP(m string)
- func (s *Structure) SetMac(m string)
- func (s *Structure) SetMode(m string)
- func (s *Structure) SetRID(m string)
- func (s *Structure) Value(key interface{}) interface{}
Constants ¶
View Source
const ( // DialTimeout 连接建立的超时时间 DialTimeout = 5 * time.Second // BackoffMaxDelay 连接尝试失败后退出时提供的最大延迟 BackoffMaxDelay = 3 * time.Second // KeepAliveTime 每隔KeepAliveTime时间,发送PING帧测量最小往返时间,确定空闲连接是否仍然有效,我们设置为10S KeepAliveTime = time.Duration(30) * time.Second // KeepAliveTimeout 超过KeepAliveTimeout,关闭连接,我们设置为3S KeepAliveTimeout = time.Duration(3) * time.Second // InitialWindowSize 基于Stream的滑动窗口,类似于TCP的滑动窗口,用来做流控,默认64KiB,吞吐量上不去,Client和Server我们调到1GiB. InitialWindowSize = 1 << 30 // InitialConnWindowSize 基于Connection的滑动窗口,默认16 * 64KiB,吞吐量上不去,Client和Server我们也都调到1GiB InitialConnWindowSize = 1 << 30 // MaxSendMsgSize GRPC最大允许发送的字节数,默认4MiB,如果超过了GRPC会报错 MaxSendMsgSize = 4 << 30 // MaxRecvMsgSize GRPC最大允许接收的字节数,默认4MiB,如果超过了GRPC会报错。Client和Server我们都调到4GiB MaxRecvMsgSize = 4 << 30 )
Variables ¶
This section is empty.
Functions ¶
func ChainStreamServer ¶
func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
ChainStreamServer 服务端的流式调用链
func ChainUnaryClient ¶
func ChainUnaryClient(interceptors ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
ChainUnaryClient 客户端的Unary调用链
func GRPCHandlerFunc ¶
GRPCHandlerFunc 用于区分http以及grpc
Types ¶
type ChanFn ¶
type ChanFn func(ctx context.Context, req interface{}, info *ServiceInfo, handler FuncHandler) (rsp interface{}, err error)
ChanFn 用于描述一个执行链
func ChainUnaryServer ¶
ChainUnaryServer 服务端Unary调用链
type Environment ¶
type Environment interface { GetMode() string SetMode(string) GetMac() string SetMac(string) GetIP() string SetIP(string) GetRID() string SetRID(string) GetAuth() string SetAuth(string) // GetToken() *pbtoken.Token // SetToken(*pbtoken.Token) Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} }
Environment 这里仅仅是一个继承context的举例,一般这个context会被用于工程中,每个context都不相同
type FuncHandler ¶
FuncHandler 用于描述一个执行句柄
type ServiceInfo ¶
type ServiceInfo struct { Method string // Method 用于描述当前的方法名 Service string // Service 用于描述一个服务名 Version string // Version 版本 }
ServiceInfo 用于描述一个服务信息
Source Files ¶
Click to show internal directories.
Click to hide internal directories.