summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/throttled/throttled.v1/store.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-09-23 10:17:51 -0400
committerGitHub <noreply@github.com>2016-09-23 10:17:51 -0400
commit2ca0e8f9a0f9863555a26e984cde15efff9ef8f8 (patch)
treedaae1ee67b14a3d0a84424f2a304885d9e75ce2b /vendor/gopkg.in/throttled/throttled.v1/store.go
parent6d62d65b2dc85855aabea036cbd44f6059e19d13 (diff)
downloadchat-2ca0e8f9a0f9863555a26e984cde15efff9ef8f8.tar.gz
chat-2ca0e8f9a0f9863555a26e984cde15efff9ef8f8.tar.bz2
chat-2ca0e8f9a0f9863555a26e984cde15efff9ef8f8.zip
Updating golang dependancies (#4075)
Diffstat (limited to 'vendor/gopkg.in/throttled/throttled.v1/store.go')
-rw-r--r--vendor/gopkg.in/throttled/throttled.v1/store.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/vendor/gopkg.in/throttled/throttled.v1/store.go b/vendor/gopkg.in/throttled/throttled.v1/store.go
deleted file mode 100644
index 760fe2b69..000000000
--- a/vendor/gopkg.in/throttled/throttled.v1/store.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package throttled
-
-import (
- "errors"
- "time"
-)
-
-// The error returned if the key does not exist in the Store.
-var ErrNoSuchKey = errors.New("throttled: no such key")
-
-// Store is the interface to implement to store the RateLimit state (number
-// of requests per key, time-to-live or creation timestamp).
-type Store interface {
- // Incr increments the count for the specified key and returns the new value along
- // with the number of seconds remaining. It may return an error
- // if the operation fails.
- //
- // The method may return ErrNoSuchKey if the key to increment does not exist,
- // in which case Reset will be called to initialize the value.
- Incr(string, time.Duration) (int, int, error)
-
- // Reset resets the key to 1 with the specified window duration. It must create the
- // key if it doesn't exist. It returns an error if it fails.
- Reset(string, time.Duration) error
-}
-
-// RemainingSeconds is a helper function that returns the number of seconds
-// remaining from an absolute timestamp in UTC.
-func RemainingSeconds(ts time.Time, window time.Duration) int {
- return int((window - time.Now().UTC().Sub(ts)).Seconds())
-}