bigquery

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCRetryErrorFilter

func GRPCRetryErrorFilter(err error) bool

GRPCRetryErrorFilter returns a Retry error filter to be used for retrying GRPC Google API operations (e.g. BQ Storage client)

func HttpInternalErrorFilter added in v0.6.1

func HttpInternalErrorFilter(err error) bool

HttpInternalErrorFilter is an extra filter we use for our InsertAll (gax-based) retry logic, as to make sure we retry all (temporary) server faults (5xx status), given the default InsertAll client in the official implementation doens't retry it.

Types

type Client

type Client interface {
	// Put a row of data, with the possibility to opt-out of any scheme validation.
	//
	// No context is passed here, instead background context is always used.
	// Reason being is as we always want to be able to write to BQ,
	// even if the actual parent context is already closed.
	//
	// A boolean is also returned indicating whether or not the client
	// has flushed as part of its Put process.
	Put(data interface{}) (bool, error)

	// Flush any data already Put but not yet written to BigQuery.
	Flush() error

	// Close the BQ Client
	Close() error
}

Client is the interface we expect a BQ client to implement. The only reason for this abstraction is so we can easily unit test this class, without actual BQ interaction.

type Retryer

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

Retryer is a retryer inspired by other community back-off implementations, in order to not have another dependency added to this library, while still being able to rely on existing retry-related google code of dependencies already required by this library for its core functionality

func NewRetryer

func NewRetryer(ctx context.Context, maxRetries int, initialRetryDelay time.Duration, maxRetryDeadlineOffset time.Duration, retryDelayMultiplier float64, errorFilter func(error) bool) *Retryer

NewRetryer creates a new Retryer, the packaged `gax.Retryer` implementation shipped with the bqwriter package. See the documentation of `Retryer` for more information on how it is implemented why it should be used.

func (*Retryer) Retry

func (r *Retryer) Retry(err error) (pause time.Duration, shouldRetry bool)

Retry implements gax::Retryer::Retry

func (*Retryer) RetryOp

func (r *Retryer) RetryOp(op func(context.Context) error) error

RetryOp retries the operation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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