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
Unknown Object (File)
Wed, May 1, 2:46 PM
Unknown Object (File)
Apr 6 2024, 5:57 PM
Unknown Object (File)
Apr 2 2024, 8:11 AM
Unknown Object (File)
Apr 2 2024, 12:47 AM
Unknown Object (File)
Apr 2 2024, 12:47 AM
Unknown Object (File)
Apr 2 2024, 12:47 AM
Unknown Object (File)
Apr 2 2024, 12:47 AM
Unknown Object (File)
Apr 2 2024, 12:17 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
Lint Not Applicable
Unit
Tests Not Applicable

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.