-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include optional Ipni-Cid-Schema-Type HTTP header
This optional header, when present, serves as an indication to advertisement publishers what type of data is being requested and is identified by the CID. This may help some publishers more quickly lookup the data. The publisher, who receives the Ipni-Cid-Schema-Type HTTP header, does not validate the value, because newer values may need to be received by consumer that is using an older version of library. Implements fix for ipni/storetheindex#2662
- Loading branch information
Showing
6 changed files
with
121 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ipnisync | ||
|
||
const ( | ||
// CidSchemaHeader is the HTTP header used as an optional hint about the | ||
// type of data requested by a CID. | ||
CidSchemaHeader = "Ipni-Cid-Schema-Type" | ||
// CidSchemaAd is a value for the CidSchemaHeader specifying advertiesement | ||
// data is being requested. | ||
CidSchemaAd = "advertisement" | ||
// CidSchemaEntries is a value for the CidSchemaHeader specifying | ||
// advertisement entries (multihash chunks) data is being requested. | ||
CidSchemaEntries = "entries" | ||
) | ||
|
||
// cidSchemaTypeKey is the type used for the key of CidSchemaHeader when set as | ||
// a context value. | ||
type cidSchemaTypeCtxKey string | ||
|
||
// CidSchemaCtxKey is used as the key when creating a context with a value or extracting the cid schema from a context. Examples: | ||
// | ||
// ctx := context.WithValue(ctx, CidSchemaCtxKey, CidSchemaAd) | ||
// | ||
// cidSchemaType, ok := ctx.Value(CidSchemaCtxKey).(string) | ||
const CidSchemaCtxKey cidSchemaTypeCtxKey = CidSchemaHeader |
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