Documentation ¶
Index ¶
- Constants
- func Until(ctx context.Context, acceptor Acceptor) (bool, interface{}, error)
- func UntilDeadline(ctx context.Context, acceptor Acceptor, deadline time.Time) (bool, interface{}, error)
- func UntilTimeout(ctx context.Context, acceptor Acceptor, timeout time.Duration) (bool, interface{}, error)
- type Acceptance
- type Acceptor
Constants ¶
const ( DefaultDelay time.Duration = 100 * time.Millisecond // by default, delay by 100ms DefaultBackoff float64 = 1.5 // by default, backoff by 1.5x DefaultMaxDelay time.Duration = 5 * time.Second // by default, no more than 5 seconds )
Variables ¶
This section is empty.
Functions ¶
func Until ¶
Until waits until the acceptor accepts the current condition, or the context expires, whichever comes first. A return boolean of true means the acceptor eventually accepted; a non-nil error means the acceptor returned an error. If an acceptor accepts a condition after the context has expired, we ignore the expiration and return the condition.
Types ¶
type Acceptance ¶
Acceptance is meant to accept a condition. It returns true when this condition has succeeded, and false otherwise (to which the retry framework responds by waiting and retrying after a certain period of time). If a non-nil error is returned, retrying halts. The interface{} data may be used to return final values to the caller.