aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/segmentio
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2018-10-19 06:58:02 -0700
committerChristine Dodrill <me@christine.website>2018-10-19 06:58:35 -0700
commitd2ff4407993e4511e0225c12964bc07cd8d02be6 (patch)
tree1ca621c635b568054bf8808306cf4b6baa9cfedf /vendor/github.com/segmentio
parentf363c7e7eb6ca43e92624365ceab66a78d99b376 (diff)
downloadxesite-d2ff4407993e4511e0225c12964bc07cd8d02be6.tar.xz
xesite-d2ff4407993e4511e0225c12964bc07cd8d02be6.zip
use GOPROXY
Diffstat (limited to 'vendor/github.com/segmentio')
-rw-r--r--vendor/github.com/segmentio/backo-go/.gitmodules3
-rw-r--r--vendor/github.com/segmentio/backo-go/README.md80
-rw-r--r--vendor/github.com/segmentio/backo-go/backo.go83
3 files changed, 0 insertions, 166 deletions
diff --git a/vendor/github.com/segmentio/backo-go/.gitmodules b/vendor/github.com/segmentio/backo-go/.gitmodules
deleted file mode 100644
index 36de929..0000000
--- a/vendor/github.com/segmentio/backo-go/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "vendor/github.com/bmizerany/assert"]
- path = vendor/github.com/bmizerany/assert
- url = https://github.com/bmizerany/assert
diff --git a/vendor/github.com/segmentio/backo-go/README.md b/vendor/github.com/segmentio/backo-go/README.md
deleted file mode 100644
index 1362bec..0000000
--- a/vendor/github.com/segmentio/backo-go/README.md
+++ /dev/null
@@ -1,80 +0,0 @@
-Backo [![GoDoc](http://godoc.org/github.com/segmentio/backo-go?status.png)](http://godoc.org/github.com/segmentio/backo-go)
------
-
-Exponential backoff for Go (Go port of segmentio/backo).
-
-
-Usage
------
-
-```go
-import "github.com/segmentio/backo-go"
-
-// Create a Backo instance.
-backo := backo.NewBacko(milliseconds(100), 2, 1, milliseconds(10*1000))
-// OR with defaults.
-backo := backo.DefaultBacko()
-
-// Use the ticker API.
-ticker := b.NewTicker()
-for {
- timeout := time.After(5 * time.Minute)
- select {
- case <-ticker.C:
- fmt.Println("ticked")
- case <- timeout:
- fmt.Println("timed out")
- }
-}
-
-// Or simply work with backoff intervals directly.
-for i := 0; i < n; i++ {
- // Sleep the current goroutine.
- backo.Sleep(i)
- // Retrieve the duration manually.
- duration := backo.Duration(i)
-}
-```
-
-License
--------
-
-```
-WWWWWW||WWWWWW
- W W W||W W W
- ||
- ( OO )__________
- / | \
- /o o| MIT \
- \___/||_||__||_|| *
- || || || ||
- _||_|| _||_||
- (__|__|(__|__|
-
-The MIT License (MIT)
-
-Copyright (c) 2015 Segment, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-```
-
-
-
- [1]: http://github.com/segmentio/backo-java
- [2]: http://repository.sonatype.org/service/local/artifact/maven/redirect?r=central-proxy&g=com.segment.backo&a=backo&v=LATEST \ No newline at end of file
diff --git a/vendor/github.com/segmentio/backo-go/backo.go b/vendor/github.com/segmentio/backo-go/backo.go
deleted file mode 100644
index 6f7b6d5..0000000
--- a/vendor/github.com/segmentio/backo-go/backo.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package backo
-
-import (
- "math"
- "math/rand"
- "time"
-)
-
-type Backo struct {
- base time.Duration
- factor uint8
- jitter float64
- cap time.Duration
-}
-
-// Creates a backo instance with the given parameters
-func NewBacko(base time.Duration, factor uint8, jitter float64, cap time.Duration) *Backo {
- return &Backo{base, factor, jitter, cap}
-}
-
-// Creates a backo instance with the following defaults:
-// base: 100 milliseconds
-// factor: 2
-// jitter: 0
-// cap: 10 seconds
-func DefaultBacko() *Backo {
- return NewBacko(time.Millisecond*100, 2, 0, time.Second*10)
-}
-
-// Duration returns the backoff interval for the given attempt.
-func (backo *Backo) Duration(attempt int) time.Duration {
- duration := float64(backo.base) * math.Pow(float64(backo.factor), float64(attempt))
-
- if backo.jitter != 0 {
- random := rand.Float64()
- deviation := math.Floor(random * backo.jitter * duration)
- if (int(math.Floor(random*10)) & 1) == 0 {
- duration = duration - deviation
- } else {
- duration = duration + deviation
- }
- }
-
- duration = math.Min(float64(duration), float64(backo.cap))
- return time.Duration(duration)
-}
-
-// Sleep pauses the current goroutine for the backoff interval for the given attempt.
-func (backo *Backo) Sleep(attempt int) {
- duration := backo.Duration(attempt)
- time.Sleep(duration)
-}
-
-type Ticker struct {
- done chan struct{}
- C <-chan time.Time
-}
-
-func (b *Backo) NewTicker() *Ticker {
- c := make(chan time.Time, 1)
- ticker := &Ticker{
- done: make(chan struct{}, 1),
- C: c,
- }
-
- go func() {
- for i := 0; ; i++ {
- select {
- case t := <-time.After(b.Duration(i)):
- c <- t
- case <-ticker.done:
- close(c)
- return
- }
- }
- }()
-
- return ticker
-}
-
-func (t *Ticker) Stop() {
- t.done <- struct{}{}
-}