-
Notifications
You must be signed in to change notification settings - Fork 8
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
Readable file around object_store::BufReader
#33
Conversation
cc @martindurant this adds a file-like object wrapper, which we could also wrap in fsspec |
object-store-rs/src/buffered.rs
Outdated
} | ||
|
||
#[pyfunction] | ||
pub(crate) fn open_async(py: Python, store: PyObjectStore, path: String) -> PyResult<Bound<PyAny>> { |
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.
I'm not sure you want to bother with open_async for now - if it's to be a file-like API, may as well just do that, and only give the blocking methods. It is a stateful object, after all.
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.
Presently, this PR only provides async methods, not blocking methods. The API is meant to be similar to https://github.com/Tinche/aiofiles.
It would be a good enhancement to have two separate Python classes, one returned by open
and another returned by open_async
. Then the methods on the object returned by open_async
would be named read()
(without the async
suffix) but still return coroutines.
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.
OK, so not really like https://github.com/fsspec/filesystem_spec/blob/master/fsspec/asyn.py#L911 (implementations elsewhere)
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.
No, sorry, this wasn't modeled after fsspec, but it could be used potentially in an fsspec wrapper.
object_store::BufReader
"File-like object" wrapper