-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pdp: Support arbitrary hash funcs in uploads
- Loading branch information
Showing
10 changed files
with
443 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package taskhelp | ||
|
||
import ( | ||
"math" | ||
"time" | ||
) | ||
|
||
type RetryWaitFunc func(retries int) time.Duration | ||
|
||
// RetryWaitLinear returns a function that calculates a linearly increasing duration based on retries. | ||
func RetryWaitLinear(initial, increment time.Duration) RetryWaitFunc { | ||
return func(retries int) time.Duration { | ||
return initial + time.Duration(retries)*increment | ||
} | ||
} | ||
|
||
// RetryWaitExp returns a function that calculates an exponentially increasing duration based on retries. | ||
func RetryWaitExp(initial time.Duration, factor float64) RetryWaitFunc { | ||
return func(retries int) time.Duration { | ||
return time.Duration(float64(initial) * math.Pow(factor, float64(retries))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.