gax-go: Index | Files | Directories

package gax

import ""

Package gax contains a set of modules which aid the development of APIs for clients and servers based on gRPC and Google API conventions.

Application code will rarely need to use this library directly. However, code generated automatically from API definition files can use it to simplify code generation and to provide more convenient and idiomatic API surfaces.


Package Files

call_option.go gax.go header.go invoke.go


const Version = "1.0.1"

Version specifies the gax version.

func Invoke Uses

func Invoke(ctx context.Context, call APICall, opts ...CallOption) error

Invoke calls the given APICall, performing retries as specified by opts, if any.

func Sleep Uses

func Sleep(ctx context.Context, d time.Duration) error

Sleep is similar to time.Sleep, but it can be interrupted by ctx.Done() closing. If interrupted, Sleep returns ctx.Err().

func XGoogHeader Uses

func XGoogHeader(keyval ...string) string

XGoogHeader is for use by the Google Cloud Libraries only.

XGoogHeader formats key-value pairs. The resulting string is suitable for x-goog-api-client header.

type APICall Uses

type APICall = v2.APICall

APICall is a user defined call stub.

type Backoff Uses

type Backoff = v2.Backoff

Backoff implements exponential backoff. The wait time between retries is a random value between 0 and the "retry envelope". The envelope starts at Initial and increases by the factor of Multiplier every retry, but is capped at Max.

type CallOption Uses

type CallOption = v2.CallOption

CallOption is an option used by Invoke to control behaviors of RPC calls. CallOption works by modifying relevant fields of CallSettings.

func WithGRPCOptions Uses

func WithGRPCOptions(opt ...grpc.CallOption) CallOption

WithGRPCOptions allows passing gRPC call options during client creation.

func WithRetry Uses

func WithRetry(fn func() Retryer) CallOption

WithRetry sets CallSettings.Retry to fn.

type CallSettings Uses

type CallSettings = v2.CallSettings

CallSettings allow fine-grained control over how calls are made.

type Retryer Uses

type Retryer = v2.Retryer

Retryer is used by Invoke to determine retry behavior.

func OnCodes Uses

func OnCodes(cc []codes.Code, bo Backoff) Retryer

OnCodes returns a Retryer that retries if and only if the previous attempt returns a GRPC error whose error code is stored in cc. Pause times between retries are specified by bo.

bo is only used for its parameters; each Retryer has its own copy.


v2Package gax contains a set of modules which aid the development of APIs for clients and servers based on gRPC and Google API conventions.

Package gax imports 5 packages (graph) and is imported by 58 packages. Updated 2020-07-02. Refresh now. Tools for package owners.