11
11
//! This module does not implement any of the safety checks that should be run
12
12
//! *before* the migration.
13
13
14
- use std:: { collections :: HashMap , pin:: pin, time:: Instant } ;
14
+ use std:: { pin:: pin, time:: Instant } ;
15
15
16
16
use chrono:: { DateTime , Utc } ;
17
17
use compact_str:: CompactString ;
@@ -36,7 +36,7 @@ use crate::{
36
36
self , ExtractLocalpartError , FullUserId , SynapseAccessToken , SynapseDevice ,
37
37
SynapseExternalId , SynapseRefreshableTokenPair , SynapseThreepid , SynapseUser ,
38
38
} ,
39
- SynapseReader ,
39
+ HashMap , RandomState , SynapseReader ,
40
40
} ;
41
41
42
42
#[ derive( Debug , Error , ContextInto ) ]
@@ -109,7 +109,7 @@ struct MigrationState {
109
109
110
110
/// A mapping of Synapse external ID providers to MAS upstream OAuth 2.0
111
111
/// provider ID
112
- provider_id_mapping : HashMap < String , Uuid > ,
112
+ provider_id_mapping : std :: collections :: HashMap < String , Uuid > ,
113
113
}
114
114
115
115
/// Performs a migration from Synapse's database to MAS' database.
@@ -132,7 +132,7 @@ pub async fn migrate(
132
132
server_name : String ,
133
133
clock : & dyn Clock ,
134
134
rng : & mut impl RngCore ,
135
- provider_id_mapping : HashMap < String , Uuid > ,
135
+ provider_id_mapping : std :: collections :: HashMap < String , Uuid > ,
136
136
) -> Result < ( ) , Error > {
137
137
let span = Span :: current ( ) ;
138
138
span. pb_set_message ( "counting work" ) ;
@@ -143,8 +143,11 @@ pub async fn migrate(
143
143
server_name,
144
144
// We oversize the hashmaps, as the estimates are innaccurate, and we would like to avoid
145
145
// reallocations.
146
- users : HashMap :: with_capacity ( counts. users * 9 / 8 ) ,
147
- devices_to_compat_sessions : HashMap :: with_capacity ( counts. devices * 9 / 8 ) ,
146
+ users : HashMap :: with_capacity_and_hasher ( counts. users * 9 / 8 , RandomState :: default ( ) ) ,
147
+ devices_to_compat_sessions : HashMap :: with_capacity_and_hasher (
148
+ counts. devices * 9 / 8 ,
149
+ RandomState :: default ( ) ,
150
+ ) ,
148
151
provider_id_mapping,
149
152
} ;
150
153
0 commit comments