Skip to content
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

fix!: drop filecoin storefront skip submit queue option #1371

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading