-
Notifications
You must be signed in to change notification settings - Fork 99
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
gateway: implement IPIP-0445 (skip-raw-blocks option) #502
base: main
Are you sure you want to change the base?
Conversation
Need tests merged and changelog. |
@@ -296,6 +296,10 @@ func (bb *BlocksBackend) Head(ctx context.Context, path path.ImmutablePath) (Con | |||
var emptyRoot = []cid.Cid{cid.MustParse("bafkqaaa")} | |||
|
|||
func (bb *BlocksBackend) GetCAR(ctx context.Context, p path.ImmutablePath, params CarParams) (ContentPathMetadata, io.ReadCloser, error) { | |||
if params.SkipRawBlocks.Bool() && p.RootCid().Prefix().Codec == cid.Raw { | |||
|
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.
Needs 400:
A Gateway MUST return HTTP error 400 Bad Request when
skip-raw-blocks=y
is sent for a content path with a root CID with theraw
multicodec.
// FIXME(@Jorropo): this is very inneficient, we fetch all blocks even if we don't send them. | ||
// I've tried doing so using the ipld stack however the problem is that filtering on the | ||
// selector or traversal callback does not work because the unixfs reifier is ran before, | ||
// so trying to filter raw links do nothing because go-unixfsnode removed them already, | ||
// so we need to filter in a callback from unixfsnode but the reifier does not know a about | ||
// [traversal.SkipMe] making it a lost cause. I've looked into updating unixfsnode but this | ||
// much more work because there are no easy way to pass options or understand what the side | ||
// effects of this would be. | ||
// Abstractions everywhere yet a simple small behaviour change require rethinking everything :'(. | ||
// Will fix with boxo/unixfs. |
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.
😞
Codecov Report
@@ Coverage Diff @@
## main #502 +/- ##
==========================================
- Coverage 65.66% 65.58% -0.09%
==========================================
Files 207 207
Lines 25604 25656 +52
==========================================
+ Hits 16814 16827 +13
- Misses 7317 7353 +36
- Partials 1473 1476 +3
|
See ipfs/specs#445