-
Notifications
You must be signed in to change notification settings - Fork 100
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(gateway): use a single path struct internally #204
Conversation
…eway's problem. Implemented blocks gateway example
# Conflicts: # gateway/gateway_test.go # gateway/handler.go # gateway/handler_block.go # gateway/handler_codec.go # gateway/handler_tar.go # gateway/handler_unixfs.go # gateway/handler_unixfs__redirects.go # gateway/handler_unixfs_dir.go # go.mod # go.sum
… the Gateway API implementer
…e gateway interface
…interface-core's ErrOffline
Co-authored-by: Marcin Rataj <lidel@lidel.org>
…ing response. Found two bugs along the way: Range requests for _redirects 200s were not being honored, and HEAD requests for directories with index.html were using the Get pathway instead of Head
…uest struct that is passed around
Codecov Report
@@ Coverage Diff @@
## feat/gateway-refactor #204 +/- ##
=========================================================
+ Coverage 30.01% 30.09% +0.07%
=========================================================
Files 104 105 +1
Lines 11756 11780 +24
=========================================================
+ Hits 3529 3545 +16
- Misses 7844 7851 +7
- Partials 383 384 +1
|
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.
The changes look fine overall, but I share some of your sentiments. I would first like to ask why we do have 4 paths now. Before we had only 2, then on #176 we have 3. Why 4 now? Is it possible to remove any?
For example, do we need immutablePartiallyResolvedPath
, or could we potentially just jump straight to finalResolvedPath
?
We had only two types before
In that PR there are 3 Go types, but 4 different kinds of paths being moved around:
Nothing new here, but yes I think we could probably remove If you have a way you'd like to change |
@lidel @aschmahmann is this something we still want to do, or can this be done in #198? |
The amount of force pushes we did here makes it impossible to review 🙈 I think we probably want to park this until we have time for #198. |
closing this until we take a stab at #198 |
Builds off of #176 for separate review and merge.
Things that feel good about the PR:
Some things that don't feel great about this PR:
maybeMutable -> immutable -> resolved to last CID + path
path.Resolved
which isn't type checked as immutable (if we wanted we could switch to afinalCID
andfinalPathRemainder
which would probably do the job)Note: aside from this straight refactor there are some issues likely uncovered here (e.g. changing handleNonUnixFSRequestErrors to take a contentPath and choosing a consistent path type to report with).