Provide AsyncSeek on body reader.
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
Currently there is no elegant way to seek through data stream, except using range headers manually. So I purpose adding `AsyncSeek`, that would provide seek method on body reader. The seek method would fail if response contains `Accept-Ranges: none`. In other cases the reader would actually send new request with appropriate `Range` header.
On `SeekFrom::Start(x)` the range header should look like `Range: bytes={x}-`, so the reader can read till the end of stream normally.
For `SeekFrom::Current(x)` is similar to upper example: `Range: bytes={c+x}-`; where c is current stream position.
For `SeekFrom::End(x)` we just get the last x bytes: `Range: bytes=-{x}`.
Contributor guide
Research direction
The issue names no files, tests, or entry points, so first locate the body reader and its existing range-header handling. Then check how AsyncSeek should handle Start, Current, and End requests, including the Accept-Ranges: none failure; done means the reader can seek by issuing the specified Range requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100