throttle

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeleteTickerPeriod   = time.Hour * 1
	GlobalSecondaryIndex = "TypeExpiredIndex"
	DeleteCapacityRate   = 5
)

Throttole const

Variables

View Source
var (
	ErrDuplicatedMessage = errors.New("duplicated message id")
)

throttle errors

Functions

func DeleteTicker

func DeleteTicker(ctx context.Context, dt *DynamodbThrottle)

DeleteTicker delete items of the previous day every hour

Types

type DefaultThrottler

type DefaultThrottler struct{}

DefaultThrottler do nothing

func (DefaultThrottler) Set

func (dl DefaultThrottler) Set(k string) error

Set DefaultThrotter

func (DefaultThrottler) Unset

func (dl DefaultThrottler) Unset(k string) error

Unset DefaultThrotter

type DynamodbThrottle

type DynamodbThrottle struct {
	TableName       string
	Dynamodb        *dynamodb.DynamoDB
	RetentionPeriod time.Duration
}

DynamodbThrottle struct

func (DynamodbThrottle) GetExpiredItems

func (dt DynamodbThrottle) GetExpiredItems() (*dynamodb.QueryOutput, error)

GetExpiredItems get items expired already.

func (*DynamodbThrottle) GetWriteCapacity

func (dt *DynamodbThrottle) GetWriteCapacity() (int64, error)

GetWriteCapacity get the table of write capacity unit.

func (DynamodbThrottle) Set

func (dt DynamodbThrottle) Set(jobid string) error

Set check double message

func (DynamodbThrottle) Unset

func (dt DynamodbThrottle) Unset(jobid string) error

Unset delete record from dynamodb

type Throttler

type Throttler interface {
	Set(id string) error
	Unset(id string) error
}

Throttler struct

func NewDynamodbThrottle

func NewDynamodbThrottle(ctx context.Context, profile, region, table string, retention time.Duration) Throttler

NewDynamodbThrottle build DynamodbThrottle

Jump to

Keyboard shortcuts

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