grpc

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package grpc provides generic functionality for grpc

Package grpc provides generic functionality for grpc

Package grpc provides generic functionality for grpc

Package grpc provides generic functionality for grpc

Package grpc provides generic functionality for grpc

Index

Constants

This section is empty.

Variables

View Source
var (
	StatsHandler     = grpc.StatsHandler
	WithStatsHandler = grpc.WithStatsHandler
)

Functions

func BidirectionalStream

func BidirectionalStream(ctx context.Context, stream grpc.ServerStream,
	concurrency int,
	newData func() interface{},
	f func(context.Context, interface{}) (interface{}, error)) (err error)

func BidirectionalStreamClient added in v0.0.25

func BidirectionalStreamClient(stream grpc.ClientStream,
	dataProvider func() interface{},
	newData func() interface{},
	f func(interface{}, error)) (err error)

BidirectionalStreamClient is gRPC client stream.

Types

type CallOption

type CallOption = grpc.CallOption

type Client

type Client interface {
	StartConnectionMonitor(ctx context.Context) (<-chan error, error)
	Connect(ctx context.Context, addr string, dopts ...DialOption) error
	Disconnect(addr string) error
	Range(ctx context.Context,
		f func(ctx context.Context,
			addr string,
			conn *ClientConn,
			copts ...CallOption) error) error
	RangeConcurrent(ctx context.Context,
		concurrency int,
		f func(ctx context.Context,
			addr string,
			conn *ClientConn,
			copts ...CallOption) error) error
	OrderedRange(ctx context.Context,
		order []string,
		f func(ctx context.Context,
			addr string,
			conn *ClientConn,
			copts ...CallOption) error) error
	OrderedRangeConcurrent(ctx context.Context,
		order []string,
		concurrency int,
		f func(ctx context.Context,
			addr string,
			conn *ClientConn,
			copts ...CallOption) error) error
	Do(ctx context.Context, addr string,
		f func(ctx context.Context,
			conn *ClientConn,
			copts ...CallOption) (interface{}, error)) (interface{}, error)
	GetDialOption() []DialOption
	GetCallOption() []CallOption
	Close() error
}

func New

func New(opts ...Option) (c Client)

type ClientConn

type ClientConn = grpc.ClientConn

type ClientConnPool added in v0.0.5

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

func NewPool added in v0.0.5

func NewPool(ctx context.Context, addr string, size uint64, dopts ...DialOption) (*ClientConnPool, error)

func (*ClientConnPool) Connect added in v0.0.5

func (c *ClientConnPool) Connect(ctx context.Context) (cp *ClientConnPool, err error)

func (*ClientConnPool) Disconnect added in v0.0.5

func (c *ClientConnPool) Disconnect() (rerr error)

func (*ClientConnPool) Do added in v0.0.5

func (c *ClientConnPool) Do(f func(conn *ClientConn) error) (err error)

func (*ClientConnPool) Get added in v0.0.5

func (c *ClientConnPool) Get() (*ClientConn, bool)

func (*ClientConnPool) IsHealthy added in v0.0.5

func (c *ClientConnPool) IsHealthy() bool

func (*ClientConnPool) Len added in v0.0.5

func (c *ClientConnPool) Len() uint64

func (*ClientConnPool) Put added in v0.0.5

func (c *ClientConnPool) Put(conn *ClientConn) error

type DialOption

type DialOption = grpc.DialOption

type Option

type Option func(*gRPCClient)

func WithAddrs

func WithAddrs(addrs ...string) Option

func WithBackoff

func WithBackoff(bo backoff.Backoff) Option

func WithCallOptions

func WithCallOptions(opts ...grpc.CallOption) Option

func WithConnectionPool added in v0.0.5

func WithConnectionPool(size int) Option

func WithDialOptions

func WithDialOptions(opts ...grpc.DialOption) Option

func WithDialTimeout

func WithDialTimeout(dur string) Option

func WithDialer

func WithDialer(der tcp.Dialer) Option

func WithErrGroup

func WithErrGroup(eg errgroup.Group) Option

func WithHealthCheckDuration

func WithHealthCheckDuration(dur string) Option

func WithInitialConnectionWindowSize

func WithInitialConnectionWindowSize(size int) Option

func WithInitialWindowSize

func WithInitialWindowSize(size int) Option

func WithInsecure

func WithInsecure(flg bool) Option

func WithKeepaliveParams

func WithKeepaliveParams(t, to string, permitWithoutStream bool) Option

func WithMaxBackoffDelay

func WithMaxBackoffDelay(dur string) Option

func WithMaxMsgSize

func WithMaxMsgSize(size int) Option

func WithMaxRecvMsgSize

func WithMaxRecvMsgSize(size int) Option

func WithMaxRetryRPCBufferSize

func WithMaxRetryRPCBufferSize(size int) Option

func WithMaxSendMsgSize

func WithMaxSendMsgSize(size int) Option

func WithReadBufferSize

func WithReadBufferSize(size int) Option

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) Option

func WithWaitForReady

func WithWaitForReady(flg bool) Option

func WithWriteBufferSize

func WithWriteBufferSize(size int) Option

type Server

type Server = grpc.Server

Directories

Path Synopsis
Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc
Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc
Package status provides statuses and errors returned by grpc handler functions
Package status provides statuses and errors returned by grpc handler functions

Jump to

Keyboard shortcuts

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