limit_reader_1_6.go 531 B

12345678910111213141516171819202122232425262728
  1. // +build !go1.7
  2. // "golang.org/x/time/rate" is depended on golang context package go1.7 onward
  3. // this file is only for build,not supports limit upload speed
  4. package oss
  5. import (
  6. "fmt"
  7. "io"
  8. )
  9. const (
  10. perTokenBandwidthSize int = 1024
  11. )
  12. type OssLimiter struct {
  13. }
  14. type LimitSpeedReader struct {
  15. io.ReadCloser
  16. reader io.Reader
  17. ossLimiter *OssLimiter
  18. }
  19. func GetOssLimiter(uploadSpeed int) (ossLimiter *OssLimiter, err error) {
  20. err = fmt.Errorf("rate.Limiter is not supported below version go1.7")
  21. return nil, err
  22. }