Page MenuHomePhabricator

[comm-lib] Hide aws behind a feature flag
ClosedPublic

Authored by michal on Dec 8 2023, 7:05 AM.
Tags
None
Referenced Files
F2169203: D10258.id34431.diff
Tue, Jul 2, 10:37 AM
Unknown Object (File)
Sat, Jun 29, 1:44 AM
Unknown Object (File)
Thu, Jun 27, 6:54 PM
Unknown Object (File)
Tue, Jun 25, 11:49 AM
Unknown Object (File)
Tue, Jun 25, 11:49 AM
Unknown Object (File)
Tue, Jun 25, 11:49 AM
Unknown Object (File)
Tue, Jun 25, 11:49 AM
Unknown Object (File)
Mon, Jun 24, 8:11 PM
Subscribers

Details

Summary

While we used aws dependencies in all services, future diffs will make comm-lib a (transitive) dependency of native_rust_library. These dependencies aren't needed there so I'm introducing a new feature flag that hides them and the modules that depend on aws crates.

Test Plan

Check that all services compile

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

michal requested review of this revision.Dec 8 2023, 8:27 AM
services/backup/Cargo.toml
20 ↗(On Diff #34431)
  • Only services require AWS. Clients don't.
  • All services require DDB (I think so)
  • Almost all services require secrets manager (feature flags don't)

Initially I thought about extracting this feature to ddb / database / dynamodb and separating out aws-sdk-secretsmanager.

But you merged them here and perhaps that makes sense. Curious about your reasoning here

shared/comm-lib/src/blob/types.rs
10 ↗(On Diff #34431)

Don't you need to use this mod in clients? Everything compiles though, I got confused 🤨

varun added 1 blocking reviewer(s): bartek.

lgtm but leaving bartek as blocking

bartek added inline comments.
services/backup/Cargo.toml
20 ↗(On Diff #34431)

Never mind, this is probably the best way to go here

This revision is now accepted and ready to land.Dec 14 2023, 12:11 AM
services/backup/Cargo.toml
20 ↗(On Diff #34431)

I don't really have a strong reason, this was just a simplest solution. Before these changes all services included all of aws dependencies so I didn't thought there was a reason to split them up.

But we definitely could have something like:

[features]
aws = ["dep:aws-config", "dep:aws-types"]
dynamodb = ["aws", "aws-sdk-dynamodb"]
secretsmanager = ["aws", "aws-sdk-secrets-manager"]

but I don't feel like we gain much from it.

shared/comm-lib/src/blob/types.rs
10 ↗(On Diff #34431)

To use trait methods you only need to import the trait itself (assuming that's what you meant), the actual implementation can be anywhere. If we defined a trait in db_conversions than we would have to import it.

Simplified example:

trait Trait {
    fn trait_fn(){}
}
struct A;

mod inner {
    use super::{A, Trait};
    impl Trait for A {}
}

mod client {
    use super::{A, Trait};
    fn _run_client() {
        A::trait_fn();
    }
}