Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions app/lib/fake/backend/fake_pub_worker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import 'package:gcloud/service_scope.dart';
import 'package:http/http.dart';
import 'package:http_parser/http_parser.dart';
import 'package:indexed_blob/indexed_blob.dart';
import 'package:meta/meta.dart';
import 'package:pana/pana.dart';
import 'package:path/path.dart' as p;
import 'package:pub_dev/fake/backend/fake_pana_runner.dart';
Expand Down Expand Up @@ -303,8 +302,7 @@ Future<void> _upload(
);
}, retryIf: (e) => e is IOException || e is IntermittentUploadException);

@sealed
class UploadException implements Exception {
final class UploadException implements Exception {
final String message;

UploadException(this.message);
Expand All @@ -313,8 +311,7 @@ class UploadException implements Exception {
String toString() => message;
}

@sealed
class IntermittentUploadException extends UploadException {
final class IntermittentUploadException extends UploadException {
IntermittentUploadException(String message) : super(message);
}

Expand Down
3 changes: 1 addition & 2 deletions app/lib/shared/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ const _fakeExternalAudience = 'https://pub.dev';
/// The configuration define the location of the Datastore with the
/// package metadata and the Cloud Storage bucket for the actual package
/// tar files.
@sealed
@JsonSerializable(
anyMap: true,
explicitToJson: true,
checked: true,
disallowUnrecognizedKeys: true,
)
class Configuration {
final class Configuration {
/// The name of the Cloud Storage bucket to use for storing the uploaded
/// package archives.
///
Expand Down
11 changes: 4 additions & 7 deletions app/lib/task/cloudcompute/cloudcompute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:meta/meta.dart';

/// Interface describing an instance.
abstract class CloudInstance {
/// Unique instance name.
Expand Down Expand Up @@ -105,11 +103,10 @@ abstract class CloudCompute {
///
/// The caller is expected to back-off using the zone for a while before trying
/// to create new VMs in the zone again.
@sealed
class ZoneExhaustedException implements Exception {
final class ZoneExhaustedException implements Exception {
final String zone;

final String message;

ZoneExhaustedException(this.zone, this.message);

@override
Expand All @@ -121,9 +118,9 @@ class ZoneExhaustedException implements Exception {
///
/// The caller is expected to back-off for a while before trying to create
/// new VMs.
@sealed
class QuotaExhaustedException implements Exception {
final class QuotaExhaustedException implements Exception {
final String message;

QuotaExhaustedException(this.message);

@override
Expand Down
7 changes: 2 additions & 5 deletions app/lib/task/cloudcompute/fakecloudcompute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'dart:io';
import 'package:clock/clock.dart';
import 'package:collection/collection.dart';
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;
import 'package:pub_dev/frontend/static_files.dart';

Expand All @@ -18,8 +17,7 @@ final _log = Logger('pub.fakecloudcompute');

typedef InstanceRunner = Future<void> Function(FakeCloudInstance instance);

@sealed
class FakeCloudCompute extends CloudCompute {
final class FakeCloudCompute extends CloudCompute {
var _nextInstanceId = 1;
final _instances = <FakeCloudInstance>{};
final InstanceRunner _instanceRunner;
Expand Down Expand Up @@ -221,8 +219,7 @@ Future<void> _defaultInstanceRunner(FakeCloudInstance instance) async {
_log.info('pub_worker exit code: $exitCode');
}

@sealed
class FakeCloudInstance extends CloudInstance {
final class FakeCloudInstance extends CloudInstance {
@override
final String instanceName;

Expand Down
8 changes: 3 additions & 5 deletions app/lib/task/cloudcompute/googlecloudcompute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'package:googleapis/compute/v1.dart' hide Duration;
import 'package:googleapis/compute/v1.dart' as compute_v1 show Duration;
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart' show Logger;
import 'package:meta/meta.dart';
import 'package:pub_dev/shared/utils.dart' show createUuid;
import 'package:pub_dev/task/cloudcompute/cloudcompute.dart';
import 'package:retry/retry.dart';
Expand Down Expand Up @@ -221,7 +220,7 @@ Future<void> deleteAbandonedInstances({
}
}

class _GoogleCloudInstance extends CloudInstance {
final class _GoogleCloudInstance extends CloudInstance {
/// GCP zone this instance exists inside.
@override
final String zone;
Expand All @@ -248,7 +247,7 @@ class _GoogleCloudInstance extends CloudInstance {
}
}

class _PendingGoogleCloudInstance extends CloudInstance {
final class _PendingGoogleCloudInstance extends CloudInstance {
/// GCP zone this instance exists inside.
@override
final String zone;
Expand Down Expand Up @@ -304,8 +303,7 @@ final _validInstanceNamePattern = RegExp(r'^[a-z]([-a-z0-9]*[a-z0-9])?$');
String _shellSingleQuote(String string) =>
"'${string.replaceAll("'", "'\\''")}'";

@sealed
class _GoogleCloudCompute extends CloudCompute {
final class _GoogleCloudCompute extends CloudCompute {
final ComputeApi _api;

/// GCP project this instance is managing VMs inside.
Expand Down
6 changes: 2 additions & 4 deletions app/test/task/fake_time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'dart:math';

import 'package:clock/clock.dart';
import 'package:collection/collection.dart';
import 'package:meta/meta.dart' show sealed;

// TODO(jonasfj): Document this concept, maybe give it a better name and see if
// we can publish it as a separate package. Maybe, it should be
Expand All @@ -16,8 +15,7 @@ import 'package:meta/meta.dart' show sealed;
// Or something else clever, without being too clever!
// Or maybe we should rename _TravelingTimer to _FakeTimer.

@sealed
abstract class FakeTime {
abstract final class FakeTime {
FakeTime._();

Future<void> elapse({
Expand Down Expand Up @@ -88,7 +86,7 @@ abstract class FakeTime {
}
}

class _FakeTime extends FakeTime {
final class _FakeTime extends FakeTime {
final DateTime Function() _originalTime;
Duration _offset;

Expand Down
7 changes: 2 additions & 5 deletions pkg/_pub_shared/lib/data/task_payload.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import 'dart:collection';

import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';

part 'task_payload.g.dart';

/// JSON payload given as single argument to the `pub_worker.dart` command.
@sealed
@JsonSerializable()
class Payload {
final class Payload {
/// Package name of the package to be processed.
final String package;

Expand Down Expand Up @@ -49,9 +47,8 @@ class Payload {
}

/// Pair of [version] and [token].
@sealed
@JsonSerializable()
class VersionTokenPair {
final class VersionTokenPair {
/// Version of [Payload.package] to be processed.
final String version;

Expand Down
10 changes: 3 additions & 7 deletions pkg/indexed_blob/lib/indexed_blob.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import 'dart:convert' show utf8;
import 'dart:typed_data';
import 'package:jsontool/jsontool.dart'
show JsonReader, jsonStringWriter, JsonSink;
import 'package:meta/meta.dart';

export 'src/blobindexpair.dart' show BlobIndexPair;

Expand All @@ -48,8 +47,7 @@ export 'src/blobindexpair.dart' show BlobIndexPair;
/// // Finish building, and create the index
/// await File('mydata.index').writeBytes();
/// ```
@sealed
class IndexedBlobBuilder {
final class IndexedBlobBuilder {
final StreamSink<List<int>> _blob;
int _offset = 0;
final Map<String, dynamic> _index = {};
Expand Down Expand Up @@ -225,8 +223,7 @@ bool _skipUntilKey(JsonReader r, String key) {
/// }
/// ```
///
@sealed
class BlobIndex {
final class BlobIndex {
final Uint8List _indexFile;

/// Create [BlobIndex] from [indexFile] contents.
Expand Down Expand Up @@ -411,8 +408,7 @@ class BlobIndex {
}

/// Range of a file in an indexed-blob.
@sealed
class FileRange {
final class FileRange {
/// Path that was looked up in [BlobIndex].
final String path;

Expand Down
4 changes: 1 addition & 3 deletions pkg/indexed_blob/lib/src/blobindexpair.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import 'dart:io' show Directory, File, gzip;
import 'dart:typed_data' show Uint8List;

import 'package:async/async.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;
import '../indexed_blob.dart' show IndexedBlobBuilder, BlobIndex;

/// Pair containing and in-memory [blob] and matching [index].
@sealed
class BlobIndexPair {
final class BlobIndexPair {
/// Blob indexed by [index].
final Uint8List blob;

Expand Down
4 changes: 1 addition & 3 deletions pkg/pub_worker/lib/src/sdks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
import 'dart:io';

import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;
import 'package:pub_semver/pub_semver.dart' show Version;

@sealed
class InstalledSdk {
final class InstalledSdk {
final String kind;
final String path;
final Version version;
Expand Down
7 changes: 2 additions & 5 deletions pkg/pub_worker/lib/src/upload.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:http/http.dart'
show Client, ClientException, MultipartFile, MultipartRequest, Response;
import 'package:http_parser/http_parser.dart' show MediaType;
import 'package:logging/logging.dart' show Logger;
import 'package:meta/meta.dart';
import 'package:retry/retry.dart' show retry;

final _log = Logger('pub_worker.upload');
Expand Down Expand Up @@ -69,8 +68,7 @@ Future<void> upload(
e is TimeoutException,
delayFactor: Duration(seconds: 5));

@sealed
class UploadException implements Exception {
final class UploadException implements Exception {
final String message;

UploadException(this.message);
Expand All @@ -79,7 +77,6 @@ class UploadException implements Exception {
String toString() => message;
}

@sealed
class IntermittentUploadException extends UploadException {
final class IntermittentUploadException extends UploadException {
IntermittentUploadException(String message) : super(message);
}
Loading