strategy

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

README

strategy

import "github.com/carousell/Orion/utils/httptripper/strategy"

Overview

Package strategy provides strategies for use with retry

Imported Packages

No packages beyond the Go standard library are imported.

Index

Package files

strategy.go types.go

type Strategy

type Strategy interface {
    //WaitDuration takes attempt, maxRetry and request/response paramaetrs as input and gives out a duration as response
    WaitDuration(attempt, maxRetry int, req *http.Request, resp *http.Response, err error) time.Duration
}

Strategy is the interface requirement for any strategy implementation

func DefaultStrategy
func DefaultStrategy(duration time.Duration) Strategy

DefaultStrategy provides implementation for Fixed duration wait

func ExponentialStrategy
func ExponentialStrategy(duration time.Duration) Strategy

ExponentialStrategy provided implementation for exponentially (in powers of 2) growing wait duration


Generated by godoc2ghmd

Documentation

Overview

Package strategy provides strategies for use with retry

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy interface {
	//WaitDuration takes attempt, maxRetry and request/response paramaetrs as input and gives out a duration as response
	WaitDuration(attempt, maxRetry int, req *http.Request, resp *http.Response, err error) time.Duration
}

Strategy is the interface requirement for any strategy implementation

func DefaultStrategy

func DefaultStrategy(duration time.Duration) Strategy

DefaultStrategy provides implementation for Fixed duration wait

func ExponentialStrategy

func ExponentialStrategy(duration time.Duration) Strategy

ExponentialStrategy provided implementation for exponentially (in powers of 2) growing wait duration

Jump to

Keyboard shortcuts

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