-
Notifications
You must be signed in to change notification settings - Fork 174
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
Introduce Prefetch trait #595
Conversation
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.
Still not really sure we have the abstraction right here, but it's better than before and not worth blocking on, so just a couple notes.
type PrefetchResult<Client: ObjectClient + Send + Sync + 'static>: PrefetchResult<Client>; | ||
|
||
/// Start a new prefetch request to the specified object. | ||
fn prefetch<Client>( |
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.
Not going to block on it because we can refactor it later, but the Client
type is a little weird here -- it's saying that you can pass any client into any prefetcher, but in reality it probably makes sense for a prefetcher to be coupled to a particular client once it's constructed.
I think in practice we want trait Prefetch<Client>
or something, but that's a bit of annoying change to make.
The send constraint might just be a nightly regression (rust-lang/rust#117602), maybe check again tomorrow. |
Introduce a new `Prefetch` trait to abstract how `S3Filesystem` fetches object data from an `ObjectClient`. While this change does not introduce any functional change, this abstraction will be used to implement optional object data caching. The existing `Prefetcher` struct has been adapted to implement the new `Prefetch` trait. The main changes are: * it is generic on the `ObjectPartStream` (previously `ObjectPartFeed`), rather than using dynamic dispatch, * it does not own an `ObjectClient` instance, instead one is required when initiating a `prefetch` request, * the logic to spawn a new task for each `GetObject` request and handle the object body parts returned was moved into `ObjectPartStream`. Signed-off-by: Alessandro Passaro <[email protected]>
Right. It's been fixed now. I reverted the changes and rebased. |
Description of change
Introduce a new
Prefetch
trait to abstract howS3Filesystem
fetches object data from anObjectClient
. While this change does not introduce any functional change, this abstraction will be used to implement optional object data caching.The existing
Prefetcher
struct has been adapted to implement the newPrefetch
trait. The main changes are:ObjectPartStream
(previouslyObjectPartFeed
), rather than using dynamic dispatch,ObjectClient
instance, instead one is required when initiating aprefetch
request,GetObject
request and handle the object body parts returned was moved intoObjectPartStream
.Relevant issues: #255
Does this change impact existing behavior?
No changes in behavior.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).