refactors upload to R2 to handle via chunks, reformats manifest #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Now uploads chunks of files. Process is as follows:
manifest.json
from remote URL. If not present, starts archival from beginning. If present, it begins at end of last chunk (if chunk was finalized), or beginning of block if chunk was not finalized (will overwrite outdated chunk).blocks.byteRanges.csv
is created to provide byte ranges for each blockfinalized
blocks
binary is not compressed since very little compression occurs.blocks.byteRanges.csv
isgz
compressed.manifest.json
is updated to contain new block. If last block recorded in manifest was not finalized, it is overwritten by new upload. Otherwise it is appended to end ofmanifest.json
This way, a new snapshot is created each 24 hours (whether 50MB limit is reached or not), and references the correct folder paths.
NOTE: Lifecycle policy on the buckets are infinite retention for
finalized
files. Fornon-finalized
, the policy sets to 7 day retention (since they will be overwritten).General implementation notes:
manifest.json
is now in new format below.example/scripts/download-blocks.ts
to reflect new structuremanifest.json
Testing
Testing screenshots and logs:
Fixes IFL-2421