Save on the laptop
Say a person edits a few pages of a 2 GB file, for example. The app splits it into blocks named by their hash and sends only what the server lacks; Dropbox describes 4 MB blocks hashed with SHA-256 (Dropbox tech blog (opens in a new tab)).
- The app hashes each block and asks the block service which hashes are missing: for a few pages, two or three.
- It uploads only those, to temporary keys with signed URLs; after a drop, it resends only unfinished blocks.
- The block service checks each block against its hash and size, then publishes it under that name only if none exists yet.
- The app commits the new version as the ordered list of hashes, naming the version it was made from.
- In one transaction, the metadata database records the version and appends a change-log entry.
Diagram as text
Components: Laptop app (Client); Block service (Service); Object storage (Object store); Metadata service (Service); Metadata DB (SQL DB). Connections: Laptop app → Block service (1. which hashes are missing?); Laptop app → Object storage (2. PUT missing blocks to temporary keys); Block service → Object storage (3. check hash, publish if absent); Laptop app → Metadata service (4. commit: block list, base version); Metadata service → Metadata DB (5. version and log entry, one transaction).
Read:Learn: Large file upload & blob handlingLearn: S3 / Blob Storage
Keep reading+1 min
Publishing a block safely
Blocks are shared, so a buggy or malicious client mustn’t be able to write the bytes behind a hash someone else relies on. Upload to a temporary key, check the hash and the signed size, then publish with a create-if-absent write. S3 accepts a write with If-None-Match: * only when no object with that key exists (Amazon S3 docs (opens in a new tab)), and Google Cloud Storage does the same with a generation-match precondition of 0 (Google Cloud docs (opens in a new tab)).