@@ -148,9 +148,9 @@ final class SyncStatus {
148148 /// information extracted from the lower priority `2` since each partial sync
149149 /// in priority `2` necessarily includes a consistent view over data in
150150 /// priority `1` .
151- SyncPriorityStatus statusForPriority (BucketPriority priority) {
151+ SyncPriorityStatus statusForPriority (StreamPriority priority) {
152152 assert (priorityStatusEntries.isSortedByCompare (
153- (e) => e.priority, BucketPriority .comparator));
153+ (e) => e.priority, StreamPriority .comparator));
154154
155155 for (final known in priorityStatusEntries) {
156156 // Lower-priority buckets are synchronized after higher-priority buckets,
@@ -309,7 +309,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
309309 final sinceLast = savedProgress? .sinceLast ?? 0 ;
310310
311311 buckets[bucket.bucket] = (
312- priority: BucketPriority ._(bucket.priority),
312+ priority: StreamPriority ._(bucket.priority),
313313 atLast: atLast,
314314 sinceLast: sinceLast,
315315 targetCount: bucket.count ?? 0 ,
@@ -324,7 +324,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
324324 return InternalSyncDownloadProgress ({
325325 for (final bucket in target.checksums)
326326 bucket.bucket: (
327- priority: BucketPriority (bucket.priority),
327+ priority: StreamPriority (bucket.priority),
328328 atLast: 0 ,
329329 sinceLast: 0 ,
330330 targetCount: knownCount,
@@ -343,7 +343,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
343343
344344 /// Sums the total target and completed operations for all buckets up until
345345 /// the given [priority] (inclusive).
346- ProgressWithOperations untilPriority (BucketPriority priority) {
346+ ProgressWithOperations untilPriority (StreamPriority priority) {
347347 final (total, downloaded) = buckets.values
348348 .where ((e) => e.priority >= priority)
349349 .fold ((0 , 0 ), _addProgress);
@@ -352,18 +352,7 @@ final class InternalSyncDownloadProgress extends ProgressWithOperations {
352352 }
353353
354354 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;
367356 return ProgressWithOperations ._(total, downloaded);
368357 }
369358
@@ -475,7 +464,7 @@ extension type SyncDownloadProgress._(InternalSyncDownloadProgress _internal)
475464 /// The returned [ProgressWithOperations] tracks the target amount of
476465 /// operations that need to be downloaded in total and how many of them have
477466 /// already been received.
478- ProgressWithOperations untilPriority (BucketPriority priority) {
467+ ProgressWithOperations untilPriority (StreamPriority priority) {
479468 return _internal.untilPriority (priority);
480469 }
481470}
0 commit comments