@@ -63,7 +63,7 @@ impl From<tokio::task::JoinError> for Error {
6363
6464#[ async_trait:: async_trait]
6565pub trait ReplicatorClient {
66- type FrameStream : Stream < Item = Result < Frame , Error > > + Unpin + Send ;
66+ type FrameStream : Stream < Item = Result < RpcFrame , Error > > + Unpin + Send ;
6767
6868 /// Perform handshake with remote
6969 async fn handshake ( & mut self ) -> Result < ( ) , Error > ;
@@ -318,7 +318,7 @@ where
318318 }
319319 }
320320
321- async fn inject_frame ( & mut self , frame : Frame ) -> Result < ( ) , Error > {
321+ async fn inject_frame ( & mut self , frame : RpcFrame ) -> Result < ( ) , Error > {
322322 self . frames_synced += 1 ;
323323
324324 match self . injector . inject_frame ( frame) . await ? {
@@ -360,6 +360,7 @@ mod test {
360360 use async_stream:: stream;
361361
362362 use crate :: frame:: { FrameBorrowed , FrameMut } ;
363+ use crate :: rpc:: replication:: Frame as RpcFrame ;
363364
364365 use super :: * ;
365366
@@ -370,7 +371,8 @@ mod test {
370371
371372 #[ async_trait:: async_trait]
372373 impl ReplicatorClient for Client {
373- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
374+ type FrameStream =
375+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
374376
375377 /// Perform handshake with remote
376378 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -414,7 +416,8 @@ mod test {
414416
415417 #[ async_trait:: async_trait]
416418 impl ReplicatorClient for Client {
417- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
419+ type FrameStream =
420+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
418421
419422 /// Perform handshake with remote
420423 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -456,7 +459,8 @@ mod test {
456459
457460 #[ async_trait:: async_trait]
458461 impl ReplicatorClient for Client {
459- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
462+ type FrameStream =
463+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
460464
461465 /// Perform handshake with remote
462466 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -500,7 +504,8 @@ mod test {
500504
501505 #[ async_trait:: async_trait]
502506 impl ReplicatorClient for Client {
503- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
507+ type FrameStream =
508+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
504509
505510 /// Perform handshake with remote
506511 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -544,7 +549,8 @@ mod test {
544549
545550 #[ async_trait:: async_trait]
546551 impl ReplicatorClient for Client {
547- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
552+ type FrameStream =
553+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
548554
549555 /// Perform handshake with remote
550556 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -586,7 +592,8 @@ mod test {
586592
587593 #[ async_trait:: async_trait]
588594 impl ReplicatorClient for Client {
589- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
595+ type FrameStream =
596+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
590597
591598 /// Perform handshake with remote
592599 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -627,7 +634,8 @@ mod test {
627634
628635 #[ async_trait:: async_trait]
629636 impl ReplicatorClient for Client {
630- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
637+ type FrameStream =
638+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
631639
632640 /// Perform handshake with remote
633641 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -672,7 +680,8 @@ mod test {
672680
673681 #[ async_trait:: async_trait]
674682 impl ReplicatorClient for Client {
675- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
683+ type FrameStream =
684+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
676685
677686 /// Perform handshake with remote
678687 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -740,7 +749,8 @@ mod test {
740749
741750 #[ async_trait:: async_trait]
742751 impl ReplicatorClient for Client {
743- type FrameStream = Pin < Box < dyn Stream < Item = Result < Frame , Error > > + Send + ' static > > ;
752+ type FrameStream =
753+ Pin < Box < dyn Stream < Item = Result < RpcFrame , Error > > + Send + ' static > > ;
744754
745755 /// Perform handshake with remote
746756 async fn handshake ( & mut self ) -> Result < ( ) , Error > {
@@ -752,15 +762,26 @@ mod test {
752762 let frames = self
753763 . frames
754764 . iter ( )
765+ . map ( |f| RpcFrame {
766+ data : f. bytes ( ) ,
767+ timestamp : None ,
768+ } )
755769 . take ( 2 )
756- . cloned ( )
757770 . map ( Ok )
758771 . chain ( Some ( Err ( Error :: Client ( "some client error" . into ( ) ) ) ) )
759772 . collect :: < Vec < _ > > ( ) ;
760773 Ok ( Box :: pin ( tokio_stream:: iter ( frames) ) )
761774 } else {
762- let stream = tokio_stream:: iter ( self . frames . clone ( ) . into_iter ( ) . map ( Ok ) ) ;
763- Ok ( Box :: pin ( stream) )
775+ let iter = self
776+ . frames
777+ . iter ( )
778+ . map ( |f| RpcFrame {
779+ data : f. bytes ( ) ,
780+ timestamp : None ,
781+ } )
782+ . map ( Ok )
783+ . collect :: < Vec < _ > > ( ) ;
784+ Ok ( Box :: pin ( tokio_stream:: iter ( iter) ) )
764785 }
765786 }
766787 /// Return a snapshot for the current replication index. Called after next_frame has returned a
0 commit comments