Goal
Replace every use of Arc<Box<dyn Database>> in production and test code with the specific narrow trait the consumer actually needs (AuthKeyStore, TorrentMetricsStore, WhitelistStore, or SchemaMigrator). After this subissue the Database aggregate supertrait becomes a purely internal compile-time guard that is no longer part of the public surface of tracker-core.
Background
Subissue #1525-04 (#1713) introduced the four narrow traits and kept Database as an aggregate supertrait so that consumer call sites did not need to change.
Now that the structural split is in place, this subissue wires consumers to the narrow traits they actually need.
Spec
Full spec: docs/issues/1525-04b-migrate-consumers-to-narrow-traits.md
Tasks
- Introduce
DatabaseStores struct
- Update
initialize_database return type to DatabaseStores
- Update
TrackerCoreContainer to use DatabaseStores
- Update individual consumers to accept narrow traits
- Update tests in
authentication/handler.rs (use MockAuthKeyStore directly)
- Update
axum-rest-tracker-api-server test helper force_database_error
- Update benchmark binary operations to accept narrow traits
- Make
Database private (stop re-exporting from databases/mod.rs)
Acceptance Criteria
References
Goal
Replace every use of
Arc<Box<dyn Database>>in production and test code with the specific narrow trait the consumer actually needs (AuthKeyStore,TorrentMetricsStore,WhitelistStore, orSchemaMigrator). After this subissue theDatabaseaggregate supertrait becomes a purely internal compile-time guard that is no longer part of the public surface oftracker-core.Background
Subissue #1525-04 (#1713) introduced the four narrow traits and kept
Databaseas an aggregate supertrait so that consumer call sites did not need to change.Now that the structural split is in place, this subissue wires consumers to the narrow traits they actually need.
Spec
Full spec:
docs/issues/1525-04b-migrate-consumers-to-narrow-traits.mdTasks
DatabaseStoresstructinitialize_databasereturn type toDatabaseStoresTrackerCoreContainerto useDatabaseStoresauthentication/handler.rs(useMockAuthKeyStoredirectly)axum-rest-tracker-api-servertest helperforce_database_errorDatabaseprivate (stop re-exporting fromdatabases/mod.rs)Acceptance Criteria
Arc<Box<dyn Database>>appears only insidedatabases/(driver + traits)Databaseis no longer re-exported fromdatabases/mod.rsauthentication/handler.rsuseMockAuthKeyStoredirectlyforce_database_errorhelper inaxum-rest-tracker-api-serveris updatedcargo test --workspace --all-targetspasseslinter allexits with code0References