context_go1.5.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // +build !go1.9
  2. package credentials
  3. import "time"
  4. // Context is an copy of the Go v1.7 stdlib's context.Context interface.
  5. // It is represented as a SDK interface to enable you to use the "WithContext"
  6. // API methods with Go v1.6 and a Context type such as golang.org/x/net/context.
  7. //
  8. // This type, aws.Context, and context.Context are equivalent.
  9. //
  10. // See https://golang.org/pkg/context on how to use contexts.
  11. type Context interface {
  12. // Deadline returns the time when work done on behalf of this context
  13. // should be canceled. Deadline returns ok==false when no deadline is
  14. // set. Successive calls to Deadline return the same results.
  15. Deadline() (deadline time.Time, ok bool)
  16. // Done returns a channel that's closed when work done on behalf of this
  17. // context should be canceled. Done may return nil if this context can
  18. // never be canceled. Successive calls to Done return the same value.
  19. Done() <-chan struct{}
  20. // Err returns a non-nil error value after Done is closed. Err returns
  21. // Canceled if the context was canceled or DeadlineExceeded if the
  22. // context's deadline passed. No other values for Err are defined.
  23. // After Done is closed, successive calls to Err return the same value.
  24. Err() error
  25. // Value returns the value associated with this context for key, or nil
  26. // if no value is associated with key. Successive calls to Value with
  27. // the same key returns the same result.
  28. //
  29. // Use context values only for request-scoped data that transits
  30. // processes and API boundaries, not for passing optional parameters to
  31. // functions.
  32. Value(key interface{}) interface{}
  33. }