deduplication

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package deduplication provides middleware for FIFO queue handler.

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingDeduplicationID = errors.New("deduplication id is missing")

ErrMissingDeduplicationID is returned when the deduplication ID is missing from the message attributes.

Functions

This section is empty.

Types

type FifoDeduplicationMiddleware

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

FifoDeduplicationMiddleware is a middleware that provides FIFO deduplication for messages.

func FifoMiddleware

func FifoMiddleware(next xsqs.Handler[*sqs.Message], storage Storage) FifoDeduplicationMiddleware

FifoMiddleware creates and returns a new instance of the FifoDeduplicationMiddleware.

func (FifoDeduplicationMiddleware) Handle

func (middleware FifoDeduplicationMiddleware) Handle(ctx context.Context, message *sqs.Message) error

Handle handles the SQS message and provides deduplication logic.

type Storage

type Storage interface {
	Save(ctx context.Context, deduplicationID string) error
	Exists(ctx context.Context, deduplicationID string) (bool, error)
}

Storage is an interface for deduplication storage.

func NewDynamoDB

func NewDynamoDB(db dynamodbiface.DynamoDBAPI, table string, ttl time.Duration) Storage

NewDynamoDB creates a new DynamoDB instance for deduplication storage. It takes a DynamoDBAPI instance, table name, and TTL duration as input and returns the created Storage instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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