generated from ipfs/ipfs-repository-template
-
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
feat: refactor gateway api to operate on higher level semantics #176
Merged
Merged
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
8ba923b
feat: refactor gateway api to operate on higher level semantics
aschmahmann 0ead6cd
fix: respond to comments
aschmahmann 8704fef
next iteration: moved _redirects and index.html back to being the gat…
aschmahmann 0b6c1c5
rename GatewayMetadata -> ContentPathMetadata
aschmahmann 32eeec6
Merge branch 'main' into feat/gateway-refactor
aschmahmann 9e32875
go mod tidy
aschmahmann 7d145b5
make tests mostly pass, includes change to go-unixfs
aschmahmann ebbe85d
Merge branch 'main' into feat/gateway-refactor
aschmahmann 8413c2b
use shared BlocksGatway
aschmahmann 2b172e7
fixup most errors, expand definition of NotFound
aschmahmann 461fca2
change error reporting to pass a test
aschmahmann 8fca1ae
tmp: point at go-unixfs commit hash
aschmahmann 2bba208
downgrade go-car+otel dependencies and tidy
aschmahmann 2631a5c
fix: bump go-unixfs dep that was missed previously
aschmahmann 6652355
bump go-unixfs to support cid metadata in symlinks
aschmahmann 3f135ce
fix it so we don't cache /ipns/somedir/index.html
aschmahmann bbdc88f
feat(gateway): allow content-type for UnixFS data to be determined by…
aschmahmann f8b96e5
refactor(gateway): move public sentinel errors to the same file as th…
aschmahmann 146bbff
docs(gateway): add clarification to ResolveMutable
aschmahmann 707bec5
feat: fix errors and expose ErrServiceUnavailable instead of go-ipfs-…
aschmahmann 382ceaa
fix more errors, assert index.html content type as text/html
aschmahmann 526e9e0
cleanup some todos
aschmahmann ba19090
refactor dirEntryMetadata name
aschmahmann 80bebc1
explicitly handle an impossible error
aschmahmann 09dc72d
fixup some text
aschmahmann f4b3232
more 500s and removing todos
aschmahmann 54b7644
docs: improve gateway API docs
aschmahmann 42dfc9d
blocks-gateway: remove extraneous methods
aschmahmann b4a6bb7
blocks-gateway: return non-UnixFS codecs from Get, except for non-Uni…
aschmahmann 61f233c
fix _redirects caching/mutability
aschmahmann 0caed11
fix gateway car requests
aschmahmann 8ff5626
switch multierr lib
aschmahmann 7275da3
reorder some imports
aschmahmann 7af0fc6
fix: set X-Ipfs-Roots for CARs
aschmahmann ac23a54
Merge branch 'main' into feat/gateway-refactor
aschmahmann 5efb46f
fix: restore error handling lost in merge commit
aschmahmann ea590f1
feat: switch Get to be multiple functions and implement range requests
aschmahmann 4a49a38
feat: add ResolvePath to gateway API
aschmahmann 36c78c0
fix error shadowing
aschmahmann 62c6100
chore: cleanup linter errors
aschmahmann 8c1c4d0
change GetCAR return signature to make the linter happy
aschmahmann 14e7ffb
fix: uint64 cannot be < 0
hacdias 17f8d70
chore: go mod tidy
hacdias e7366ca
apply some suggestions by @lidel
hacdias cde04e5
Merge branch 'main' into feat/gateway-refactor
hacdias db8b79e
feat: use rawRecord value for ipns record etag
hacdias 2411c38
refactor: call addUserHeaders and set X-Ipfs-Path earlier
hacdias e0a3b8b
docs: apply suggestions
hacdias 2615467
docs: clean explanation in isErrNotFound
hacdias 524f4fd
fix: panic on invalid ipns
hacdias c9bed98
improved errors, renamed variables, remove comments (lidel feedback)
hacdias 2eb8fb6
wrap directory entries for fast listing 🌮
hacdias ae65e02
feat: add default dns resolvers
hacdias 167a8a8
Merge branch 'main' into feat/gateway-refactor
hacdias cbf04b3
feat: switch Get to return a union of files.File and a directory list…
aschmahmann cd0193d
docs: change contract on GetRange to indicate the full file must stil…
aschmahmann 5f7a833
fix: switch _redirects to properly use root path instead of a partial…
aschmahmann e928893
refactor: remove unused types
hacdias c3d7b6f
refactor: make unixfs dir handling clearer
hacdias a05f54c
docs: handleWebRequestErrors
lidel 47d3e19
chore: rename to directoryMetadata
lidel 3de5712
change errors: graph size -> DAG size
aschmahmann 1c6d038
Merge branch 'main' into feat/gateway-refactor
hacdias 784eed6
fix merge
hacdias 1c4716f
fix: ensure basic ipld codecs are registered
hacdias 925f76d
Merge branch 'main' into feat/gateway-refactor
aschmahmann b5beaa2
more boxo related fixups
aschmahmann 2e4b7c3
more boxo related fixups
aschmahmann ffa3aad
cleanup variable name in example
aschmahmann 360b031
Merge branch 'main' into feat/gateway-refactor
hacdias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,18 @@ type ReaderFile struct { | |
} | ||
|
||
func NewBytesFile(b []byte) File { | ||
return &ReaderFile{"", NewReaderFile(bytes.NewReader(b)), nil, int64(len(b))} | ||
return &ReaderFile{"", bytesReaderCloser{bytes.NewReader(b)}, nil, int64(len(b))} | ||
} | ||
|
||
// TODO: Is this the best way to fix this bug? | ||
// The bug is we want to be an io.ReadSeekCloser, but bytes.NewReader only gives a io.ReadSeeker and io.NopCloser | ||
// effectively removes the io.Seeker ability from the passed in io.Reader | ||
type bytesReaderCloser struct { | ||
*bytes.Reader | ||
} | ||
|
||
func (b bytesReaderCloser) Close() error { | ||
return nil | ||
Comment on lines
20
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a bug and a small fix for it. I might be missing something though about why it was done this way. |
||
} | ||
|
||
func NewReaderFile(reader io.Reader) File { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@hacdias @aschmahmann afaik this file is not used anywhere, but increases repo size by +14MB. 🙈
Too late to force-push
main
to fix it, but can we at least remove it in separate PR so there is no confusingexamples/gateway/car-file-gateway/
?If we need fixtures for tests, we should always put them in
testdata/
directory, which has special meaning in go toolingThere 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.
@lidel urgh, will do! Sorry missed that.
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.
#248