feat: Handle all forms of range requests - #766
Open
gschulze wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #259.
Adds support for all forms of range requests documented by fsspec.
Implemented:
get_range/get_rangescover all threeGetRangevariants: bounded,startalone (to the end of the object), and negativestart(the last N bytes).get_rangestakesNoneper element inends/lengths, and resolves open-ended ranges with oneheadrequest so they still coalesce.cat_fileaccepts either bound alone, or either counting back from the end.cat_rangesaccepts fsspec's full vocabulary and now honorsmax_gap, which was previously accepted and silently ignored.test_cat_ranges_mixedis no longerxfail.API changes:
ends/lengths:Sequence[int] | None→Sequence[int | None] | None.coalesce:int→int | None, whereNonemeans obstore's own default, previously hardcoded in four places across_get.pyiandstore.py.startstaysint, but negative values are now accepted.start/starts:u64→i64on all fourget_range*/get_ranges*, to support suffix requests.ends/lengths:Option<Vec<u64>>→Option<Vec<Option<u64>>>.coalesce:u64→Option<u64>.Behavior changes:
get_ranges(starts=[5])reads to the end of the object instead of raising;endsandlengthsmay both be passed if at most one is non-Noneper range; mismatched sequence lengths raiseValueErrorinstead of being silently truncated.Follow-up tasks:
Raise upstream: obstore now accepts range forms obspec's GetRange/GetRanges docstrings declare invalid. Conformance is unaffected, but code using the new forms won't port to other obspec implementations.