Page MenuHomePhabricator

[services][blob] Introduce HTTP context utils
ClosedPublic

Authored by bartek on Apr 17 2023, 5:57 AM.
Tags
None
Referenced Files
F3719738: D7464.diff
Wed, Jan 8, 11:45 AM
Unknown Object (File)
Sun, Dec 29, 3:17 AM
Unknown Object (File)
Thu, Dec 26, 8:06 PM
Unknown Object (File)
Sun, Dec 15, 6:24 AM
Unknown Object (File)
Sun, Dec 15, 6:24 AM
Unknown Object (File)
Sun, Dec 15, 6:24 AM
Unknown Object (File)
Sun, Dec 15, 6:20 AM
Unknown Object (File)
Dec 7 2024, 7:31 AM
Subscribers

Details

Summary

This diff introduces a AppContext structure that is passed to each HTTP request handler. It contains references
to database and S3 instances along with some utilities that will be used in the handlers.

Depends on D7444

Test Plan

This is not yet used, it will be tested with the next diff.

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.Apr 18 2023, 12:06 AM
jon added inline comments.
services/blob/src/http/context.rs
43–50

if Result<Option<_>> is going to be a theme moving forward, might be nice to create a utility function.

let result = self.db.find_reverse_index_by_holder(holder).await;
handle_db_query(|index|  self.find_s3_path_by_reverse_index(&index).await)

For two "similar usages", I think it would be a pre-mature refactor right now, but a 3rd instance would probably make it worthwhile to clean it up

This revision is now accepted and ready to land.Apr 18 2023, 8:06 AM