File tree Expand file tree Collapse file tree
libsql-wal/src/replication Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ pub struct Injector<IO: Io> {
1818 capacity : usize ,
1919 tx : TxGuardOwned < IO :: File > ,
2020 max_tx_frame_no : u64 ,
21+ previous_durable_frame_no : u64 ,
2122}
2223
2324impl < IO : Io > Injector < IO > {
@@ -37,14 +38,19 @@ impl<IO: Io> Injector<IO> {
3738 } )
3839 }
3940
40- pub fn set_durable ( & self , durable_frame_no : u64 ) {
41+ pub fn set_durable ( & mut self , durable_frame_no : u64 ) {
4142 let mut old = self . wal . durable_frame_no . lock ( ) ;
42- if * old < durable_frame_no {
43- * old = durable_frame_no
44- } {
45- todo ! ( "primary reported older frameno than current" ) ;
43+ if * old <= durable_frame_no {
44+ self . previous_durable_frame_no = * old;
45+ * old = durable_frame_no;
46+ } else {
47+ todo ! ( "primary reported older frame_no than current" ) ;
4648 }
4749 }
50+
51+ pub fn current_durable ( & self ) -> u64 {
52+ * self . wal . durable_frame_no . lock ( )
53+ }
4854 pub async fn insert_frame ( & mut self , frame : Box < Frame > ) -> Result < Option < u64 > > {
4955 let size_after = frame. size_after ( ) ;
5056 self . max_tx_frame_no = self . max_tx_frame_no . max ( frame. header ( ) . frame_no ( ) ) ;
You can’t perform that action at this time.
0 commit comments