@@ -58,6 +58,7 @@ void main() {
58
58
'last_op_id' : lastOpId,
59
59
'write_checkpoint' : writeCheckpoint,
60
60
'buckets' : checksums,
61
+ 'priority' : priority,
61
62
})
62
63
]);
63
64
@@ -88,7 +89,9 @@ void main() {
88
89
pushSyncData ('prio1' , '1' , 'row-0' , 'PUT' , {'col' : 'hi' });
89
90
expect (fetchRows (), isEmpty);
90
91
91
- expect (pushCheckpointComplete ('1' , null , [_bucketChecksum ('prio1' , 0 )]),
92
+ expect (
93
+ pushCheckpointComplete (
94
+ '1' , null , [_bucketChecksum ('prio1' , 1 , checksum: 0 )]),
92
95
isTrue);
93
96
expect (fetchRows (), [
94
97
{'id' : 'row-0' , 'col' : 'hi' }
@@ -101,7 +104,9 @@ void main() {
101
104
expect (fetchRows (), isNotEmpty);
102
105
103
106
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 )]),
105
110
isFalse);
106
111
expect (fetchRows (), [
107
112
{'id' : 'local' , 'col' : 'data' }
@@ -118,7 +123,7 @@ void main() {
118
123
pushCheckpointComplete (
119
124
'1' ,
120
125
null ,
121
- [_bucketChecksum ('prio0' , 0 )],
126
+ [_bucketChecksum ('prio0' , 0 , checksum : 0 )],
122
127
priority: 0 ,
123
128
),
124
129
isTrue,
@@ -141,7 +146,16 @@ void main() {
141
146
pushCheckpointComplete (
142
147
'1' ,
143
148
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
+ ],
145
159
priority: i,
146
160
),
147
161
isTrue,
@@ -155,8 +169,8 @@ void main() {
155
169
});
156
170
}
157
171
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};
160
174
}
161
175
162
176
const _schema = {
0 commit comments