Documentation ¶
Index ¶
- Constants
- func BeginningOfDay(days int) time.Time
- func BeginningOfDayString(days int, layout string) string
- func EndOfDay(days int) time.Time
- func EndOfDayString(days int, layout string) string
- func Now() time.Time
- func NowString(layout string) string
- type EmptyExponentialBackOffOption
- type ExponentialBackOff
- func (o *ExponentialBackOff) ApplyOptions(options ...ExponentialBackOffOption) *ExponentialBackOff
- func (b *ExponentialBackOff) GetCurrentInterval() time.Duration
- func (b *ExponentialBackOff) GetElapsedTime() time.Duration
- func (b *ExponentialBackOff) NextBackOff() (time.Duration, bool)
- func (b *ExponentialBackOff) Reset()
- type ExponentialBackOffOption
- func WithExponentialBackOffOptionInitialInterval(initialInterval time.Duration) ExponentialBackOffOption
- func WithExponentialBackOffOptionMaxElapsedTime(maxElapsedTime time.Duration) ExponentialBackOffOption
- func WithExponentialBackOffOptionMaxInterval(maxInterval time.Duration) ExponentialBackOffOption
- func WithExponentialBackOffOptionMultiplier(multiplier float64) ExponentialBackOffOption
- func WithExponentialBackOffOptionRandomizationFactor(randomizationFactor float64) ExponentialBackOffOption
- type ExponentialBackOffOptionFunc
- type TimeCounter
Constants ¶
View Source
const ( DefaultInitialInterval = 500 * time.Millisecond DefaultRandomizationFactor = 0.5 // The default multiplier value used for increment current interval DefaultMultiplier = 1.5 DefaultMaxInterval = 60 * time.Second DefaultMaxElapsedTime = 15 * time.Minute )
Default values for ExponentialBackOff.
View Source
const ( DayFormat = "20060102" DefaultTimeFormat = "2006-01-02 15:04:05" DefaultTimeMsFormat = "2006-01-02 15:04:05.000" )
Variables ¶
This section is empty.
Functions ¶
func BeginningOfDay ¶ added in v0.0.7
func BeginningOfDayString ¶ added in v0.0.7
func EndOfDayString ¶ added in v0.0.7
Types ¶
type EmptyExponentialBackOffOption ¶ added in v0.0.6
type EmptyExponentialBackOffOption struct{}
EmptyExponentialBackOffUrlOption does not alter the ExponentialBackOffuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type ExponentialBackOff ¶ added in v0.0.6
type ExponentialBackOff struct {
// contains filtered or unexported fields
}
func NewExponentialBackOff ¶ added in v0.0.6
func NewExponentialBackOff(opts ...ExponentialBackOffOption) *ExponentialBackOff
func (*ExponentialBackOff) ApplyOptions ¶ added in v0.0.6
func (o *ExponentialBackOff) ApplyOptions(options ...ExponentialBackOffOption) *ExponentialBackOff
func (*ExponentialBackOff) GetCurrentInterval ¶ added in v0.0.6
func (b *ExponentialBackOff) GetCurrentInterval() time.Duration
func (*ExponentialBackOff) GetElapsedTime ¶ added in v0.0.6
func (b *ExponentialBackOff) GetElapsedTime() time.Duration
func (*ExponentialBackOff) NextBackOff ¶ added in v0.0.6
func (b *ExponentialBackOff) NextBackOff() (time.Duration, bool)
false : have gone over the maximu elapsed time true : return remaining time
func (*ExponentialBackOff) Reset ¶ added in v0.0.6
func (b *ExponentialBackOff) Reset()
type ExponentialBackOffOption ¶ added in v0.0.6
type ExponentialBackOffOption interface {
// contains filtered or unexported methods
}
A ExponentialBackOffOption sets options.
func WithExponentialBackOffOptionInitialInterval ¶ added in v0.0.6
func WithExponentialBackOffOptionInitialInterval(initialInterval time.Duration) ExponentialBackOffOption
func WithExponentialBackOffOptionMaxElapsedTime ¶ added in v0.0.6
func WithExponentialBackOffOptionMaxElapsedTime(maxElapsedTime time.Duration) ExponentialBackOffOption
func WithExponentialBackOffOptionMaxInterval ¶ added in v0.0.6
func WithExponentialBackOffOptionMaxInterval(maxInterval time.Duration) ExponentialBackOffOption
func WithExponentialBackOffOptionMultiplier ¶ added in v0.0.6
func WithExponentialBackOffOptionMultiplier(multiplier float64) ExponentialBackOffOption
func WithExponentialBackOffOptionRandomizationFactor ¶ added in v0.0.6
func WithExponentialBackOffOptionRandomizationFactor(randomizationFactor float64) ExponentialBackOffOption
type ExponentialBackOffOptionFunc ¶ added in v0.0.6
type ExponentialBackOffOptionFunc func(*ExponentialBackOff)
ExponentialBackOffOptionFunc wraps a function that modifies ExponentialBackOff into an implementation of the ExponentialBackOffOption interface.
type TimeCounter ¶
type TimeCounter struct {
// contains filtered or unexported fields
}
func New ¶
func New(effect bool) *TimeCounter
func (*TimeCounter) Reset ¶
func (t *TimeCounter) Reset()
func (*TimeCounter) String ¶
func (t *TimeCounter) String() string
func (*TimeCounter) Tick ¶
func (t *TimeCounter) Tick(msg string)
Click to show internal directories.
Click to hide internal directories.