client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 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 RetryOption

func RetryOption(cfg *Config) grpc.DialOption

RetryOption gives option to reconnect to auth service

func TokenOption

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

TokenOption gives gRPC token option

Types

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 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 {
	Reason  Reason
	Count   int
	Timeout int
}

Retry config describes retry parameters

Jump to

Keyboard shortcuts

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