@@ -148,9 +148,9 @@ final class SyncStatus {
148
148
/// information extracted from the lower priority `2` since each partial sync
149
149
/// in priority `2` necessarily includes a consistent view over data in
150
150
/// priority `1` .
151
- SyncPriorityStatus statusForPriority (BucketPriority priority) {
151
+ SyncPriorityStatus statusForPriority (StreamPriority priority) {
152
152
assert (priorityStatusEntries.isSortedByCompare (
153
- (e) => e.priority, BucketPriority .comparator));
153
+ (e) => e.priority, StreamPriority .comparator));
154
154
155
155
for (final known in priorityStatusEntries) {
156
156
// Lower-priority buckets are synchronized after higher-priority buckets,
@@ -309,7 +309,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
309
309
final sinceLast = savedProgress? .sinceLast ?? 0 ;
310
310
311
311
buckets[bucket.bucket] = (
312
- priority: BucketPriority ._(bucket.priority),
312
+ priority: StreamPriority ._(bucket.priority),
313
313
atLast: atLast,
314
314
sinceLast: sinceLast,
315
315
targetCount: bucket.count ?? 0 ,
@@ -324,7 +324,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
324
324
return InternalSyncDownloadProgress ({
325
325
for (final bucket in target.checksums)
326
326
bucket.bucket: (
327
- priority: BucketPriority (bucket.priority),
327
+ priority: StreamPriority (bucket.priority),
328
328
atLast: 0 ,
329
329
sinceLast: 0 ,
330
330
targetCount: knownCount,
@@ -343,7 +343,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
343
343
344
344
/// Sums the total target and completed operations for all buckets up until
345
345
/// the given [priority] (inclusive).
346
- ProgressWithOperations untilPriority (BucketPriority priority) {
346
+ ProgressWithOperations untilPriority (StreamPriority priority) {
347
347
final (total, downloaded) = buckets.values
348
348
.where ((e) => e.priority >= priority)
349
349
.fold ((0 , 0 ), _addProgress);
@@ -352,18 +352,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
352
352
}
353
353
354
354
ProgressWithOperations _forStream (CoreActiveStreamSubscription subscription) {
355
- final (total, downloaded) = subscription.associatedBuckets.fold (
356
- (0 , 0 ),
357
- (prev, bucket) {
358
- final foundProgress = buckets[bucket];
359
- if (foundProgress == null ) {
360
- return prev;
361
- }
362
-
363
- return _addProgress (prev, foundProgress);
364
- },
365
- );
366
-
355
+ final (: total, : downloaded) = subscription.progress;
367
356
return ProgressWithOperations ._(total, downloaded);
368
357
}
369
358
@@ -475,7 +464,7 @@ extension type SyncDownloadProgress._(InternalSyncDownloadProgress _internal)
475
464
/// The returned [ProgressWithOperations] tracks the target amount of
476
465
/// operations that need to be downloaded in total and how many of them have
477
466
/// already been received.
478
- ProgressWithOperations untilPriority (BucketPriority priority) {
467
+ ProgressWithOperations untilPriority (StreamPriority priority) {
479
468
return _internal.untilPriority (priority);
480
469
}
481
470
}
0 commit comments