@@ -58,6 +58,7 @@ void main() {
5858 'last_op_id' : lastOpId,
5959 'write_checkpoint' : writeCheckpoint,
6060 'buckets' : checksums,
61+ 'priority' : priority,
6162 })
6263 ]);
6364
@@ -88,7 +89,9 @@ void main() {
8889 pushSyncData ('prio1' , '1' , 'row-0' , 'PUT' , {'col' : 'hi' });
8990 expect (fetchRows (), isEmpty);
9091
91- expect (pushCheckpointComplete ('1' , null , [_bucketChecksum ('prio1' , 0 )]),
92+ expect (
93+ pushCheckpointComplete (
94+ '1' , null , [_bucketChecksum ('prio1' , 1 , checksum: 0 )]),
9295 isTrue);
9396 expect (fetchRows (), [
9497 {'id' : 'row-0' , 'col' : 'hi' }
@@ -101,7 +104,9 @@ void main() {
101104 expect (fetchRows (), isNotEmpty);
102105
103106 pushSyncData ('prio1' , '1' , 'row-0' , 'PUT' , {'col' : 'hi' });
104- expect (pushCheckpointComplete ('1' , null , [_bucketChecksum ('prio1' , 0 )]),
107+ expect (
108+ pushCheckpointComplete (
109+ '1' , null , [_bucketChecksum ('prio1' , 1 , checksum: 0 )]),
105110 isFalse);
106111 expect (fetchRows (), [
107112 {'id' : 'local' , 'col' : 'data' }
@@ -118,7 +123,7 @@ void main() {
118123 pushCheckpointComplete (
119124 '1' ,
120125 null ,
121- [_bucketChecksum ('prio0' , 0 )],
126+ [_bucketChecksum ('prio0' , 0 , checksum : 0 )],
122127 priority: 0 ,
123128 ),
124129 isTrue,
@@ -141,7 +146,16 @@ void main() {
141146 pushCheckpointComplete (
142147 '1' ,
143148 null ,
144- [_bucketChecksum ('prio$i ' , 0 )],
149+ [
150+ for (var j = 0 ; j <= 4 ; j++ )
151+ _bucketChecksum (
152+ 'prio$j ' ,
153+ j,
154+ // Give buckets outside of the current priority a wrong
155+ // checksum. They should not be validated yet.
156+ checksum: j <= i ? 0 : 1234 ,
157+ ),
158+ ],
145159 priority: i,
146160 ),
147161 isTrue,
@@ -155,8 +169,8 @@ void main() {
155169 });
156170}
157171
158- Object ? _bucketChecksum (String bucket, int checksum) {
159- return {'bucket' : bucket, 'checksum' : checksum};
172+ Object ? _bucketChecksum (String bucket, int prio, { int checksum = 0 } ) {
173+ return {'bucket' : bucket, 'priority' : prio, ' checksum': checksum};
160174}
161175
162176const _schema = {
0 commit comments