Page MenuHomePhabricator

[services][backup] AddAttachments 3/4 - main handler logic
ClosedPublic

Authored by bartek on Jan 9 2023, 12:24 PM.
Tags
None
Referenced Files
F3499161: D6206.diff
Thu, Dec 19, 10:46 PM
Unknown Object (File)
Wed, Dec 18, 7:24 PM
Unknown Object (File)
Mon, Dec 16, 3:53 AM
Unknown Object (File)
Fri, Dec 13, 9:39 AM
Unknown Object (File)
Mon, Dec 9, 12:26 PM
Unknown Object (File)
Thu, Nov 28, 11:32 AM
Unknown Object (File)
Thu, Nov 28, 11:32 AM
Unknown Object (File)
Thu, Nov 28, 11:32 AM
Subscribers

Details

Summary

Implemented the actual AddAttachments endpoint logic. In case of logs, it additionally checks if their size doesn't exceed the size limit. Moving their contents to blob service is implemented in the subsequent diff

Depends on D6205

Test Plan

The service can be started along with blob service and localstack and the AddAttachments endpoint can now be called for backups.
Testing logs requires adding LogItems manually to DB, as SendLog endpoint is unimplemented yet.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Jan 9 2023, 12:36 PM
tomek added inline comments.
services/backup/src/service/handlers/add_attachments.rs
65–73 ↗(On Diff #20741)

Are we handling all the cases here? What if log_item.persisted_in_blob is true? Should we still call db.put_log_item?

This revision is now accepted and ready to land.Jan 11 2023, 5:54 AM
services/backup/src/service/handlers/add_attachments.rs
65–73 ↗(On Diff #20741)

Yes, this code is correct.

  1. If the item is not already persisted and is small enough, we store it directly in db
  2. If it is already persisted, then LogItem representation is already correct and we can just save it to db.
  3. If it's not persisted, but became too large, the move_to_blob creates a LogItem database entity representing log stored in blob service. It is implemented in the next diff. Then we put the updated entity into the db.