Skip to content

Commit

Permalink
feat: add blob protocol to service
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Apr 17, 2024
1 parent 4b292fa commit a35d822
Show file tree
Hide file tree
Showing 21 changed files with 1,353 additions and 71 deletions.
182 changes: 130 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"console": "sst console",
"lint": "tsc && eslint '**/*.js'",
"clean": "rm -rf dist node_modules package-lock.json ./*/{.cache,dist,node_modules}",
"test": "npm test -w billing -w upload-api -w carpark -w replicator -w satnav -w roundabout -w filecoin",
"test": "npm test -w upload-api",
"test-integration": "ava --verbose --serial --timeout=660s test/*.test.js",
"fetch-metrics-for-space": "npm run fetch-metrics-for-space -w tools",
"follow-filecoin-receipt-chain": "npm run follow-filecoin-receipt-chain -w tools",
Expand Down
5 changes: 4 additions & 1 deletion stacks/upload-api-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function UploadApiStack({ stack, app }) {

// Get references to constructs created in other stacks
const { carparkBucket } = use(CarparkStack)
const { storeTable, uploadTable, delegationBucket, delegationTable, revocationTable, adminMetricsTable, spaceMetricsTable, consumerTable, subscriptionTable, rateLimitTable, pieceTable, privateKey } = use(UploadDbStack)
const { allocationTable, storeTable, uploadTable, delegationBucket, delegationTable, revocationTable, adminMetricsTable, spaceMetricsTable, consumerTable, subscriptionTable, rateLimitTable, pieceTable, privateKey } = use(UploadDbStack)
const { invocationBucket, taskBucket, workflowBucket, ucanStream } = use(UcanInvocationStack)
const { customerTable, spaceDiffTable, spaceSnapshotTable, stripeSecretKey } = use(BillingDbStack)
const { pieceOfferQueue, filecoinSubmitQueue } = use(FilecoinStack)
Expand All @@ -41,6 +41,7 @@ export function UploadApiStack({ stack, app }) {
defaults: {
function: {
permissions: [
allocationTable,
storeTable,
uploadTable,
customerTable,
Expand All @@ -66,6 +67,7 @@ export function UploadApiStack({ stack, app }) {
environment: {
DID: process.env.UPLOAD_API_DID ?? '',
AGGREGATOR_DID,
ALLOCATION_TABLE_NAME: allocationTable.tableName,
STORE_TABLE_NAME: storeTable.tableName,
STORE_BUCKET_NAME: carparkBucket.bucketName,
UPLOAD_TABLE_NAME: uploadTable.tableName,
Expand All @@ -92,6 +94,7 @@ export function UploadApiStack({ stack, app }) {
COMMIT: git.commmit,
STAGE: stack.stage,
ACCESS_SERVICE_URL: getServiceURL(stack) ?? '',
UPLOAD_SERVICE_URL: customDomain?.domainName ? `https://${customDomain?.domainName}` : '',
POSTMARK_TOKEN: process.env.POSTMARK_TOKEN ?? '',
PROVIDERS: process.env.PROVIDERS ?? '',
R2_ACCESS_KEY_ID: process.env.R2_ACCESS_KEY_ID ?? '',
Expand Down
8 changes: 8 additions & 0 deletions stacks/upload-db-stack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Table, Bucket, Config } from 'sst/constructs'

import {
allocationTableProps,
storeTableProps,
uploadTableProps,
consumerTableProps,
Expand Down Expand Up @@ -31,6 +32,12 @@ export function UploadDbStack({ stack, app }) {
// TODO: we should look into creating a trust layer for content claims
const contentClaimsPrivateKey = new Config.Secret(stack, 'CONTENT_CLAIMS_PRIVATE_KEY')

/**
* The allocation table tracks allocated multihashes per space.
* Used by the blob/* service capabilities.
*/
const allocationTable = new Table(stack, 'allocation', allocationTableProps)

/**
* This table takes a stored CAR and makes an entry in the store table
* Used by the store/* service capabilities.
Expand Down Expand Up @@ -99,6 +106,7 @@ export function UploadDbStack({ stack, app }) {
const spaceMetricsTable = new Table(stack, 'space-metrics', spaceMetricsTableProps)

return {
allocationTable,
storeTable,
uploadTable,
pieceTable,
Expand Down
Loading

0 comments on commit a35d822

Please sign in to comment.