@@ -25,6 +25,14 @@ use ::util;
25
25
26
26
const SYNC_IGNORE_KEY : & ' static str = "sync:incoming:ignore" ;
27
27
28
+ #[ derive( Serialize , Deserialize , Debug ) ]
29
+ pub struct SyncResponseExtra {
30
+ #[ serde( default ) ]
31
+ current_size : Option < i64 > ,
32
+ #[ serde( default ) ]
33
+ max_size : Option < i64 > ,
34
+ }
35
+
28
36
/// Defines a struct for deserializing our incoming sync response
29
37
#[ derive( Deserialize , Debug ) ]
30
38
struct SyncResponse {
@@ -33,6 +41,9 @@ struct SyncResponse {
33
41
#[ serde( default ) ]
34
42
#[ serde( deserialize_with = "::util::ser::str_i64_converter::deserialize" ) ]
35
43
sync_id : i64 ,
44
+ /// extra data returned from the sync system
45
+ #[ serde( default ) ]
46
+ extra : Option < SyncResponseExtra > ,
36
47
}
37
48
38
49
struct Handlers {
@@ -232,7 +243,7 @@ impl SyncIncoming {
232
243
if !self . is_enabled ( ) && !force { return Ok ( ( ) ) ; }
233
244
234
245
// destructure our response
235
- let SyncResponse { sync_id, records } = syncdata;
246
+ let SyncResponse { sync_id, records, extra } = syncdata;
236
247
237
248
// grab sync ids we're ignoring
238
249
let ignored = self . get_ignored ( ) ?;
@@ -284,6 +295,11 @@ impl SyncIncoming {
284
295
// syncs and process them
285
296
messaging:: app_event ( "sync:incoming" , & ( ) ) ?;
286
297
298
+ // if we have extra sync data, send it off to the ui
299
+ if let Some ( extra) = extra. as_ref ( ) {
300
+ messaging:: ui_event ( "sync:incoming:extra" , extra) ?;
301
+ }
302
+
287
303
// clear out the sync ignore list
288
304
match self . clear_ignored ( ) {
289
305
Ok ( _) => { } ,
0 commit comments