blacklist

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackoffFn

type BackoffFn func(uint64) time.Duration

BackoffFn defines a function that calculates the duration after which an endpoint is removed from the blacklist, based on the provided number of failures.

func ConstantBackoff

func ConstantBackoff(d time.Duration) BackoffFn

ConstantBackoff creates a BackoffFn that always returns the provided duration.

func LinearBackoff

func LinearBackoff(index uint64, lower time.Duration, count uint64, upper time.Duration) BackoffFn

LinearBackoff creates a BackoffFn that raises the returned duration after some failures from the provided lower to upper bound.

type Filter

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

Filter implements a blacklist filter.

func NewFilter

func NewFilter(boFn BackoffFn) *Filter

NewFilter returns a new blacklist filter.

func (*Filter) Failure

func (f *Filter) Failure(endpoint value.Endpoint) error

Failure signals the filter that the provided endpoint failed.

func (*Filter) Filter

func (f *Filter) Filter(endpoints value.Endpoints) (value.Endpoints, error)

Filter filters the provided endpoints and returns the result.

func (*Filter) Success

func (f *Filter) Success(endpoint value.Endpoint) error

Success signals the filter that the provided endpoint succeeded.

Jump to

Keyboard shortcuts

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