Skip to content

Commit

Permalink
fix!: drop filecoin storefront skip submit queue option (#1371)
Browse files Browse the repository at this point in the history
This is not needed since #1332
got released and used in w3infra
storacha/w3infra#343 and has been deployed
in production without issues for the last few weeks

BREAKING CHANGE: not possible to skip submit queue on storefront service
anymore
  • Loading branch information
vasco-santos authored Apr 19, 2024
1 parent 3da0bf1 commit 1114383
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 31 deletions.
11 changes: 0 additions & 11 deletions packages/filecoin-api/src/storefront/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ export type DataStore = StreammableStore<UnknownLink, Uint8Array>
export type TaskStore = Store<UnknownLink, Invocation>
export type ReceiptStore = Store<UnknownLink, Receipt>

export interface ServiceOptions {
/**
* Implementer MAY handle submission without user request.
*/
skipFilecoinSubmitQueue?: boolean
}

export interface ServiceContext {
/**
* Service signer
Expand Down Expand Up @@ -74,10 +67,6 @@ export interface ServiceContext {
* Deal tracker connection to find out available deals for an aggregate.
*/
dealTrackerService: ServiceConfig<DealTrackerService>
/**
* Service options.
*/
options?: ServiceOptions
}

export interface FilecoinSubmitMessageContext
Expand Down
37 changes: 17 additions & 20 deletions packages/filecoin-api/src/storefront/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,24 @@ import {
export const filecoinOffer = async ({ capability }, context) => {
const { piece, content } = capability.nb

// Queue offer for filecoin submission
// We need to identify new client here...
if (!context.options?.skipFilecoinSubmitQueue) {
// dedupe
const hasRes = await context.pieceStore.has({ piece })
if (hasRes.error) {
return { error: new StoreOperationFailed(hasRes.error.message) }
}
// dedupe
const hasRes = await context.pieceStore.has({ piece })
if (hasRes.error) {
return { error: new StoreOperationFailed(hasRes.error.message) }
}

const group = context.id.did()
if (!hasRes.ok) {
// Queue the piece for validation etc.
const queueRes = await context.filecoinSubmitQueue.add({
piece,
content,
group,
})
if (queueRes.error) {
return {
error: new QueueOperationFailed(queueRes.error.message),
}
// Queue offer for filecoin submission
const group = context.id.did()
if (!hasRes.ok) {
// Queue the piece for validation etc.
const queueRes = await context.filecoinSubmitQueue.add({
piece,
content,
group,
})
if (queueRes.error) {
return {
error: new QueueOperationFailed(queueRes.error.message),
}
}
}
Expand Down

0 comments on commit 1114383

Please sign in to comment.