You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2017/01/13 23:36:16 UTC
[20/29] incubator-trafficcontrol git commit: Update vendor going more
thoroughly through deps recursively... some cleanup may be called for in a
follow up PR
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE b/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE
new file mode 100644
index 0000000..e44c4cc
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/errgo.v1/LICENSE
@@ -0,0 +1,26 @@
+Copyright � 2013, Roger Peppe
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of this project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/errgo.v1/README.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/errgo.v1/README.md b/traffic_stats/vendor/gopkg.in/errgo.v1/README.md
new file mode 100644
index 0000000..49e1c15
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/errgo.v1/README.md
@@ -0,0 +1,259 @@
+# errgo
+--
+ import "gopkg.in/errgo.v1"
+
+The errgo package provides a way to create and diagnose errors. It is compatible
+with the usual Go error idioms but adds a way to wrap errors so that they record
+source location information while retaining a consistent way for code to inspect
+errors to find out particular problems.
+
+## Usage
+
+#### func Any
+
+```go
+func Any(error) bool
+```
+Any returns true. It can be used as an argument to Mask to allow any diagnosis
+to pass through to the wrapped error.
+
+#### func Cause
+
+```go
+func Cause(err error) error
+```
+Cause returns the cause of the given error. If err does not implement Causer or
+its Cause method returns nil, it returns err itself.
+
+Cause is the usual way to diagnose errors that may have been wrapped by Mask or
+NoteMask.
+
+#### func Details
+
+```go
+func Details(err error) string
+```
+Details returns information about the stack of underlying errors wrapped by err,
+in the format:
+
+ [{filename:99: error one} {otherfile:55: cause of error one}]
+
+The details are found by type-asserting the error to the Locationer, Causer and
+Wrapper interfaces. Details of the underlying stack are found by recursively
+calling Underlying when the underlying error implements Wrapper.
+
+#### func Is
+
+```go
+func Is(err error) func(error) bool
+```
+Is returns a function that returns whether the an error is equal to the given
+error. It is intended to be used as a "pass" argument to Mask and friends; for
+example:
+
+ return errgo.Mask(err, errgo.Is(http.ErrNoCookie))
+
+would return an error with an http.ErrNoCookie cause only if that was err's
+diagnosis; otherwise the diagnosis would be itself.
+
+#### func Mask
+
+```go
+func Mask(underlying error, pass ...func(error) bool) error
+```
+Mask returns an Err that wraps the given underyling error. The error message is
+unchanged, but the error location records the caller of Mask.
+
+If err is nil, Mask returns nil.
+
+By default Mask conceals the cause of the wrapped error, but if pass(Cause(err))
+returns true for any of the provided pass functions, the cause of the returned
+error will be Cause(err).
+
+For example, the following code will return an error whose cause is the error
+from the os.Open call when (and only when) the file does not exist.
+
+ f, err := os.Open("non-existent-file")
+ if err != nil {
+ return errgo.Mask(err, os.IsNotExist)
+ }
+
+In order to add context to returned errors, it is conventional to call Mask when
+returning any error received from elsewhere.
+
+#### func MaskFunc
+
+```go
+func MaskFunc(allow ...func(error) bool) func(error, ...func(error) bool) error
+```
+MaskFunc returns an equivalent of Mask that always allows the specified causes
+in addition to any causes specified when the returned function is called.
+
+It is defined for convenience, for example when all calls to Mask in a given
+package wish to allow the same set of causes to be returned.
+
+#### func New
+
+```go
+func New(s string) error
+```
+New returns a new error with the given error message and no cause. It is a
+drop-in replacement for errors.New from the standard library.
+
+#### func Newf
+
+```go
+func Newf(f string, a ...interface{}) error
+```
+Newf returns a new error with the given printf-formatted error message and no
+cause.
+
+#### func NoteMask
+
+```go
+func NoteMask(underlying error, msg string, pass ...func(error) bool) error
+```
+NoteMask returns an Err that has the given underlying error, with the given
+message added as context, and allowing the cause of the underlying error to pass
+through into the result if allowed by the specific pass functions (see Mask for
+an explanation of the pass parameter).
+
+#### func Notef
+
+```go
+func Notef(underlying error, f string, a ...interface{}) error
+```
+Notef returns an Error that wraps the given underlying error and adds the given
+formatted context message. The returned error has no cause (use NoteMask or
+WithCausef to add a message while retaining a cause).
+
+#### func WithCausef
+
+```go
+func WithCausef(underlying, cause error, f string, a ...interface{}) error
+```
+WithCausef returns a new Error that wraps the given (possibly nil) underlying
+error and associates it with the given cause. The given formatted message
+context will also be added.
+
+#### type Causer
+
+```go
+type Causer interface {
+ Cause() error
+}
+```
+
+Causer is the type of an error that may provide an error cause for error
+diagnosis. Cause may return nil if there is no cause (for example because the
+cause has been masked).
+
+#### type Err
+
+```go
+type Err struct {
+ // Message_ holds the text of the error message. It may be empty
+ // if Underlying is set.
+ Message_ string
+
+ // Cause_ holds the cause of the error as returned
+ // by the Cause method.
+ Cause_ error
+
+ // Underlying holds the underlying error, if any.
+ Underlying_ error
+
+ // File and Line identify the source code location where the error was
+ // created.
+ File string
+ Line int
+}
+```
+
+Err holds a description of an error along with information about where the error
+was created.
+
+It may be embedded in custom error types to add extra information that this
+errors package can understand.
+
+#### func (*Err) Cause
+
+```go
+func (e *Err) Cause() error
+```
+Cause implements Causer.
+
+#### func (*Err) Error
+
+```go
+func (e *Err) Error() string
+```
+Error implements error.Error.
+
+#### func (*Err) GoString
+
+```go
+func (e *Err) GoString() string
+```
+GoString returns the details of the receiving error message, so that printing an
+error with %#v will produce useful information.
+
+#### func (*Err) Location
+
+```go
+func (e *Err) Location() (file string, line int)
+```
+Location implements Locationer.
+
+#### func (*Err) Message
+
+```go
+func (e *Err) Message() string
+```
+Message returns the top level error message.
+
+#### func (*Err) SetLocation
+
+```go
+func (e *Err) SetLocation(callDepth int)
+```
+Locate records the source location of the error by setting e.Location, at
+callDepth stack frames above the call.
+
+#### func (*Err) Underlying
+
+```go
+func (e *Err) Underlying() error
+```
+Underlying returns the underlying error if any.
+
+#### type Locationer
+
+```go
+type Locationer interface {
+ // Location returns the name of the file and the line
+ // number associated with an error.
+ Location() (file string, line int)
+}
+```
+
+Locationer can be implemented by any error type that wants to expose the source
+location of an error.
+
+#### type Wrapper
+
+```go
+type Wrapper interface {
+ // Message returns the top level error message,
+ // not including the message from the underlying
+ // error.
+ Message() string
+
+ // Underlying returns the underlying error, or nil
+ // if there is none.
+ Underlying() error
+}
+```
+
+Wrapper is the type of an error that wraps another error. It is exposed so that
+external types may implement it, but should in general not be used otherwise.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go b/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go
new file mode 100644
index 0000000..a1f2308
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/errgo.v1/errors.go
@@ -0,0 +1,389 @@
+// Copyright 2014 Roger Peppe.
+// See LICENCE file for details.
+
+// The errgo package provides a way to create
+// and diagnose errors. It is compatible with
+// the usual Go error idioms but adds a way to wrap errors
+// so that they record source location information
+// while retaining a consistent way for code to
+// inspect errors to find out particular problems.
+//
+package errgo
+
+import (
+ "bytes"
+ "fmt"
+ "log"
+ "runtime"
+)
+
+const debug = false
+
+// Err holds a description of an error along with information about
+// where the error was created.
+//
+// It may be embedded in custom error types to add
+// extra information that this errors package can
+// understand.
+type Err struct {
+ // Message_ holds the text of the error message. It may be empty
+ // if Underlying is set.
+ Message_ string
+
+ // Cause_ holds the cause of the error as returned
+ // by the Cause method.
+ Cause_ error
+
+ // Underlying holds the underlying error, if any.
+ Underlying_ error
+
+ // File and Line identify the source code location where the error was
+ // created.
+ File string
+ Line int
+}
+
+// Location implements Locationer.
+func (e *Err) Location() (file string, line int) {
+ return e.File, e.Line
+}
+
+// Underlying returns the underlying error if any.
+func (e *Err) Underlying() error {
+ return e.Underlying_
+}
+
+// Cause implements Causer.
+func (e *Err) Cause() error {
+ return e.Cause_
+}
+
+// Message returns the top level error message.
+func (e *Err) Message() string {
+ return e.Message_
+}
+
+// Error implements error.Error.
+func (e *Err) Error() string {
+ switch {
+ case e.Message_ == "" && e.Underlying_ == nil:
+ return "<no error>"
+ case e.Message_ == "":
+ return e.Underlying_.Error()
+ case e.Underlying_ == nil:
+ return e.Message_
+ }
+ return fmt.Sprintf("%s: %v", e.Message_, e.Underlying_)
+}
+
+// GoString returns the details of the receiving error
+// message, so that printing an error with %#v will
+// produce useful information.
+func (e *Err) GoString() string {
+ return Details(e)
+}
+
+// Causer is the type of an error that may provide
+// an error cause for error diagnosis. Cause may return
+// nil if there is no cause (for example because the
+// cause has been masked).
+type Causer interface {
+ Cause() error
+}
+
+// Wrapper is the type of an error that wraps another error. It is
+// exposed so that external types may implement it, but should in
+// general not be used otherwise.
+type Wrapper interface {
+ // Message returns the top level error message,
+ // not including the message from the underlying
+ // error.
+ Message() string
+
+ // Underlying returns the underlying error, or nil
+ // if there is none.
+ Underlying() error
+}
+
+// Locationer can be implemented by any error type
+// that wants to expose the source location of an error.
+type Locationer interface {
+ // Location returns the name of the file and the line
+ // number associated with an error.
+ Location() (file string, line int)
+}
+
+// Details returns information about the stack of
+// underlying errors wrapped by err, in the format:
+//
+// [{filename:99: error one} {otherfile:55: cause of error one}]
+//
+// The details are found by type-asserting the error to
+// the Locationer, Causer and Wrapper interfaces.
+// Details of the underlying stack are found by
+// recursively calling Underlying when the
+// underlying error implements Wrapper.
+func Details(err error) string {
+ if err == nil {
+ return "[]"
+ }
+ var s []byte
+ s = append(s, '[')
+ for {
+ s = append(s, '{')
+ if err, ok := err.(Locationer); ok {
+ file, line := err.Location()
+ if file != "" {
+ s = append(s, fmt.Sprintf("%s:%d", file, line)...)
+ s = append(s, ": "...)
+ }
+ }
+ if cerr, ok := err.(Wrapper); ok {
+ s = append(s, cerr.Message()...)
+ err = cerr.Underlying()
+ } else {
+ s = append(s, err.Error()...)
+ err = nil
+ }
+ if debug {
+ if err, ok := err.(Causer); ok {
+ if cause := err.Cause(); cause != nil {
+ s = append(s, fmt.Sprintf("=%T", cause)...)
+ s = append(s, Details(cause)...)
+ }
+ }
+ }
+ s = append(s, '}')
+ if err == nil {
+ break
+ }
+ s = append(s, ' ')
+ }
+ s = append(s, ']')
+ return string(s)
+}
+
+// Locate records the source location of the error by setting
+// e.Location, at callDepth stack frames above the call.
+func (e *Err) SetLocation(callDepth int) {
+ _, file, line, _ := runtime.Caller(callDepth + 1)
+ e.File, e.Line = file, line
+}
+
+func setLocation(err error, callDepth int) {
+ if e, _ := err.(*Err); e != nil {
+ e.SetLocation(callDepth + 1)
+ }
+}
+
+// New returns a new error with the given error message and no cause. It
+// is a drop-in replacement for errors.New from the standard library.
+func New(s string) error {
+ err := &Err{Message_: s}
+ err.SetLocation(1)
+ return err
+}
+
+// Newf returns a new error with the given printf-formatted error
+// message and no cause.
+func Newf(f string, a ...interface{}) error {
+ err := &Err{Message_: fmt.Sprintf(f, a...)}
+ err.SetLocation(1)
+ return err
+}
+
+// match returns whether any of the given
+// functions returns true when called with err as an
+// argument.
+func match(err error, pass ...func(error) bool) bool {
+ for _, f := range pass {
+ if f(err) {
+ return true
+ }
+ }
+ return false
+}
+
+// Is returns a function that returns whether the
+// an error is equal to the given error.
+// It is intended to be used as a "pass" argument
+// to Mask and friends; for example:
+//
+// return errgo.Mask(err, errgo.Is(http.ErrNoCookie))
+//
+// would return an error with an http.ErrNoCookie cause
+// only if that was err's diagnosis; otherwise the diagnosis
+// would be itself.
+func Is(err error) func(error) bool {
+ return func(err1 error) bool {
+ return err == err1
+ }
+}
+
+// Any returns true. It can be used as an argument to Mask
+// to allow any diagnosis to pass through to the wrapped
+// error.
+func Any(error) bool {
+ return true
+}
+
+// NoteMask returns an Err that has the given underlying error,
+// with the given message added as context, and allowing
+// the cause of the underlying error to pass through into
+// the result if allowed by the specific pass functions
+// (see Mask for an explanation of the pass parameter).
+func NoteMask(underlying error, msg string, pass ...func(error) bool) error {
+ err := noteMask(underlying, msg, pass...)
+ setLocation(err, 1)
+ return err
+}
+
+// noteMask is exactly like NoteMask except it doesn't set the location
+// of the returned error, so that we can avoid setting it twice
+// when it's used in other functions.
+func noteMask(underlying error, msg string, pass ...func(error) bool) error {
+ newErr := &Err{
+ Underlying_: underlying,
+ Message_: msg,
+ }
+ if len(pass) > 0 {
+ if cause := Cause(underlying); match(cause, pass...) {
+ newErr.Cause_ = cause
+ }
+ }
+ if debug {
+ if newd, oldd := newErr.Cause_, Cause(underlying); newd != oldd {
+ log.Printf("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
+ log.Printf("call stack: %s", callers(0, 20))
+ log.Printf("len(allow) == %d", len(pass))
+ log.Printf("old error %#v", underlying)
+ log.Printf("new error %#v", newErr)
+ }
+ }
+ newErr.SetLocation(1)
+ return newErr
+}
+
+// Mask returns an Err that wraps the given underyling error. The error
+// message is unchanged, but the error location records the caller of
+// Mask.
+//
+// If err is nil, Mask returns nil.
+//
+// By default Mask conceals the cause of the wrapped error, but if
+// pass(Cause(err)) returns true for any of the provided pass functions,
+// the cause of the returned error will be Cause(err).
+//
+// For example, the following code will return an error whose cause is
+// the error from the os.Open call when (and only when) the file does
+// not exist.
+//
+// f, err := os.Open("non-existent-file")
+// if err != nil {
+// return errgo.Mask(err, os.IsNotExist)
+// }
+//
+// In order to add context to returned errors, it
+// is conventional to call Mask when returning any
+// error received from elsewhere.
+//
+func Mask(underlying error, pass ...func(error) bool) error {
+ if underlying == nil {
+ return nil
+ }
+ err := noteMask(underlying, "", pass...)
+ setLocation(err, 1)
+ return err
+}
+
+// Notef returns an Error that wraps the given underlying
+// error and adds the given formatted context message.
+// The returned error has no cause (use NoteMask
+// or WithCausef to add a message while retaining a cause).
+func Notef(underlying error, f string, a ...interface{}) error {
+ err := noteMask(underlying, fmt.Sprintf(f, a...))
+ setLocation(err, 1)
+ return err
+}
+
+// MaskFunc returns an equivalent of Mask that always allows the
+// specified causes in addition to any causes specified when the
+// returned function is called.
+//
+// It is defined for convenience, for example when all calls to Mask in
+// a given package wish to allow the same set of causes to be returned.
+func MaskFunc(allow ...func(error) bool) func(error, ...func(error) bool) error {
+ return func(err error, allow1 ...func(error) bool) error {
+ var allowEither []func(error) bool
+ if len(allow1) > 0 {
+ // This is more efficient than using a function literal,
+ // because the compiler knows that it doesn't escape.
+ allowEither = make([]func(error) bool, len(allow)+len(allow1))
+ copy(allowEither, allow)
+ copy(allowEither[len(allow):], allow1)
+ } else {
+ allowEither = allow
+ }
+ err = Mask(err, allowEither...)
+ setLocation(err, 1)
+ return err
+ }
+}
+
+// WithCausef returns a new Error that wraps the given
+// (possibly nil) underlying error and associates it with
+// the given cause. The given formatted message context
+// will also be added. If underlying is nil and f is empty and has no arguments,
+// the message will be the same as the cause.
+func WithCausef(underlying, cause error, f string, a ...interface{}) error {
+ var msg string
+ if underlying == nil && f == "" && len(a) == 0 && cause != nil {
+ msg = cause.Error()
+ } else {
+ msg = fmt.Sprintf(f, a...)
+ }
+ err := &Err{
+ Underlying_: underlying,
+ Cause_: cause,
+ Message_: msg,
+ }
+ err.SetLocation(1)
+ return err
+}
+
+// Cause returns the cause of the given error. If err does not
+// implement Causer or its Cause method returns nil, it returns err itself.
+//
+// Cause is the usual way to diagnose errors that may have
+// been wrapped by Mask or NoteMask.
+func Cause(err error) error {
+ var diag error
+ if err, ok := err.(Causer); ok {
+ diag = err.Cause()
+ }
+ if diag != nil {
+ return diag
+ }
+ return err
+}
+
+// callers returns the stack trace of the goroutine that called it,
+// starting n entries above the caller of callers, as a space-separated list
+// of filename:line-number pairs with no new lines.
+func callers(n, max int) []byte {
+ var b bytes.Buffer
+ prev := false
+ for i := 0; i < max; i++ {
+ _, file, line, ok := runtime.Caller(n + 1)
+ if !ok {
+ return b.Bytes()
+ }
+ if prev {
+ fmt.Fprintf(&b, " ")
+ }
+ fmt.Fprintf(&b, "%s:%d", file, line)
+ n++
+ prev = true
+ }
+ return b.Bytes()
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE b/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE
new file mode 100644
index 0000000..f9bb84d
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/LICENSE
@@ -0,0 +1,186 @@
+Copyright (C) 2011-2015 Canonical Ltd.
+This software is licensed under the LGPLv3, included below.
+
+As a special exception to the GNU Lesser General Public License version 3
+("LGPL3"), the copyright holders of this Library give you permission to
+convey to a third party a Combined Work that links statically or dynamically
+to this Library without providing any Minimal Corresponding Source or
+Minimal Application Code as set out in 4d or providing the installation
+information set out in section 4e, provided that you comply with the other
+provisions of LGPL3 and provided that you meet, for the Application the
+terms and conditions of the license(s) which apply to the Application.
+
+Except as stated in this special exception, the provisions of LGPL3 will
+continue to comply in full to this Library. If you modify this Library, you
+may apply this exception to your version of this Library, but you are not
+obliged to do so. If you do not wish to do so, delete this exception
+statement from your version. This exception does not (and cannot) modify any
+license terms which apply to the Application, with which you must still
+comply.
+
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/README.md
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/README.md b/traffic_stats/vendor/gopkg.in/retry.v1/README.md
new file mode 100644
index 0000000..885a6a6
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/README.md
@@ -0,0 +1,202 @@
+# retry
+--
+ import "gopkg.in/retry.v1"
+
+Package retry provides a framework for retrying actions. It does not itself
+invoke the action to be retried, but is intended to be used in a retry loop.
+
+The basic usage is as follows:
+
+ for a := someStrategy.Start(); a.Next(); {
+ try()
+ }
+
+See examples for details of suggested usage.
+
+## Usage
+
+#### type Attempt
+
+```go
+type Attempt struct {
+}
+```
+
+Attempt represents a running retry attempt.
+
+#### func Start
+
+```go
+func Start(strategy Strategy, clk Clock) *Attempt
+```
+Start begins a new sequence of attempts for the given strategy using the given
+Clock implementation for time keeping. If clk is nil, the time package will be
+used to keep time.
+
+#### func StartWithCancel
+
+```go
+func StartWithCancel(strategy Strategy, clk Clock, stop <-chan struct{}) *Attempt
+```
+StartWithCancel is like Start except that if a value is received on stop while
+waiting, the attempt will be aborted.
+
+#### func (*Attempt) Count
+
+```go
+func (a *Attempt) Count() int
+```
+Count returns the current attempt count number, starting at 1. It returns 0 if
+called before Next is called. When the loop has terminated, it holds the total
+number of retries made.
+
+#### func (*Attempt) More
+
+```go
+func (a *Attempt) More() bool
+```
+More reports whether there are more retry attempts to be made. It does not
+sleep.
+
+If More returns false, Next will return false. If More returns true, Next will
+return true except when the attempt has been explicitly stopped via the stop
+channel.
+
+#### func (*Attempt) Next
+
+```go
+func (a *Attempt) Next() bool
+```
+Next reports whether another attempt should be made, waiting as necessary until
+it's time for the attempt. It always returns true the first time it is called
+unless a value is received on the stop channel - we are guaranteed to make at
+least one attempt unless stopped.
+
+#### func (*Attempt) Stopped
+
+```go
+func (a *Attempt) Stopped() bool
+```
+Stopped reports whether the attempt has terminated because a value was received
+on the stop channel.
+
+#### type Clock
+
+```go
+type Clock interface {
+ Now() time.Time
+ After(time.Duration) <-chan time.Time
+}
+```
+
+Clock represents a virtual clock interface that can be replaced for testing.
+
+#### type Exponential
+
+```go
+type Exponential struct {
+ // Initial holds the initial delay.
+ Initial time.Duration
+ // Factor holds the factor that the delay time will be multiplied
+ // by on each iteration.
+ Factor float64
+ // MaxDelay holds the maximum delay between the start
+ // of attempts. If this is zero, there is no maximum delay.
+ MaxDelay time.Duration
+}
+```
+
+Exponential represents an exponential backoff retry strategy. To limit the
+number of attempts or their overall duration, wrap this in LimitCount or
+LimitDuration.
+
+#### func (Exponential) NewTimer
+
+```go
+func (r Exponential) NewTimer(now time.Time) Timer
+```
+NewTimer implements Strategy.NewTimer.
+
+#### type Regular
+
+```go
+type Regular struct {
+ // Total specifies the total duration of the attempt.
+ Total time.Duration
+
+ // Delay specifies the interval between the start of each try
+ // in the burst. If an try takes longer than Delay, the
+ // next try will happen immediately.
+ Delay time.Duration
+
+ // Min holds the minimum number of retries. It overrides Total.
+ // To limit the maximum number of retries, use LimitCount.
+ Min int
+}
+```
+
+Regular represents a strategy that repeats at regular intervals.
+
+#### func (Regular) NewTimer
+
+```go
+func (r Regular) NewTimer(now time.Time) Timer
+```
+NewTimer implements Strategy.NewTimer.
+
+#### func (Regular) Start
+
+```go
+func (r Regular) Start(clk Clock) *Attempt
+```
+Start is short for Start(r, clk, nil)
+
+#### type Strategy
+
+```go
+type Strategy interface {
+ // NewTimer is called when the strategy is started - it is
+ // called with the time that the strategy is started and returns
+ // an object that is used to find out how long to sleep before
+ // each retry attempt.
+ NewTimer(now time.Time) Timer
+}
+```
+
+Strategy is implemented by types that represent a retry strategy.
+
+Note: You probably won't need to implement a new strategy - the existing types
+and functions are intended to be sufficient for most purposes.
+
+#### func LimitCount
+
+```go
+func LimitCount(n int, strategy Strategy) Strategy
+```
+LimitCount limits the number of attempts that the given strategy will perform to
+n. Note that all strategies will allow at least one attempt.
+
+#### func LimitTime
+
+```go
+func LimitTime(limit time.Duration, strategy Strategy) Strategy
+```
+LimitTime limits the given strategy such that no attempt will made after the
+given duration has elapsed.
+
+#### type Timer
+
+```go
+type Timer interface {
+ // NextSleep is called with the time that Next or More has been
+ // called and returns the length of time to sleep before the
+ // next retry. If no more attempts should be made it should
+ // return false, and the returned duration will be ignored.
+ //
+ // Note that NextSleep is called once after each iteration has
+ // completed, assuming the retry loop is continuing.
+ NextSleep(now time.Time) (time.Duration, bool)
+}
+```
+
+Timer represents a source of timing events for a retry strategy.
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/clock.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/clock.go b/traffic_stats/vendor/gopkg.in/retry.v1/clock.go
new file mode 100644
index 0000000..5b195cd
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/clock.go
@@ -0,0 +1,23 @@
+package retry
+
+import "time"
+
+// Clock represents a virtual clock interface that
+// can be replaced for testing.
+type Clock interface {
+ Now() time.Time
+ After(time.Duration) <-chan time.Time
+}
+
+// WallClock exposes wall-clock time as returned by time.Now.
+type wallClock struct{}
+
+// Now implements Clock.Now.
+func (wallClock) Now() time.Time {
+ return time.Now()
+}
+
+// After implements Clock.After.
+func (wallClock) After(d time.Duration) <-chan time.Time {
+ return time.After(d)
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/exp.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/exp.go b/traffic_stats/vendor/gopkg.in/retry.v1/exp.go
new file mode 100644
index 0000000..94449f4
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/exp.go
@@ -0,0 +1,50 @@
+package retry
+
+import (
+ "time"
+)
+
+// Exponential represents an exponential backoff retry strategy.
+// To limit the number of attempts or their overall duration, wrap
+// this in LimitCount or LimitDuration.
+type Exponential struct {
+ // Initial holds the initial delay.
+ Initial time.Duration
+ // Factor holds the factor that the delay time will be multiplied
+ // by on each iteration.
+ Factor float64
+ // MaxDelay holds the maximum delay between the start
+ // of attempts. If this is zero, there is no maximum delay.
+ MaxDelay time.Duration
+}
+
+type exponentialTimer struct {
+ strategy Exponential
+ start time.Time
+ end time.Time
+ delay time.Duration
+}
+
+// NewTimer implements Strategy.NewTimer.
+func (r Exponential) NewTimer(now time.Time) Timer {
+ return &exponentialTimer{
+ strategy: r,
+ start: now,
+ delay: r.Initial,
+ }
+}
+
+// NextSleep implements Timer.NextSleep.
+func (a *exponentialTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ sleep := a.delay - now.Sub(a.start)
+ if sleep <= 0 {
+ sleep = 0
+ }
+ // Set the start of the next try.
+ a.start = now.Add(sleep)
+ a.delay = time.Duration(float64(a.delay) * a.strategy.Factor)
+ if a.strategy.MaxDelay > 0 && a.delay > a.strategy.MaxDelay {
+ a.delay = a.strategy.MaxDelay
+ }
+ return sleep, true
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/regular.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/regular.go b/traffic_stats/vendor/gopkg.in/retry.v1/regular.go
new file mode 100644
index 0000000..471df43
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/regular.go
@@ -0,0 +1,65 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+package retry
+
+import (
+ "time"
+)
+
+// Regular represents a strategy that repeats at regular intervals.
+type Regular struct {
+ // Total specifies the total duration of the attempt.
+ Total time.Duration
+
+ // Delay specifies the interval between the start of each try
+ // in the burst. If an try takes longer than Delay, the
+ // next try will happen immediately.
+ Delay time.Duration
+
+ // Min holds the minimum number of retries. It overrides Total.
+ // To limit the maximum number of retries, use LimitCount.
+ Min int
+}
+
+// regularTimer holds a running instantiation of the Regular timer.
+type regularTimer struct {
+ strategy Regular
+ count int
+ // start holds when the current try started.
+ start time.Time
+ end time.Time
+}
+
+// Start is short for Start(r, clk, nil)
+func (r Regular) Start(clk Clock) *Attempt {
+ return Start(r, clk)
+}
+
+// NewTimer implements Strategy.NewTimer.
+func (r Regular) NewTimer(now time.Time) Timer {
+ return ®ularTimer{
+ strategy: r,
+ start: now,
+ end: now.Add(r.Total),
+ }
+}
+
+// NextSleep implements Timer.NextSleep.
+func (a *regularTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ sleep := a.strategy.Delay - now.Sub(a.start)
+ if sleep <= 0 {
+ sleep = 0
+ }
+ a.count++
+ // Set the start of the next try.
+ a.start = now.Add(sleep)
+ if a.count < a.strategy.Min {
+ return sleep, true
+ }
+ // The next try is after the end - no more attempts.
+ if a.start.After(a.end) {
+ return 0, false
+ }
+ return sleep, true
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/retry.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/retry.go b/traffic_stats/vendor/gopkg.in/retry.v1/retry.go
new file mode 100644
index 0000000..e5d9f12
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/retry.go
@@ -0,0 +1,156 @@
+// Copyright 2016 Canonical Ltd.
+// Licensed under the LGPLv3, see LICENCE file for details.
+
+// Package retry provides a framework for retrying actions.
+// It does not itself invoke the action to be retried, but
+// is intended to be used in a retry loop.
+//
+// The basic usage is as follows:
+//
+// for a := someStrategy.Start(); a.Next(); {
+// try()
+// }
+//
+// See examples for details of suggested usage.
+package retry
+
+import (
+ "time"
+)
+
+// Strategy is implemented by types that represent a retry strategy.
+//
+// Note: You probably won't need to implement a new strategy - the existing types
+// and functions are intended to be sufficient for most purposes.
+type Strategy interface {
+ // NewTimer is called when the strategy is started - it is
+ // called with the time that the strategy is started and returns
+ // an object that is used to find out how long to sleep before
+ // each retry attempt.
+ NewTimer(now time.Time) Timer
+}
+
+// Timer represents a source of timing events for a retry strategy.
+type Timer interface {
+ // NextSleep is called with the time that Next or More has been
+ // called and returns the length of time to sleep before the
+ // next retry. If no more attempts should be made it should
+ // return false, and the returned duration will be ignored.
+ //
+ // Note that NextSleep is called once after each iteration has
+ // completed, assuming the retry loop is continuing.
+ NextSleep(now time.Time) (time.Duration, bool)
+}
+
+// Attempt represents a running retry attempt.
+type Attempt struct {
+ clock Clock
+ stop <-chan struct{}
+ timer Timer
+
+ // next holds when the next attempt should start.
+ // It is valid only when known is true.
+ next time.Time
+
+ // count holds the iteration count.
+ count int
+
+ // known holds whether next and running are known.
+ known bool
+
+ // running holds whether the attempt is still going.
+ running bool
+
+ // stopped holds whether the attempt has been stopped.
+ stopped bool
+}
+
+// Start begins a new sequence of attempts for the given strategy using
+// the given Clock implementation for time keeping. If clk is
+// nil, the time package will be used to keep time.
+func Start(strategy Strategy, clk Clock) *Attempt {
+ return StartWithCancel(strategy, clk, nil)
+}
+
+// StartWithCancel is like Start except that if a value
+// is received on stop while waiting, the attempt will be aborted.
+func StartWithCancel(strategy Strategy, clk Clock, stop <-chan struct{}) *Attempt {
+ if clk == nil {
+ clk = wallClock{}
+ }
+ now := clk.Now()
+ return &Attempt{
+ clock: clk,
+ stop: stop,
+ timer: strategy.NewTimer(now),
+ known: true,
+ running: true,
+ next: now,
+ }
+}
+
+// Next reports whether another attempt should be made, waiting as
+// necessary until it's time for the attempt. It always returns true the
+// first time it is called unless a value is received on the stop
+// channel - we are guaranteed to make at least one attempt unless
+// stopped.
+func (a *Attempt) Next() bool {
+ if !a.More() {
+ return false
+ }
+ sleep := a.next.Sub(a.clock.Now())
+ if sleep <= 0 {
+ // We're not going to sleep for any length of time,
+ // so guarantee that we respect the stop channel. This
+ // ensures that we make no attempts if Next is called
+ // with a value available on the stop channel.
+ select {
+ case <-a.stop:
+ a.stopped = true
+ a.running = false
+ return false
+ default:
+ a.known = false
+ a.count++
+ return true
+ }
+ }
+ select {
+ case <-a.clock.After(sleep):
+ a.known = false
+ a.count++
+ case <-a.stop:
+ a.running = false
+ a.stopped = true
+ }
+ return a.running
+}
+
+// More reports whether there are more retry attempts to be made. It
+// does not sleep.
+//
+// If More returns false, Next will return false. If More returns true,
+// Next will return true except when the attempt has been explicitly
+// stopped via the stop channel.
+func (a *Attempt) More() bool {
+ if !a.known {
+ now := a.clock.Now()
+ sleepDuration, running := a.timer.NextSleep(now)
+ a.next, a.running, a.known = now.Add(sleepDuration), running, true
+ }
+ return a.running
+}
+
+// Stopped reports whether the attempt has terminated because
+// a value was received on the stop channel.
+func (a *Attempt) Stopped() bool {
+ return a.stopped
+}
+
+// Count returns the current attempt count number, starting at 1.
+// It returns 0 if called before Next is called.
+// When the loop has terminated, it holds the total number
+// of retries made.
+func (a *Attempt) Count() int {
+ return a.count
+}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4df63f3a/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go
----------------------------------------------------------------------
diff --git a/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go b/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go
new file mode 100644
index 0000000..a6f134d
--- /dev/null
+++ b/traffic_stats/vendor/gopkg.in/retry.v1/strategy.go
@@ -0,0 +1,60 @@
+package retry
+
+import (
+ "time"
+)
+
+type strategyFunc func(now time.Time) Timer
+
+// NewTimer implements Strategy.NewTimer.
+func (f strategyFunc) NewTimer(now time.Time) Timer {
+ return f(now)
+}
+
+// LimitCount limits the number of attempts that the given
+// strategy will perform to n. Note that all strategies
+// will allow at least one attempt.
+func LimitCount(n int, strategy Strategy) Strategy {
+ return strategyFunc(func(now time.Time) Timer {
+ return &countLimitTimer{
+ timer: strategy.NewTimer(now),
+ remain: n,
+ }
+ })
+}
+
+type countLimitTimer struct {
+ timer Timer
+ remain int
+}
+
+func (t *countLimitTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ if t.remain--; t.remain <= 0 {
+ return 0, false
+ }
+ return t.timer.NextSleep(now)
+}
+
+// LimitTime limits the given strategy such that no attempt will
+// made after the given duration has elapsed.
+func LimitTime(limit time.Duration, strategy Strategy) Strategy {
+ return strategyFunc(func(now time.Time) Timer {
+ return &timeLimitTimer{
+ timer: strategy.NewTimer(now),
+ end: now.Add(limit),
+ }
+ })
+}
+
+type timeLimitTimer struct {
+ timer Timer
+ end time.Time
+}
+
+func (t *timeLimitTimer) NextSleep(now time.Time) (time.Duration, bool) {
+ sleep, ok := t.timer.NextSleep(now)
+ if ok && now.Add(sleep).After(t.end) {
+ return 0, false
+ }
+ return sleep, ok
+}