Skip to content

feat: implement block order signaling#25

Merged
alanshaw merged 4 commits intomainfrom
feat/implement-block-order-signaling
May 19, 2023
Merged

feat: implement block order signaling#25
alanshaw merged 4 commits intomainfrom
feat/implement-block-order-signaling

Conversation

@alanshaw
Copy link
Member

This PR updates dagula and implements block order signaling via HTTP Accept header as specified in ipfs/specs#412.

It also renames the query param car-scope to dag-scope and changes the scope value file to entity as these were updated in ipfs/specs#402.

@alanshaw alanshaw requested a review from olizilla May 18, 2023 15:58
Comment on lines +85 to +89
if (!accept) return { version: 1, order: 'dfs', dups: true }

const types = accept.split(',').map(s => s.trim())
const carType = types.find(t => t.startsWith('application/vnd.ipld.car'))
if (!carType) return { version: 1, order: 'dfs', dups: true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have a const for the default params, and flip default order to unk

Copy link
Contributor

@olizilla olizilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. good testing. I would maybe switch the last one to simply assert that the expected set of blocks arrives rather than "definitely not dfs", as you comment, dfs is a fine order for unk.

Accept: 'application/vnd.ipld.car; order=unk'
}
})
const res = await handleCar(req, env, ctx)
Copy link
Contributor

@olizilla olizilla May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: could verify the fancy content-type header is as expected here on the response

@alanshaw alanshaw merged commit 1862165 into main May 19, 2023
@alanshaw alanshaw deleted the feat/implement-block-order-signaling branch May 19, 2023 11:05
alanshaw pushed a commit that referenced this pull request May 19, 2023
🤖 I have created a release *beep* *boop*
---


##
[3.1.0](v3.0.0...v3.1.0)
(2023-05-19)


### Features

* implement block order signaling
([#25](#25))
([1862165](1862165))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants