ozvault home

ENGINEERING NOTES

Why encrypted storage needs quota reservations

How OzVault counts ciphertext bytes, reserves space during concurrent uploads, and keeps usage consistent through retries and deletion.

The race hidden inside two uploads

#

Two clients can both see enough remaining storage and begin uploading at the same time. A visual meter cannot enforce a limit. OzVault uses a database transaction to lock the account and reserve the full ciphertext size before accepting an upload.

Count what the disk actually stores

#

AES-GCM adds a 16-byte authentication tag to each chunk. Those bytes count toward quota. Retained deleted objects also consume storage. When completion succeeds, reserved bytes move to used bytes in one transaction; retries do not add them twice.

Capacity is a separate constraint

#

An account can have quota remaining while the physical disk approaches its safety reserve. The backend checks both. New allocations and paid-plan commitments need capacity accounting, and low disk space pauses uploads to protect already stored files.

Recovery completes the design

#

Interrupted chunks are reconciled to the committed database offset. Expired reservations are released by maintenance. A completed ciphertext file is checksum-verified before it is exposed as an object. Integrity scans and independent backup restore tests remain operator responsibilities.

Clear documentation is part of the product.