1
1
---
2
2
title : " IPIP-0412: Signaling Block Order in CARs on HTTP Gateways"
3
3
date : 2023-05-15
4
- ipip : proposal
4
+ ipip : ratified
5
5
editors :
6
6
- name : Marcin Rataj
7
7
github : lidel
8
8
url : https://lidel.org/
9
+ affiliation :
10
+ name : Protocol Labs
11
+ url : https://protocol.ai/
9
12
- name : Jorropo
10
13
github : Jorropo
14
+ affiliation :
15
+ name : Protocol Labs
16
+ url : https://protocol.ai/
11
17
relatedIssues :
12
18
- https://github.com/ipfs/specs/issues/348
13
19
- https://github.com/ipfs/specs/pull/330
@@ -29,7 +35,7 @@ We want to make it easier to build light-clients for IPFS. We want them to have
29
35
low memory footprints on arbitrary sized files. The main pain point preventing
30
36
this is the fact that CAR ordering isn't specified.
31
37
32
- This require to keeping some kind of reference either on disk, or in memory to
38
+ This requires keeping some kind of reference either on disk, or in memory to
33
39
previously seen blocks for two reasons.
34
40
35
41
1 . Blocks can arrive out of order, meaning when a block is consumed (data is
@@ -52,7 +58,7 @@ This IPIP aims to improve the status quo.
52
58
CAR content type
53
59
([ ` application/vnd.ipld.car ` ] ( https://www.iana.org/assignments/media-types/application/vnd.ipld.car ) )
54
60
already supports ` version ` parameter, which allows gateway to indicate which
55
- CAR flavour is returned with the response.
61
+ CAR flavor is returned with the response.
56
62
57
63
The proposed solution introduces two new parameters for the content type headers
58
64
in HTTP requests and responses: ` order ` and ` dups ` .
@@ -61,7 +67,7 @@ The `order` parameter allows the client to indicate its preference for a
61
67
specific block order in the CAR response, and the ` dups ` parameter specifies
62
68
whether duplicate blocks are allowed in the response.
63
69
64
- A Client SHOULD sent ` Accept ` HTTP header to leverage content type negotiation
70
+ A Client SHOULD send ` Accept ` HTTP header to leverage content type negotiation
65
71
based on section 12.5.1 of : cite [ rfc9110] to get the preferred response type.
66
72
67
73
More details in Section 5. (CAR Responses) of : cite [ trustless-gateway] .
@@ -184,24 +190,16 @@ between clients and Trustless Gateways using various combinations of `order` and
184
190
185
191
Relevant tests were added to
186
192
[ gateway-conformance] ( https://github.com/ipfs/gateway-conformance ) test suite
187
- in [ #87 ] ( https://github.com/ipfs/gateway-conformance/pull/87 ) .
188
-
189
- <!-- TODO after conformance release is tagged
190
- A detailed list of compliance checks for `order` and `dupes` can be found in
191
- [`v0.TODO.0/trustless_gateway_car_test.go`](https://github.com/ipfs/gateway-conformance/blob/v0.TODO.0/tests/trustless_gateway_car_test.go) or later.
192
- -->
193
-
194
- Below are CIDs, CARs, and short summary of each fixture.
195
-
196
- TODO:
197
- 1 . a CAR with blocks for a small file in DFS order
198
- 2 . a CAR with blocks for a small file with one block appearing twice
199
-
200
- Tests for duplicates use a fixture where a directory contains two files that
201
- are the same. If ` dups=n ` , then there are no duplicates. If ` dups=y ` , then the
202
- blocks of the file are sent twice, by the order they show up in the DAG.
203
-
204
- The same fixture is used for testing ` order=dfs ` .
193
+ in [ #87 ] ( https://github.com/ipfs/gateway-conformance/pull/87 ) , and include the below fixture.
194
+
195
+ - ` bafybeihchr7vmgjaasntayyatmp5sv6xza57iy2h4xj7g46bpjij6yhrmy `
196
+ ([ CAR] ( https://github.com/ipfs/gateway-conformance/raw/v0.3.0/fixtures/trustless_gateway_car/dir-with-duplicate-files.car ) )
197
+ - An UnixFS directory with two files that are the same (same CID).
198
+ - If ` dups=n ` , then there should be no duplicate blocks in the returned CAR.
199
+ - If ` dups=y ` , then the blocks of the file are sent twice.
200
+ - The same fixture can be used for testing ` order=dfs ` and checking if blocks that belong to files arrive in the DFS order.
201
+ - It is encouraged to also test DFS order with HAMT fixture such as ` bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i `
202
+ ([ CAR] ( https://github.com/ipfs/gateway-conformance/raw/v0.3.0/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car ) )
205
203
206
204
### Copyright
207
205
0 commit comments