Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

client

v0.1.8
github.com/takama/grpc/client

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

16 matches

Top ↑

Functions

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.

TokenOption

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

TokenOption gives gRPC token option.

Types

Backoff

type Backoff struct {
	Multiplier float64
	Jitter     float64
	Delay      Delay
}

Backoff is exponential backoff attributes.

Client

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

Client provides access to the service using client connection.

New

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

New gives a Client.

Client.Connection

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

Connection returns gRPC connection.

Client.Context

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

Context returns context.

Client.Shutdown

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

Shutdown closes active Client connections.

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.

Delay

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.

Envoy

type Envoy struct {
	Reason  Reason
	Count   int
	Timeout int
}

Envoy contains envoy proxy retry parameters.

Keepalive

type Keepalive struct {
	Time    int
	Timeout int
	Force   bool
}

Keepalive connection parameters.

Reason

type Reason struct {
	Primary string
	GRPC    string
}

Reason config describes reasons to retry.

Retry

type Retry struct {
	Active  bool
	Envoy   Envoy
	Backoff Backoff
}

Retry config describes retry parameters.

Dependency graph