client

package
v2.7.13 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 10 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
}

GRPC Client.

func New

func New(config Config, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider, opts ...grpc.DialOption) (*Client, error)

func (*Client) AddCloseFunc

func (c *Client) AddCloseFunc(f func())

AddCloseFunc adds a function to be called by the Close method. This eliminates the need for wrapping the Client.

func (*Client) Close

func (c *Client) Close() error

func (*Client) GRPC

func (c *Client) GRPC() *grpc.ClientConn

type Config

type Config struct {
	Addr string `yaml:"address" json:"address"`
	// SendMsgSize is the maximum size of a message the client can send. If <=0, a default of 4MB will be used.
	SendMsgSize int `yaml:"sendMsgSize" json:"sendMsgSize"`
	// RecvMsgSize is the maximum size of a message the client can receive. If <=0, a default of 4MB will be used.
	RecvMsgSize int             `yaml:"recvMsgSize" json:"recvMsgSize"`
	KeepAlive   KeepAliveConfig `yaml:"keepAlive" json:"keepAlive"`
	TLS         client.Config   `yaml:"tls" json:"tls"`
}

func (*Config) Validate

func (c *Config) Validate() error

type KeepAliveConfig

type KeepAliveConfig struct {
	// After a duration of this time if the client doesn't see any activity it
	// pings the server to see if the transport is still alive.
	// If set below 10s, a minimum value of 10s will be used instead.
	Time time.Duration `yaml:"time" json:"time"` // The current default value is infinity.
	// After having pinged for keepalive check, the client waits for a duration
	// of Timeout and if no activity is seen even after that the connection is
	// closed.
	Timeout time.Duration `yaml:"timeout" json:"timeout"` // The current default value is 20 seconds.
	// If true, client sends keepalive pings even with no active RPCs. If false,
	// when there are no active RPCs, Time and Timeout will be ignored and no
	// keepalive pings will be sent.
	PermitWithoutStream bool `yaml:"permitWithoutStream" json:"permitWithoutStream"` // false by default.
}

Jump to

Keyboard shortcuts

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