grpc

package
v0.0.0-...-6d34543 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(clientOptions *ClientOptions) *Client

NewClient create Client for business. clientOptions clientOptions can not nil.

func (*Client) Close

func (gc *Client) Close()

func (*Client) DialContext

func (gc *Client) DialContext(ctx context.Context, target string) *grpc.ClientConn

type ClientConfig

type ClientConfig struct {
	// handle
	Timeout time.Duration
	// conn
	DialTimeout time.Duration // ms
	// keepalive
	KeepTime            time.Duration // s
	KeepTimeOut         time.Duration // s
	PermitWithoutStream bool
	// debug
	Debug bool
	// metric
	Metrics bool
	// check slow; ms
	SlowTime time.Duration
	// tracer
	Tracer bool
}

type ClientConn

type ClientConn struct {
	// contains filtered or unexported fields
}

Collect the grpc.ClientConn instances.

func NewClientConn

func NewClientConn(logger log.Logger) *ClientConn

func (*ClientConn) Close

func (cc *ClientConn) Close()

Close unity closes the grpc.ClientConn instances.

func (*ClientConn) CollectConn

func (cc *ClientConn) CollectConn(conn *grpc.ClientConn)

Examples:

client := grpc.NewClient(clientOptions)
ctx := context.Background()
conn := client.DialContext(ctx, ":50051")

clientConn := NewClientConn()
clientConn.CollectConn(conn).

func (*ClientConn) State

func (cc *ClientConn) State() []string

State unity show the grpc.ClientConn state.

type ClientOptional

type ClientOptional func(c *ClientOptions)

func WithDialOptions

func WithDialOptions(options ...grpc.DialOption) ClientOptional

type ClientOptions

type ClientOptions struct {
	// contains filtered or unexported fields
}

func NewClientOptions

func NewClientOptions(options ...ClientOptional) *ClientOptions

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(options ...ServerOption) *Server

func (*Server) GracefulShutDown

func (gs *Server) GracefulShutDown()

func (*Server) Server

func (gs *Server) Server() *grpc.Server

func (*Server) Start

func (gs *Server) Start()

func (*Server) Use

func (gs *Server) Use(interceptors ...grpc.UnaryServerInterceptor) *Server

type ServerConfig

type ServerConfig struct {
	AppName string
	Addr    string
	Port    string
	// handle
	Timeout time.Duration // grpc_server_timeout
	// conn
	DialTimeout time.Duration // ms
	// keepalive
	KeepTime    time.Duration // s
	KeepTimeOut time.Duration // s
	// debug
	Debug bool
	// metric
	Metrics bool
	// check slow; ms
	SlowTime time.Duration
	// tracer
	Tracer bool
	// validate
	Validate bool
}

type ServerOption

type ServerOption func(c *Server)

type ServerOptions

type ServerOptions struct{}

func (ServerOptions) WithServerOption

func (ServerOptions) WithServerOption(options ...grpc.ServerOption) ServerOption

func (ServerOptions) WithUnarySrvItcp

func (ServerOptions) WithUnarySrvItcp(options ...grpc.UnaryServerInterceptor) ServerOption

type TimeoutCallOption

type TimeoutCallOption struct {
	*grpc.EmptyCallOption
	Timeout time.Duration // ms
}

func WithTimeout

func WithTimeout(timeout time.Duration) *TimeoutCallOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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