File: interface.go

package info (click to toggle)
golang-github-lestrrat-go-backoff 2.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 200 kB
  • sloc: makefile: 2
file content (30 lines) | stat: -rw-r--r-- 534 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package backoff

import (
	"context"
	"time"

	"github.com/lestrrat-go/option"
)

type Option = option.Interface

type Controller interface {
	Done() <-chan struct{}
	Next() <-chan struct{}
}

type IntervalGenerator interface {
	Next() time.Duration
}

// Policy is an interface for the backoff policies that this package
// implements. Users must create a controller object from this
// policy to actually do anything with it
type Policy interface {
	Start(context.Context) Controller
}

type Random interface {
	Float64() float64
}