@@ -54,6 +54,7 @@ pub struct CheckpointDiff<'a> {
54
54
pub updated_buckets : Vec < BucketChecksum < ' a > > ,
55
55
#[ serde( borrow) ]
56
56
pub removed_buckets : Vec < & ' a str > ,
57
+ #[ serde( default ) ]
57
58
#[ serde( deserialize_with = "deserialize_optional_string_to_i64" ) ]
58
59
pub write_checkpoint : Option < i64 > ,
59
60
}
@@ -75,11 +76,13 @@ pub struct CheckpointPartiallyComplete {
75
76
pub struct BucketChecksum < ' a > {
76
77
pub bucket : & ' a str ,
77
78
pub checksum : Checksum ,
79
+ #[ serde( default ) ]
78
80
pub priority : Option < BucketPriority > ,
81
+ #[ serde( default ) ]
79
82
pub count : Option < i64 > ,
80
- // #[serde(default)]
81
- // #[serde(deserialize_with = "deserialize_optional_string_to_i64")]
82
- // pub last_op_id: Option<i64>,
83
+ // #[serde(default)]
84
+ // #[serde(deserialize_with = "deserialize_optional_string_to_i64")]
85
+ // pub last_op_id: Option<i64>,
83
86
}
84
87
85
88
#[ derive( Deserialize , Debug ) ]
@@ -364,15 +367,23 @@ mod tests {
364
367
assert_eq ! ( diff. removed_buckets. len( ) , 0 ) ;
365
368
}
366
369
370
+ #[ test]
371
+ fn parse_checkpoint_diff_no_write_checkpoint ( ) {
372
+ let SyncLine :: CheckpointDiff ( diff) = deserialize (
373
+ r#"{"checkpoint_diff":{"last_op_id":"12","updated_buckets":[{"bucket":"a","count":12,"checksum":0,"priority":3}],"removed_buckets":[]}}"# ,
374
+ ) else {
375
+ panic ! ( "Expected checkpoint diff" )
376
+ } ;
377
+ }
378
+
367
379
#[ test]
368
380
fn parse_checkpoint_complete ( ) {
369
381
assert_matches ! (
370
382
deserialize( r#"{"checkpoint_complete": {"last_op_id": "10"}}"# ) ,
371
- SyncLine :: CheckpointComplete ( CheckpointComplete {
372
- //last_op_id: 10
373
- } )
383
+ SyncLine :: CheckpointComplete ( CheckpointComplete {
384
+ // last_op_id: 10
385
+ } )
374
386
) ;
375
-
376
387
}
377
388
378
389
#[ test]
0 commit comments