Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGRPCConn ¶
func NewGRPCConnWithOpts ¶
func NewGRPCConnWithOpts(addr string, timeout time.Duration, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(conf *ServerConfig, opt ...grpc.ServerOption) *Server
func (*Server) Shutdown ¶
Shutdown stops the server gracefully. It stops the server from accepting new connections and RPCs and blocks until all the pending RPCs are finished or the context deadline is reached.
type ServerConfig ¶
type ServerConfig struct { // Network is grpc listen network,default value is tcp Network string `dsn:"network"` // Addr is grpc listen addr,default value is 0.0.0.0:9000 Addr string `dsn:"address"` // Timeout is context timeout for per rpc call. Timeout time.Duration `dsn:"query.timeout"` // IdleTimeout is a duration for the amount of time after which an idle connection would be closed by sending a GoAway. // Idleness duration is defined since the most recent time the number of outstanding RPCs became zero or the connection establishment. KeepAliveMaxConnectionIdle time.Duration `dsn:"query.idleTimeout"` // MaxLifeTime is a duration for the maximum amount of time a connection may exist before it will be closed by sending a GoAway. // A random jitter of +/-10% will be added to MaxConnectionAge to spread out connection storms. KeepAliveMaxConnectionAge time.Duration `dsn:"query.maxLife"` // ForceCloseWait is an additive period after MaxLifeTime after which the connection will be forcibly closed. KeepAliveMaxMaxConnectionAgeGrace time.Duration `dsn:"query.closeWait"` // KeepAliveInterval is after a duration of this time if the server doesn't see any activity it pings the client to see if the transport is still alive. KeepAliveTime time.Duration `dsn:"query.keepaliveInterval"` // KeepAliveTimeout is After having pinged for keepalive check, the server waits for a duration of Timeout and if no activity is seen even after that // the connection is closed. KeepAliveTimeout time.Duration `dsn:"query.keepaliveTimeout"` }
ServerConfig is rpc server conf.
Click to show internal directories.
Click to hide internal directories.