grpc

package
v0.0.0-...-d5b0b98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 17 Imported by: 0

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) Close

func (s *Server) Close() error

func (*Server) Serve

func (s *Server) Serve() error

Serve accepts incoming connections on the listener lis, creating a new ServerTransport and service goroutine for each.

func (*Server) Server

func (s *Server) Server() *grpc.Server

Server return the grpc server.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL