-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refactor logic for fetching files and listing directories #111
Comments
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Adds the Provider interface and most of the implementation of R2Provider as discussed in #111. Note that as of right now the provider isn't being used, this will happen in future prs.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Adds the Provider interface and most of the implementation of R2Provider as discussed in #111. Note that as of right now the provider isn't being used, this will happen in future prs.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Implements the `OriginProvider` class as described in #111 and allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Adds the Provider interface and most of the implementation of R2Provider as discussed in #111. Note that as of right now the provider isn't being used, this will happen in future prs.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Implements the `OriginProvider` class as described in #111 and allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Implements the S3Provider class as described in #111.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Adds the Provider interface and most of the implementation of R2Provider as discussed in #111. Note that as of right now the provider isn't being used, this will happen in future prs.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Adds the Provider interface and most of the implementation of R2Provider as discussed in #111. Note that as of right now the provider isn't being used, this will happen in future prs.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Implements the `OriginProvider` class as described in #111 and allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Apr 14, 2024
Implements the S3Provider class as described in #111.
flakey5
added a commit
that referenced
this issue
Apr 15, 2024
Implements the S3Provider class as described in #111.
flakey5
added a commit
that referenced
this issue
Apr 24, 2024
Implements the `OriginProvider` class as described in #111 and allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Apr 24, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Apr 24, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Apr 24, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
May 31, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
May 31, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
May 31, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
flakey5
added a commit
that referenced
this issue
Jun 2, 2024
Implements the `OriginProvider` and `S3Provider` classes as described in #111. Allows `R2Provider` to take in a fallback provider that will be used if R2 fails.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
As of right now the code behind fetching files, heading files, and listing directories is functional and working fine. However, it isn't the cleanest.
Current Request Flow
Notable Points
Proposal
I have a few ideas that can make the code nicer to read and add some additional functionality that is/could be useful. I've implemented most of these ideas in my personal fork as POCs, https://github.com/flakey5/release-cloudflare-worker/tree/flakey5/20240330/contributors (term POC being used liberally in some cases)
A
Provider
A
Provider
essentially acts like an API client. It abstracts the calls to a data source (e.g. r2, origin.nodejs.org) and returns the data in a shared type (e.g.GetFileResult
for getting a file). It also should handle retry logic if necessary.So, an example of using a Provider to get a file from R2 would look something like:
Providers will be created for R2 (
R2Provider
), R2's S3 API (S3Provider
), and the origin server (OriginProvider
). POC located here.This API is a bit more complicated than what is currently implemented. However, it gives us a few benefits:
R2Provider
for theOriginProvider
without needing to change any code and without needing to modify the Cloudflare routing config (see https://github.com/flakey5/release-cloudflare-worker/blob/flakey5/20240330/contributors/src/providers/providerFactory.ts#L6-L33)Our current implementation does not give us these benefits. It is hard coded to go to R2 and then the origin server if all retries to R2 get exhausted.
Additional changes
src/handlers/strategies
to files insrc/actions
Proposed Request Flow
GET
HEAD
Wdyt cc @nodejs/web-infra ?
The text was updated successfully, but these errors were encountered: