batchwriter

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxBackoffReached = errors.New("backoff: max backoff reached")

ErrMaxBackoffReached is returned when the maximum backoff count has been reached.

Functions

This section is empty.

Types

type Backoff

type Backoff func(retry int) error

Backoff function to retry during batch writes.

func NewBackoff

func NewBackoff(maxRetries int) Backoff

NewBackoff creates a backoff function. Retry Backoff Total elapsed 0 0 0 1 200 0.2 2 400 0.6 3 800 1.4 4 1600 3 5 3200 6.2 6 6400 12.6 7 12800 25.4

type BatchWriter

type BatchWriter struct {
	Backoff Backoff
	// contains filtered or unexported fields
}

BatchWriter writes to DynamoDB tables using BatchWriteItem.

func New

func New(region, tableName string) (bw BatchWriter, err error)

New creates a new BatchWriter to write to a DynamoDB table in batches. It uses the default Backoff implementation which provides up to 7 retries costing 25 seconds of latency before failing the entire batch.

func (BatchWriter) Write

func (bw BatchWriter) Write(records []map[string]*dynamodb.AttributeValue) (err error)

Write to DynamoDB using BatchWriteItem.

Jump to

Keyboard shortcuts

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