common

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 10 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 EndpointResolver added in v1.12.0

func EndpointResolver(partition string, opts ...func(*endpoints.Options)) endpoints.Resolver

EndpointResolver returns a custom endpoints.Resolver which allows users to target API-compatible alternatives to the public AWS cloud.

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 returns a new instance of Backoff.

func (*Backoff) Duration

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

Duration returns the exponential backoff duration calculated for the current 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 a value or fn 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 the poll backoff duration must be reset, and error is the result of the function's execution.

Directories

Path Synopsis
Package controller contains helpers shared between controllers embedded in source adapters.
Package controller contains helpers shared between controllers embedded in source adapters.
Package env allows propagating runtime configurations via the environment.
Package env allows propagating runtime configurations via the environment.
Package health contains helpers to enable HTTP health checking.
Package health contains helpers to enable HTTP health checking.

Jump to

Keyboard shortcuts

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