| Index: common/gcloud/gs/gs.go
|
| diff --git a/common/gcloud/gs/gs.go b/common/gcloud/gs/gs.go
|
| index be2bdee9a2844cedb787777cc1b284bde9b9a05c..70e50db6a61c1d21b937d035897cd3127b67a5b0 100644
|
| --- a/common/gcloud/gs/gs.go
|
| +++ b/common/gcloud/gs/gs.go
|
| @@ -37,7 +37,11 @@ type Client interface {
|
| io.Closer
|
|
|
| // NewReader instantiates a new Reader instance for the named bucket/path.
|
| - NewReader(p Path, o Options) (io.ReadCloser, error)
|
| + //
|
| + // The supplied offset must be >= 0, or else this function will panic.
|
| + //
|
| + // If the supplied length is <0, no upper byte bound will be set.
|
| + NewReader(p Path, offset, length int64) (io.ReadCloser, error)
|
|
|
| // NewWriter instantiates a new Writer instance for the named bucket/path.
|
| NewWriter(p Path) (Writer, error)
|
| @@ -55,19 +59,6 @@ type Client interface {
|
| Rename(src, dst Path) error
|
| }
|
|
|
| -// Options are the set of extra options to apply to the Google Storage request.
|
| -type Options struct {
|
| - // From is the range request starting index. If >0, the beginning of the
|
| - // range request will be set.
|
| - From int64
|
| - // To is the range request ending index. If >0, the end of the
|
| - // range request will be set.
|
| - //
|
| - // If no From index is set, this will result in a request indexed from the end
|
| - // of the object.
|
| - To int64
|
| -}
|
| -
|
| // prodGSObject is an implementation of Client interface using the production
|
| // Google Storage client.
|
| type prodClient struct {
|
| @@ -116,19 +107,16 @@ func (c *prodClient) NewWriter(p Path) (Writer, error) {
|
| }, nil
|
| }
|
|
|
| -func (c *prodClient) NewReader(p Path, o Options) (io.ReadCloser, error) {
|
| - if o.From < 0 {
|
| - o.From = 0
|
| - }
|
| - if o.To <= 0 {
|
| - o.To = -1
|
| +func (c *prodClient) NewReader(p Path, offset, length int64) (io.ReadCloser, error) {
|
| + if offset < 0 {
|
| + panic(fmt.Errorf("offset (%d) must be >= 0", offset))
|
| }
|
|
|
| obj, err := c.handleForPath(p)
|
| if err != nil {
|
| return nil, err
|
| }
|
| - return obj.NewRangeReader(c, o.From, o.To)
|
| + return obj.NewRangeReader(c, offset, length)
|
| }
|
|
|
| func (c *prodClient) Rename(src, dst Path) error {
|
|
|