Documentation
¶
Index ¶
- Constants
- Variables
- func AttemptRepeatedly(name string, attempt AttemptFunc) int
- func Done(src, dst addr.IA)
- func InitTracer(name string) (func(), error)
- func LogFatal(msg string, a ...interface{})
- func RepeatUntilFail(name string, doit AttemptFunc) int
- func SDConn() daemon.Connector
- func Setup() error
- type AttemptFunc
Constants ¶
const ( ModeServer = "server" ModeClient = "client" DefaultIOTimeout = 1 * time.Second )
Variables ¶
Functions ¶
func AttemptRepeatedly ¶
func AttemptRepeatedly(name string, attempt AttemptFunc) int
AttemptRepeatedly runs attempt until it returns true (succeeded => stop) or more than Attempts were executed. Between two attempts at least RetryTimeout time has to pass. Returns 0 on success, 1 on failure.
func InitTracer ¶
InitTracer initializes the global tracer and returns a closer function.
func LogFatal ¶
func LogFatal(msg string, a ...interface{})
LogFatal logs a critical error and exits with 1
func RepeatUntilFail ¶ added in v0.10.0
func RepeatUntilFail(name string, doit AttemptFunc) int
RepeatUntilFail runs doit() until it returns true (failed -> stop) or more than Attempts were executed. There is no delay nor logging between attempts. Returns 0 if all Attempts succeeded, 1 on failure. This is very similar to AttemptRepeatedly, but difference in failure/success behaviour justify a different function: parameter-based tweaks would be easily confusing.
Types ¶
type AttemptFunc ¶
AttemptFunc attempts a request repeatedly, receives the attempt number