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

feat: initial implementation #2

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Mar 4, 2022

Adds assemble-cars lambda implementation.

It is worth mentioning that it follows same patterns as used in IPFS Elastic Provider:

  • Pino log
  • Build and deploy script

TODO:

  • Add secrets

Closes nftstorage/nftstorage.link#20

@vasco-santos vasco-santos force-pushed the feat/initial-implementation branch 4 times, most recently from 6d4ff22 to 264452c Compare March 4, 2022 16:56
@vasco-santos vasco-santos force-pushed the feat/initial-implementation branch from 264452c to c368952 Compare March 4, 2022 17:16
@vasco-santos vasco-santos force-pushed the feat/initial-implementation branch 4 times, most recently from 406a735 to bb7b650 Compare March 11, 2022 16:38
@vasco-santos vasco-santos force-pushed the feat/initial-implementation branch from bb7b650 to 1b51a4e Compare March 11, 2022 16:46
@vasco-santos vasco-santos marked this pull request as ready for review March 11, 2022 16:46
@vasco-santos vasco-santos force-pushed the feat/initial-implementation branch from f24c960 to 25fd570 Compare March 15, 2022 10:09

There are a few assumptions in place and this lambda function will assemble CARs if:
- S3 Object Metadata has a "Complete" structure
- S3 Object has a DagPB encoded root with a known size __acceptable__ (100MB) and the S3 directory for that root CID already has all the DAG chunks
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: Need to tweak size yet

@vasco-santos vasco-santos force-pushed the feat/initial-implementation branch from 754bcd5 to 8d472fd Compare March 15, 2022 10:21
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
Copy link

@olizilla olizilla Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why test on node 14 when the deploy script uses 16?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS does not support node16 https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

Deploy script is irrelevant, but I think we can change to 14

const cbor = require('@ipld/dag-cbor')
const pb = require('@ipld/dag-pb')

const MAX_BLOCK_SIZE = 1 << 20 // Maximum permitted block size in bytes (1MiB).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const MAX_BLOCK_SIZE = 1 << 20 // Maximum permitted block size in bytes (1MiB).
const MAX_BLOCK_SIZE = 1 << 21 // Maximum permitted block size in bytes (2MiB).

since https://github.com/web3-storage/web3.storage/pull/1269/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assemble CARs aws lambda function
2 participants