awslabs / coldsnap

A command line interface for Amazon EBS snapshots
Apache License 2.0
194 stars 24 forks source link

fix dependency hell: hide foreign types from public interface #301

Open webern opened 10 months ago

webern commented 10 months ago

We have created a dependency hell where tough, pubsys, and testsys all need to update the aws-sdk libraries in lockstep. This is because we have exposed types from these libraries in our public interface. Here is one such example:

https://github.com/awslabs/coldsnap/blob/d2615ece51be73966b82ebc4469516f1fd53cf4f/src/download.rs#L48C20-L48C38

We need to replace these types with types of our own that hide the underlying type. In other words, in the above example, instead of taking an EbsClient as the input, we need to take a coldsnap::Client object that wraps and hides the foreign type.

We should scrub for additional exposed types and consider whether or not they should be hidden. Sometimes libraries are so stable on a major version that it is considered fine/idiomatic to expose them (Url for example), but as a general principle it is a very bad idea to leak someone else's types in a public interface.

Related: https://github.com/awslabs/tough/issues/733