@@ -53,6 +53,11 @@ pub struct DownloadSyncStatus {
5353 /// received), information about how far the download has progressed.
5454 pub downloading : Option < SyncDownloadProgress > ,
5555 pub streams : Vec < ActiveStreamSubscription > ,
56+ /// Runtime-only request id from the most recent full checkpoint apply.
57+ ///
58+ /// This is exposed in sync status for SDK internals, but it is not persisted and should not be
59+ /// treated as user-facing download progress.
60+ pub internal_applied_checkpoint_request_id : Option < i64 > ,
5661}
5762
5863impl DownloadSyncStatus {
@@ -73,6 +78,7 @@ impl DownloadSyncStatus {
7378 self . connected = false ;
7479 self . downloading = None ;
7580 self . connecting = true ;
81+ self . internal_applied_checkpoint_request_id = None ;
7682 self . debug_assert_priority_status_is_sorted ( ) ;
7783 }
7884
@@ -117,7 +123,11 @@ impl DownloadSyncStatus {
117123 self . debug_assert_priority_status_is_sorted ( ) ;
118124 }
119125
120- pub fn applied_checkpoint ( & mut self , now : TimestampMicros ) {
126+ pub fn applied_checkpoint (
127+ & mut self ,
128+ now : TimestampMicros ,
129+ applied_checkpoint_request_id : Option < i64 > ,
130+ ) {
121131 self . downloading = None ;
122132 self . priority_status . clear ( ) ;
123133
@@ -126,6 +136,8 @@ impl DownloadSyncStatus {
126136 last_synced_at : Some ( now) ,
127137 has_synced : Some ( true ) ,
128138 } ) ;
139+
140+ self . internal_applied_checkpoint_request_id = applied_checkpoint_request_id;
129141 }
130142}
131143
@@ -137,6 +149,7 @@ impl Default for DownloadSyncStatus {
137149 downloading : None ,
138150 priority_status : Vec :: new ( ) ,
139151 streams : Vec :: new ( ) ,
152+ internal_applied_checkpoint_request_id : None ,
140153 }
141154 }
142155}
@@ -180,12 +193,16 @@ impl Serialize for DownloadSyncStatus {
180193 }
181194 }
182195
183- let mut serializer = serializer. serialize_struct ( "DownloadSyncStatus" , 5 ) ?;
196+ let field_count = 5 + usize:: from ( self . internal_applied_checkpoint_request_id . is_some ( ) ) ;
197+ let mut serializer = serializer. serialize_struct ( "DownloadSyncStatus" , field_count) ?;
184198 serializer. serialize_field ( "connected" , & self . connected ) ?;
185199 serializer. serialize_field ( "connecting" , & self . connecting ) ?;
186200 serializer. serialize_field ( "priority_status" , & self . priority_status ) ?;
187201 serializer. serialize_field ( "downloading" , & self . downloading ) ?;
188202 serializer. serialize_field ( "streams" , & SerializeStreamsWithProgress ( self ) ) ?;
203+ if let Some ( request_id) = self . internal_applied_checkpoint_request_id {
204+ serializer. serialize_field ( "internal_applied_checkpoint_request_id" , & request_id) ?;
205+ }
189206
190207 serializer. end ( )
191208 }
0 commit comments