-
Notifications
You must be signed in to change notification settings - Fork 22
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: w3filecoin new client and api #848
Conversation
0b757f9
to
1cdc74e
Compare
b541ff6
to
568618f
Compare
568618f
to
5b15429
Compare
5dbb012
to
0e71e7e
Compare
f7ffeab
to
9f365aa
Compare
/** | ||
* Storefront requestin piece to be aggregated | ||
*/ | ||
storefront: Schema.text(), |
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.
I think we should drop this field per spec feedback, but if we don't we should:
- Ensure that it does not change in delegations, meaning verified in
derives
. - Ensure that it equals to
with
field so thatnft.storage
can't specifyweb3.storage
.
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.
with might change in follow up invocation, so changing point 1
* @param {API.AggregatorServiceContext} context | ||
* @returns {Promise<API.UcantoInterface.Result<API.PieceAddSuccess, API.PieceAddFailure> | API.UcantoInterface.JoinBuilder<API.PieceAddSuccess>>} | ||
*/ | ||
async function queueHandler(piece, storefront, group, context) { |
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.
async function queueHandler(piece, storefront, group, context) { | |
async function accept(piece, storefront, group, context) { |
Why not call it an accept
since basically that is what we do here ? Or alternatively call it a dequeue
?
packages/filecoin-api/src/broker.js
Outdated
// Check if self signed to call queue handler | ||
if (context.id.did() === capability.with) { | ||
return queueHandler(piece, offer, deal, context) | ||
} | ||
|
||
return queueAdd(piece, offerCid, deal, offer, context) |
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.
I think following would follow the logic more clearly
// Check if self signed to call queue handler | |
if (context.id.did() === capability.with) { | |
return queueHandler(piece, offer, deal, context) | |
} | |
return queueAdd(piece, offerCid, deal, offer, context) | |
// Check if self signed to call queue handler | |
if (context.id.did() === capability.with) { | |
return queueHandler(piece, offer, deal, context) | |
} | |
// If self issued we accept without verification | |
return context.id.did() === capability.with | |
? accept(piece, offer, deal, context) | |
: enqueue(piece, offer, deal, context) |
*/ | ||
async function queueHandler(piece, content, context) { | ||
// store piece | ||
const put = await context.pieceStore.put({ |
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.
Not sure howe piece propagates to the aggregator here, if there was no user call with filecoin/add
first
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.
Yeah, I decoupled things to happen outside of the scope so that each client/api can be used independently. Otherwise, we would get everything requiring everything else. Either they can rely on store events, or insertion with the client right after
🤖 I have created a release *beep* *boop* --- ## [8.0.0](capabilities-v7.0.0...capabilities-v8.0.0) (2023-08-09) ### ⚠ BREAKING CHANGES * update aggregation capabilitites to use height instead of size together with client and api ([#831](#831)) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * update aggregation capabilitites to use height instead of size together with client and api ([#831](#831)) ([31730f0](31730f0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [1.1.0](filecoin-client-v1.0.0...filecoin-client-v1.1.0) (2023-08-09) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) --- 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: Vasco Santos <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.1.0](filecoin-api-v1.0.0...filecoin-api-v1.1.0) (2023-08-09) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) --- 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: Vasco Santos <[email protected]>
🤖 I have created a release *beep* *boop* --- ## 1.0.0 (2023-08-10) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## 1.0.0 (2023-08-10) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) --- 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: Vasco Santos <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.2.0](filecoin-api-v1.1.0...filecoin-api-v1.2.0) (2023-08-10) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [1.2.0](filecoin-client-v1.1.0...filecoin-client-v1.2.0) (2023-08-10) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) --- 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: Vasco Santos <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.3.0](filecoin-client-v1.2.2...filecoin-client-v1.3.0) (2023-08-30) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) * w3filecoin spec separate capabilities to queue and enqueue ([#856](#856)) ([6bf9142](6bf9142)), closes [#855](#855) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [1.3.0](filecoin-api-v1.2.2...filecoin-api-v1.3.0) (2023-08-30) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) * w3filecoin spec separate capabilities to queue and enqueue ([#856](#856)) ([6bf9142](6bf9142)), closes [#855](#855) --- 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: Vasco Santos <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [1.4.0](filecoin-api-v1.3.1...filecoin-api-v1.4.0) (2023-08-30) ### Features * w3filecoin new client and api ([#848](#848)) ([7a58fbe](7a58fbe)) ### Bug Fixes * types when storefront is not in capability nb ([#886](#886)) ([448a7d1](448a7d1)) * upgrade data segment ([#850](#850)) ([fba281f](fba281f)) * w3filecoin spec separate capabilities to queue and enqueue ([#856](#856)) ([6bf9142](6bf9142)), closes [#855](#855) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Implements new client and API based on storacha/specs#71
Note that new client is filecoin spec based rather than aggregation only. There are other roles that are not aggregator:
storefront
will be implemented by web3.storage/nft.storage viaw3up
aggregator
will be implemented byw3filecoin
broker
will be implemented byspade-proxy
chain
will (likely) be implemented byw3filecoin
(reading from spade oracle, while we might have an Oracle ourselves later on)