client

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialOptions

func DialOptions(cfg *Config, opts ...grpc.DialOption) []grpc.DialOption

DialOptions gives options that manage TLS options, retries and exponential backoff in calls to a service.

func TokenOption

func TokenOption(active bool, path string) grpc.DialOption

TokenOption gives gRPC token option.

Types

type Backoff added in v0.1.1

type Backoff struct {
	Multiplier float64
	Jitter     float64
	Delay      Delay
}

Backoff is exponential backoff attributes.

type Client

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

Client provides access to the service using client connection.

func New

func New(cfg *Config, log *zap.Logger, opts ...grpc.DialOption) (*Client, error)

New gives a Client.

func (*Client) Connection

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

Connection returns gRPC connection.

func (*Client) Context

func (c *Client) Context(ctx context.Context) context.Context

Context returns context.

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) error

Shutdown closes active Client connections.

type Config

type Config struct {
	Scheme       string
	Host         string
	Sockets      []string
	Balancer     string
	Insecure     bool
	EnvoyProxy   bool
	WaitForReady bool
	Timeout      int
	Keepalive    Keepalive
	Retry        Retry
}

Config contains params to setup client connection.

type Delay added in v0.1.1

type Delay struct {
	Min int
	Max int
}

Delay are the amounts of time to backoff after the first failure and the upper bound of backoff delay.

type Envoy added in v0.1.1

type Envoy struct {
	Reason  Reason
	Count   int
	Timeout int
}

Envoy contains envoy proxy retry parameters.

type Keepalive

type Keepalive struct {
	Time    int
	Timeout int
	Force   bool
}

Keepalive connection parameters.

type Reason

type Reason struct {
	Primary string
	GRPC    string
}

Reason config describes reasons to retry.

type Retry

type Retry struct {
	Active  bool
	Envoy   Envoy
	Backoff Backoff
}

Retry config describes retry parameters.

Jump to

Keyboard shortcuts

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