lambdautils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LambdaMetaData

type LambdaMetaData struct {
	FunctionName    string
	FunctionVersion string
	LogGroupName    string
	LogStreamName   string
	MemoryLimitInMB int
	Context         *lambdacontext.LambdaContext
}

LambdaMetaData stored details about the current lambda context.

func GetLambdaMetaData

func GetLambdaMetaData(ctx context.Context) LambdaMetaData

GetLambdaMetaData returns MetaData extracted from the current lambda context.

type SNSLock

type SNSLock struct {
	Region    string `json:"region"`
	Table     string `json:"table"`
	TTL       int64  `json:"ttl"`
	RetryWait int64  `json:"retry-wait"`
	// contains filtered or unexported fields
}

SNSLock manages locking of sns messages using dynamodb. The SNS messages are locked using the hash of their message contents and the lock expires after the TTL (seconds) has expired.

RetryWait (milliseconds) is used to manage retry backoff times.

func NewSNSLock

func NewSNSLock(region string, table string, ttl int64, retry int64) *SNSLock

NewSNSLock returns a new sns lock instance to manage dynamodb locking

func NewSNSLockFromJson

func NewSNSLockFromJson(s string) (*SNSLock, error)

NewSNSLockFromJson returns a new sns lock instance to manage dynamodb locking

func (*SNSLock) Available

func (lock *SNSLock) Available(snsEvent events.SNSEvent) (bool, error)

Available returns true if the snsEvent is available for use (not locked) and it returns false if it is locked.

Locked is defined as the record being in the configured dynamodb table and not expires.

func (*SNSLock) AvailableById

func (lock *SNSLock) AvailableById(id string) (bool, error)

AvailableById returns true if the given id is available for use (not locked) and it returns false if it is locked.

Locked is defined as the record being in the configured dynamodb table and not expires.

Jump to

Keyboard shortcuts

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