Adding AddAttachment method to the backup proto file, plus generating according files with the protobuf.
The idea is, that we first upload a new backup/log, and only after that, we separately upload attachments for it.
An alternative solution would be to inject uploading attachments when uploading a new backup/log but I decided it would be messier, the logic, in the end, would get too complicated, and having the solution I'm proposing here, we end up with more isolated and reusable code that is easier to maintain and understand.
The fields we require in the AddAttachmentRequest:
- userID - we need this to be ale to fetch the proper backup item.
- backupID - we need this to be ale to fetch the proper backup item.
- logID - optional we need this to be able to fetch the proper log item only if the attachment is about to be appended to the log item. If this is empty, it means we're appending to the backup item.
- dataHash - we need this so we can upload the data to the blob.
- dataChunk - chunks of the attachment.