Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(config *ClientConfig, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Dial creates a client connection to the given target.
func NewPool ¶
func NewPool(addr string, init, capacity int, idleTimeout time.Duration, timeout time.Duration) (*pool.Pool, error)
NewPool creates a new pool
func WithLogAndMetrics ¶
func WithLogAndMetrics(r interface{}) error
Types ¶
type ClientConfig ¶
type ClientConfig struct { // Addr is the gRPC server listen address. Addr string // RPC timeout. Timeout time.Duration // KeepAliveTime is the gRPC server keep alive timeout KeepAliveTime time.Duration // KeepAliveTimeout is the gRPC server keep alive timeout KeepAliveTimeout time.Duration // DisableReuseConn is the gRPC server disable reuse connection DisableReuseConn bool }
ClientConfig is a gRPC client config.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a gRPC server to serve RPC requests.
func NewServer ¶
func NewServer(config *ServerConfig, opts ...grpc.ServerOption) *Server
NewServer creates a gRPC server which has no service registered and has not started to accept requests yet.
func (*Server) Serve ¶
Serve accepts incoming connections on the listener lis, creating a new ServerTransport and service goroutine for each.
func (*Server) SetConfig ¶
func (s *Server) SetConfig(config *ServerConfig)
SetConfig sets the default config.
func (*Server) UseUnaryInterceptor ¶
func (s *Server) UseUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor)
UseUnaryInterceptor attaches the unary server interceptors to the gRPC server.
type ServerConfig ¶
type ServerConfig struct { // Addr is the gRPC server listen address. Addr string }
ServerConfig is a gRPC server config.
Click to show internal directories.
Click to hide internal directories.