@@ -185,10 +185,8 @@ impl WriterConnectionPool {
185185 }
186186}
187187
188- pub struct MasWriter < ' c > {
188+ pub struct MasWriter {
189189 conn : LockedMasDatabase ,
190- // Temporary phantom data, so that we don't remove the lifetime parameter yet
191- phantom : std:: marker:: PhantomData < & ' c ( ) > ,
192190 writer_pool : WriterConnectionPool ,
193191
194192 indices_to_restore : Vec < IndexDescription > ,
@@ -326,7 +324,7 @@ pub async fn is_syn2mas_in_progress(conn: &mut PgConnection) -> Result<bool, Err
326324 }
327325}
328326
329- impl MasWriter < ' _ > {
327+ impl MasWriter {
330328 /// Creates a new MAS writer.
331329 ///
332330 /// # Errors
@@ -448,7 +446,7 @@ impl MasWriter<'_> {
448446
449447 Ok ( Self {
450448 conn,
451- phantom : std :: marker :: PhantomData ,
449+
452450 writer_pool : WriterConnectionPool :: new ( writer_connections) ,
453451 indices_to_restore,
454452 constraints_to_restore,
@@ -1027,37 +1025,37 @@ const WRITE_BUFFER_BATCH_SIZE: usize = 4096;
10271025
10281026/// A function that can accept and flush buffers from a `MasWriteBuffer`.
10291027/// Intended uses are the methods on `MasWriter` such as `write_users`.
1030- type WriteBufferFlusher < ' conn , T > =
1031- for <' a > fn ( & ' a mut MasWriter < ' conn > , Vec < T > ) -> BoxFuture < ' a , Result < ( ) , Error > > ;
1028+ type WriteBufferFlusher < T > =
1029+ for <' a > fn ( & ' a mut MasWriter , Vec < T > ) -> BoxFuture < ' a , Result < ( ) , Error > > ;
10321030
10331031/// A buffer for writing rows to the MAS database.
10341032/// Generic over the type of rows.
10351033///
10361034/// # Panics
10371035///
10381036/// Panics if dropped before `finish()` has been called.
1039- pub struct MasWriteBuffer < ' conn , T > {
1037+ pub struct MasWriteBuffer < T > {
10401038 rows : Vec < T > ,
1041- flusher : WriteBufferFlusher < ' conn , T > ,
1039+ flusher : WriteBufferFlusher < T > ,
10421040 finished : bool ,
10431041}
10441042
1045- impl < ' conn , T > MasWriteBuffer < ' conn , T > {
1046- pub fn new ( flusher : WriteBufferFlusher < ' conn , T > ) -> Self {
1043+ impl < T > MasWriteBuffer < T > {
1044+ pub fn new ( flusher : WriteBufferFlusher < T > ) -> Self {
10471045 MasWriteBuffer {
10481046 rows : Vec :: with_capacity ( WRITE_BUFFER_BATCH_SIZE ) ,
10491047 flusher,
10501048 finished : false ,
10511049 }
10521050 }
10531051
1054- pub async fn finish ( mut self , writer : & mut MasWriter < ' conn > ) -> Result < ( ) , Error > {
1052+ pub async fn finish ( mut self , writer : & mut MasWriter ) -> Result < ( ) , Error > {
10551053 self . finished = true ;
10561054 self . flush ( writer) . await ?;
10571055 Ok ( ( ) )
10581056 }
10591057
1060- pub async fn flush ( & mut self , writer : & mut MasWriter < ' conn > ) -> Result < ( ) , Error > {
1058+ pub async fn flush ( & mut self , writer : & mut MasWriter ) -> Result < ( ) , Error > {
10611059 if self . rows . is_empty ( ) {
10621060 return Ok ( ( ) ) ;
10631061 }
@@ -1067,7 +1065,7 @@ impl<'conn, T> MasWriteBuffer<'conn, T> {
10671065 Ok ( ( ) )
10681066 }
10691067
1070- pub async fn write ( & mut self , writer : & mut MasWriter < ' conn > , row : T ) -> Result < ( ) , Error > {
1068+ pub async fn write ( & mut self , writer : & mut MasWriter , row : T ) -> Result < ( ) , Error > {
10711069 self . rows . push ( row) ;
10721070 if self . rows . len ( ) >= WRITE_BUFFER_BATCH_SIZE {
10731071 self . flush ( writer) . await ?;
@@ -1076,7 +1074,7 @@ impl<'conn, T> MasWriteBuffer<'conn, T> {
10761074 }
10771075}
10781076
1079- impl < T > Drop for MasWriteBuffer < ' _ , T > {
1077+ impl < T > Drop for MasWriteBuffer < T > {
10801078 fn drop ( & mut self ) {
10811079 assert ! ( self . finished, "MasWriteBuffer dropped but not finished!" ) ;
10821080 }
@@ -1185,7 +1183,7 @@ mod test {
11851183 /// Runs some code with a `MasWriter`.
11861184 ///
11871185 /// The callback is responsible for `finish`ing the `MasWriter`.
1188- async fn make_mas_writer ( pool : & PgPool ) -> MasWriter < ' static > {
1186+ async fn make_mas_writer ( pool : & PgPool ) -> MasWriter {
11891187 let main_conn = pool. acquire ( ) . await . unwrap ( ) . detach ( ) ;
11901188 let mut writer_conns = Vec :: new ( ) ;
11911189 for _ in 0 ..2 {
0 commit comments