sapling/eden/mononoke/commit_rewriting/live_commit_sync_config/test
Kostia Balytskyi 75db021d70 live_commit_sync_config: make it into a trait
Summary:
The goal is to make it easier to implement unit tests, which depend on `LiveCommitSyncConfig`. Specifically, `scs` has a piece of code, which instantiates `mononoke_api::Repo` with a test version of `CommitSyncConfig`. To migrate it to `LiveCommitSyncConfig`, I need to be able to create a test version of that. It **is** possible now, but would require me to turn a supplied instance of `CommitSyncConfig` back into `json`, which is cumbersome. Using a `dyn LiveCommitSyncConfig` there, instead of a concrete struct seems like a good idea.

Note also that we are using this technique in many places: most (all?) of our DB tables are traits, which we then implement for SQL-specific structs.

Finally, this diff does not actually migrate all of the current users of `LiveCommitSyncConfig` (the struct) to be users of `LiveCommitSyncConfig` (the trait), and instead makes them use `CfgrLiveCommitSyncConfig` (the trait impl). The idea is that we can migrate bits to use traits when needed (for example, in an upcoming `scs` diff). When not needed, it's fine to use concrete structs. Again, this is already the case in a a few places: we sometimes use `SqlSyncedCommitMapping` struct directly, instead of `T: SyncedCommitMapping` or `dyn SyncedCommitMapping`.

Reviewed By: StanislavGlebik

Differential Revision: D22383859

fbshipit-source-id: 8657fa39b11101684c1baae9f26becad6f890302
2020-07-08 08:34:06 -07:00
..
all_changes.rs live_commit_sync_config: make it into a trait 2020-07-08 08:34:06 -07:00
all_simple.rs live_commit_sync_config: make it into a trait 2020-07-08 08:34:06 -07:00
current_changes.rs live_commit_sync_config: make it into a trait 2020-07-08 08:34:06 -07:00
current_invalid.rs live_commit_sync_config: make it into a trait 2020-07-08 08:34:06 -07:00
current_simple.rs live_commit_sync_config: make it into a trait 2020-07-08 08:34:06 -07:00
main.rs live_commit_sync_config: make it into a trait 2020-07-08 08:34:06 -07:00
push_redirection.rs commmit_rewriting: introduce live_commit_sync_config 2020-06-25 03:28:08 -07:00