common

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package common contains various helpers for adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustParseARN

func MustParseARN(arnStr string) arn.ARN

MustParseARN parses an ARN and panics in case of error.

func MustParseCognitoIdentityResource

func MustParseCognitoIdentityResource(resource string) string

MustParseCognitoIdentityResource parses the resource segment of a Cognito Identity Pool ARN and panics in case of error.

func MustParseCognitoUserPoolResource

func MustParseCognitoUserPoolResource(resource string) string

MustParseCognitoUserPoolResource parses the resource segment of a Cognito User Pool ARN and panics in case of error.

func MustParseDynamoDBResource

func MustParseDynamoDBResource(resource string) string

MustParseDynamoDBResource parses the resource segment of a DynamoDB ARN and panics in case of error.

func MustParseKinesisResource

func MustParseKinesisResource(resource string) string

MustParseKinesisResource parses the resource segment of a Kinesis ARN and panics in case of error.

Types

type Backoff

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

Backoff provides a simple exponential backoff mechanism

func NewBackoff

func NewBackoff(args ...time.Duration) *Backoff

NewBackoff accepts optional values for minimum and maximum wait period and return new instance of Backoff structure

func (*Backoff) Duration

func (b *Backoff) Duration() time.Duration

Duration can be used to get exponential backoff duration calculated for each new step

func (*Backoff) Reset

func (b *Backoff) Reset()

Reset sets step counter to zero.

func (*Backoff) Run

func (b *Backoff) Run(stopCh <-chan struct{}, fn RunFunc) error

Run is a blocking function that executes RunFunc until stopCh receives the value or function returns an error

type RunFunc

type RunFunc func(context.Context) (bool, error)

RunFunc is a user function that polls data from a source and sends it as a cloudevent to a sink. RunFunc must return (bool, error) values where bool is true if poll backoff duration must be reset and error is the result of function execution.

Jump to

Keyboard shortcuts

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