[report-service] Implement DB item size checks
Summary:
We're going to store ReportItems in DynamoDB. The maximum item size is 400 KiB. We need to ensure that the items we're storing are not larger than that.
In further diffs, such large reports will be stored in Blob service.
Depends on D8939
Test Plan:
- Created a ReportItem with very long generated string content. Repeatedly increased length.
- Printed value of total_size() and inserted the row to DDB.
- Verified that for values slightly larger than 409600 (400 KiB) insertion failed with ItemTooLargeException.
- When called ensure_size_constraints() for failing items, the todo!() was hit.
- When called for smaller, non-failing items, the function returned early.
Reviewers: michal, patryk, varun, jon
Reviewed By: jon
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D8940