ddb

package
v0.3.2-0...-bc2e1b9 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

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

Checkpoint stores and retreives the last evaluated key from a DDB scan

func New

func New(appName, tableName string, opts ...Option) (*Checkpoint, error)

New returns a checkpoint that uses DynamoDB for underlying storage

func (*Checkpoint) Get

func (c *Checkpoint) Get(streamName, shardID string) (string, error)

Get determines if a checkpoint for a particular Shard exists. Typically used to determine whether we should start processing the shard with TRIM_HORIZON or AFTER_SEQUENCE_NUMBER (if checkpoint exists).

func (*Checkpoint) Set

func (c *Checkpoint) Set(streamName, shardID, sequenceNumber string) error

Set stores a checkpoint for a shard (e.g. sequence number of last record processed by application). Upon failover, record processing is resumed from this point.

func (*Checkpoint) Shutdown

func (c *Checkpoint) Shutdown() error

Shutdown the checkpoint. Save any in-flight data.

type DefaultRetryer

type DefaultRetryer struct {
	Retryer
}

func (*DefaultRetryer) ShouldRetry

func (r *DefaultRetryer) ShouldRetry(err error) bool

type Option

type Option func(*Checkpoint)

Option is used to override defaults when creating a new Checkpoint

func WithDynamoClient

func WithDynamoClient(svc dynamodbiface.DynamoDBAPI) Option

WithDynamoClient sets the dynamoDb client

func WithMaxInterval

func WithMaxInterval(maxInterval time.Duration) Option

WithMaxInterval sets the flush interval

func WithRetryer

func WithRetryer(r Retryer) Option

WithRetryer sets the retryer

type Retryer

type Retryer interface {
	ShouldRetry(error) bool
}

Retryer interface contains one method that decides whether to retry based on error

Jump to

Keyboard shortcuts

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