Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
fix: offer to use collection instead of tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Sep 13, 2023
1 parent d1d3e8a commit 89a1e23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ interface Offer {
aggregate: PieceCID
// CID of all the segments part of the aggregate
pieces: PieceCID[]
// identifier of the tenant for the storefront `did:web:web3.storage`
// spade relies on tenant naming, so we map it here to tenant
tenant: string
// identifier of the collection for the tenant `did:web:web3.storage`
// spade relies on collections to identify different replication constraints.
collection: string
// enables ordering of offers to handle.
// Being it the number of ms since epoch, also means offers that fail and are retried will have "priority"
// It can also have lower numbers to prioritize certain actors in the future
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/data/offer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const encode = {
const value = {
aggregate: dealRecord.aggregate.toString(),
pieces: dealRecord.pieces.map(p => p.toString()),
tenant: dealRecord.storefront,
collection: dealRecord.storefront,
orderID: dealRecord.insertedAt || Date.now()
} satisfies Offer

Expand Down Expand Up @@ -53,7 +53,7 @@ export const decode = {
return {
aggregate: parseLink(record.aggregate),
pieces: record.pieces.map(p => parseLink(p)),
storefront: record.tenant,
storefront: record.collection,
insertedAt: record.orderID
}
},
Expand All @@ -74,6 +74,6 @@ export type EncodedRecord = {
export type Offer = {
aggregate: string
pieces: string[]
tenant: string
collection: string
orderID: number
}

0 comments on commit 89a1e23

Please sign in to comment.