Open opens the file for read. Call Close() on the returned io.ReadCloser
(ctx context.Context, options ...fs.OpenOption)
| 79 | |
| 80 | // Open opens the file for read. Call Close() on the returned io.ReadCloser |
| 81 | func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error) { |
| 82 | fs.FixRangeOption(options, o.file.Size) |
| 83 | downloadToken, err := o.fs.getDownloadToken(ctx, o.file.URL) |
| 84 | |
| 85 | if err != nil { |
| 86 | return nil, err |
| 87 | } |
| 88 | |
| 89 | var resp *http.Response |
| 90 | opts := rest.Opts{ |
| 91 | Method: "GET", |
| 92 | RootURL: downloadToken.URL, |
| 93 | Options: options, |
| 94 | } |
| 95 | |
| 96 | err = o.fs.pacer.Call(func() (bool, error) { |
| 97 | resp, err = o.fs.rest.Call(ctx, &opts) |
| 98 | return shouldRetry(ctx, resp, err) |
| 99 | }) |
| 100 | |
| 101 | if err != nil { |
| 102 | return nil, err |
| 103 | } |
| 104 | return resp.Body, err |
| 105 | } |
| 106 | |
| 107 | // Update in to the object with the modTime given of the given size |
| 108 | // |
nothing calls this directly
no test coverage detected