[GODRIVER-3079] Implement io.ReadSeeker for the DownloadStream Created: 26/Dec/23 Updated: 08/Jan/24 |
|
| Status: | Backlog |
| Project: | Go Driver |
| Component/s: | GridFS, Networking, Performance |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.0 |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Kristopher Rahim Afful-Brown | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
ContextAs the client, I should have the flexibility of choosing to stream a file in it's entirety or in parts, such as using a Range Request Here is the current definition of the DownloadStream
Whereas the http.ServeContent function requires a an `io.ReadSeeker`. From the docs, it seem this is the recommended function to use over `io.Copy` as it:
By extending the type to implement the `ReadSeeker` interface, this creates greater consistency with the stdlib Definition of doneInclude a method for seeking. This seems to exists in s3 compatible drivers already and this older unofficial MongoDB driver seemed to also implement this. The official driver also already seems to tackle the SeekStart/SeekCurrent with how Skip is implemented. PitfallsWhat should the implementer watch out for? What are the risks? |
| Comments |
| Comment by PM Bot [ 26/Dec/23 ] |
|
Hi kristopherab@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon. |