Google API Extensions for Go
Google API Extensions for Go (gax-go) is a set of modules which aids the
development of APIs for clients and servers based on
gRPC and Google API
To install the API extensions, use:
go get -u github.com/googleapis/gax-go
Note: Application code will rarely need to use this library directly, but the code generated automatically from API definition files can use it to simplify code generation and to provide more convenient and idiomatic API surface.
This library requires Go 1.6 or above.
BSD - please see LICENSE for more information.
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.
- func Invoke(ctx context.Context, call APICall, opts ...CallOption) error
- func Sleep(ctx context.Context, d time.Duration) error
- func XGoogHeader(keyval ...string) string
- type APICall
- type Backoff
- type CallOption
- type CallSettings
- type Retryer
const Version = "1.0.1"
Version specifies the gax version.
Invoke calls the given APICall, performing retries as specified by opts, if any.
Sleep is similar to time.Sleep, but it can be interrupted by ctx.Done() closing. If interrupted, Sleep returns ctx.Err().
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 ¶
CallOption is an option used by Invoke to control behaviors of RPC calls. CallOption works by modifying relevant fields of CallSettings.
func WithGRPCOptions ¶
WithGRPCOptions allows passing gRPC call options during client creation.
type CallSettings ¶
CallSettings allow fine-grained control over how calls are made.
Retryer is used by Invoke to determine retry behavior.
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.