retries

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const RetryStages = 3

Variables

This section is empty.

Functions

func Segregate

func Segregate(list []RetryID, isDoneFn func(RetryID) RetryState) (keepCount, removeStart int)

Types

type RetryID

type RetryID uint64

type RetryState

type RetryState uint8
const (
	KeepRetrying RetryState = iota
	StopRetrying
	RemoveCompletely
)

type RetryStrategy

type RetryStrategy interface {
	// Retry initiates resend for the given ids.
	// When id was resent and is still valid, it should be returned back by calling (repeatFn).
	// When some ids were not resent, then these should be returned back by calling (bulkOverflowFn).
	Retry(ids []RetryID, repeatFn func(RetryID), bulkOverflowFn func([]RetryID))
	CheckState(RetryID) RetryState
	Remove([]RetryID)
}

type StagedController

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

func (*StagedController) Add

func (p *StagedController) Add(id RetryID, weight uint, strategy RetryStrategy)

func (*StagedController) AddHeadForRetry

func (p *StagedController) AddHeadForRetry(id RetryID)

func (*StagedController) InitStages

func (p *StagedController) InitStages(minHeadBatchWeight uint, periods [RetryStages]int)

for initialization only

func (*StagedController) NextCycle

func (p *StagedController) NextCycle(strategy RetryStrategy)

Jump to

Keyboard shortcuts

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