-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async flatgeobuf reading via object-store #494
Conversation
I've been watching your progress on this here and in the flatgeobuf crate. This capability would be super helpful not just for geo-arrow, but for broader applications also.
|
This is waiting on a new release of flatgeobuf. Hopefully this will just work once that's released. If you're interested, you could test this branch with the latest
Release what as a separate crate? The only non-geoarrow-specific part of this is |
Thanks :) I thought there was still something to finish up due to the
Valid point, that sound like a cleaner plan regardless. Cool, I'll play around with flatgeobuf master and let you know what I find out 🚀 |
it looks like 4.1 was just published, so you should test with that |
let split_range = range.split('-').collect::<Vec<_>>(); | ||
let start_range = split_range[0].parse::<usize>().unwrap(); | ||
let end_range = split_range[1].parse::<usize>().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range
(at least in my testing) looks like bytes=0-12943
- so your split is insufficient.
I've done let split_range = range.split(&['=', '-']).collect::<Vec<_>>();
and then incremented the indexes on line 17, 18.
Still looking, but I'm getting a response with this change at least 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A refactor including errors:
let bytes_range = range
.split(&['=', '-'])
.filter_map(|n| n.parse::<usize>().ok());
if let Some((start_range, end_range)) = bytes_range.collect_tuple() {
// Add one to the range because HTTP range strings are end-inclusive
let bytes = self
.reader
.get_range(&self.location, start_range..end_range + 1)
.await
.map_err(|_| HttpError::HttpStatus(500))?;
return Ok(bytes);
}
Err(HttpError::HttpStatus(500))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use itertools:Itertools; //collect_tuple
use http_range_client::HttpError;
With that small fix above, this seems to be doing exactly what I'd expect! This is so great—I've been managing PSKs to get access to encrypted flatgeobufs on s3 up until now. Super clunky. Seamless with this wrapper. Thanks Kyle :) |
Merging with follow ups tracked in #534. Not yet working for s3 files |
This is a draft for now because
HTTPFgbReader
is not generic over backends. See flatgeobuf/flatgeobuf#345