library renaming, removed unused method, fix creation of TimeoutException
R=lrn@google.com
Review URL: https://codereview.chromium.org//1025293003
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 372014e..a1e21fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,10 @@
-# Changelog
+###0.2.0
-## 0.1.0
+* Renamed library `isolaterunner.dart` to `isolate_runner.dart`.
+* Renamed library `loadbalancer.dart' to `load_balancer.dart`.
-- Initial version
- Adds IsolateRunner as a helper around Isolate.
- Adds single-message port helpers and a load balancer.
+###0.1.0
+* Initial version
+* Adds IsolateRunner as a helper around Isolate.
+* Adds single-message port helpers and a load balancer.
diff --git a/README.md b/README.md
index e02d3b7..0e229eb 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
### Working with isolates and running functions in other isolates.
-The "isolaterunner.dart" sub-library introduces an `IsolateRunner` class
+The "isolate_runner.dart" sub-library introduces an `IsolateRunner` class
that gives easy access to the `Isolate` functionality, and also
gives a way to run new functions in the isolate repeatedly, instead of
just on the initial `spawn` call.
@@ -23,7 +23,7 @@
### Balancing load accross several isolates.
-The "loadbalancer.dart" sub-library can manage multiple `Runner` objects,
+The "load_balancer.dart" sub-library can manage multiple `Runner` objects,
including `IsolateRunner`, and run functions on the currently least loaded
runner.
diff --git a/example/http-server.dart b/example/http_server.dart
similarity index 97%
rename from example/http-server.dart
rename to example/http_server.dart
index 00aa66b..2a96478 100644
--- a/example/http-server.dart
+++ b/example/http_server.dart
@@ -2,14 +2,15 @@
// 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.
-library dart.pkg.isolate.sample.httpserver;
+library isolate.example.http_server;
-import "dart:io";
import "dart:async";
+import "dart:io";
import "dart:isolate";
-import "package:isolate/isolaterunner.dart";
-import "package:isolate/runner.dart";
+
+import 'package:isolate/isolate_runner.dart';
import "package:isolate/ports.dart";
+import "package:isolate/runner.dart";
typedef Future RemoteStop();
diff --git a/example/runner-pool.dart b/example/runner_pool.dart
similarity index 89%
rename from example/runner-pool.dart
rename to example/runner_pool.dart
index a14e06d..8422916 100644
--- a/example/runner-pool.dart
+++ b/example/runner_pool.dart
@@ -2,11 +2,12 @@
// 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.
-library dart.pkg.isolate.sample.runners;
+library isolate.example.runner_pool;
-import "package:isolate/loadbalancer.dart";
-import "package:isolate/isolaterunner.dart";
-import "dart:async" show Future, Completer;
+import 'dart:async' show Future, Completer;
+
+import 'package:isolate/load_balancer.dart';
+import 'package:isolate/isolate_runner.dart';
void main() {
int N = 44;
diff --git a/lib/isolate.dart b/lib/isolate.dart
index b0a9a31..268a232 100644
--- a/lib/isolate.dart
+++ b/lib/isolate.dart
@@ -3,10 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
/// Utilities for working with isolates and isolate communication.
-library dart.pkg.isolate;
+library isolate;
-export "isolaterunner.dart";
-export "loadbalancer.dart";
-export "ports.dart";
-export "registry.dart";
-export "runner.dart";
+export 'isolate_runner.dart';
+export 'load_balancer.dart';
+export 'ports.dart';
+export 'registry.dart';
+export 'runner.dart';
diff --git a/lib/isolaterunner.dart b/lib/isolate_runner.dart
similarity index 98%
rename from lib/isolaterunner.dart
rename to lib/isolate_runner.dart
index 795a10f..2d18095 100644
--- a/lib/isolaterunner.dart
+++ b/lib/isolate_runner.dart
@@ -2,13 +2,14 @@
// 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.
-library dart.pkg.isolate.isolaterunner;
+library isolate.isolate_runner;
-import "dart:isolate";
import "dart:async";
-import "runner.dart";
-import "ports.dart";
-import "src/lists.dart";
+import "dart:isolate";
+
+import 'ports.dart';
+import 'runner.dart';
+import 'src/lists.dart';
// Command tags. Shared between IsolateRunner and IsolateRunnerRemote.
const int _SHUTDOWN = 0;
@@ -133,7 +134,6 @@
}
static bool _kTrue(_) => true;
- static bool _kFalse() => false;
/// Pauses the isolate.
///
diff --git a/lib/loadbalancer.dart b/lib/load_balancer.dart
similarity index 98%
rename from lib/loadbalancer.dart
rename to lib/load_balancer.dart
index d71d023..7e19586 100644
--- a/lib/loadbalancer.dart
+++ b/lib/load_balancer.dart
@@ -3,12 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
/// A load-balancing runner pool.
-library dart.pkg.isolate.loadbalancer;
+library isolate.load_balancer;
-import "runner.dart";
-import "src/errors.dart";
-import "src/lists.dart";
-import "dart:async" show Future;
+import 'dart:async' show Future;
+
+import 'runner.dart';
+import 'src/errors.dart';
+import 'src/lists.dart';
/// A pool of runners, ordered by load.
///
diff --git a/lib/ports.dart b/lib/ports.dart
index a007ff3..f68a79f 100644
--- a/lib/ports.dart
+++ b/lib/ports.dart
@@ -17,10 +17,11 @@
///
/// Other functions intercept the returned value and either
/// does something with it, or puts it into a [Future] or [Completer].
-library dart.pkg.isolate.ports;
+library isolate.ports;
-import "dart:isolate";
import "dart:async";
+import "dart:isolate";
+
import "src/lists.dart";
/// Create a [SendPort] that accepts only one message.
@@ -299,7 +300,8 @@
_receivePort.close();
if (!_completer.isCompleted) {
if (throwOnTimeout) {
- _completer.completeError(new TimeoutException(timeout));
+ _completer.completeError(
+ new TimeoutException('Timeout waiting for response', timeout));
} else if (onTimeout != null) {
_completer.complete(new Future.sync(onTimeout));
} else {
diff --git a/lib/registry.dart b/lib/registry.dart
index 6b9448c..ddc801a 100644
--- a/lib/registry.dart
+++ b/lib/registry.dart
@@ -3,13 +3,14 @@
// BSD-style license that can be found in the LICENSE file.
/// An isolate-compatible object registry and lookup service.
-library dart.pkg.isolate.registry;
+library isolate.registry;
-import "dart:async" show Future, Completer, TimeoutException;
-import "dart:isolate" show RawReceivePort, SendPort, Capability;
-import "dart:collection" show HashMap, HashSet;
-import "ports.dart";
-import "src/lists.dart";
+import 'dart:async' show Future, Completer, TimeoutException;
+import 'dart:collection' show HashMap, HashSet;
+import 'dart:isolate' show RawReceivePort, SendPort, Capability;
+
+import 'ports.dart';
+import 'src/lists.dart';
// Command tags.
const int _ADD = 0;
diff --git a/lib/runner.dart b/lib/runner.dart
index 4f0a187..60e488a 100644
--- a/lib/runner.dart
+++ b/lib/runner.dart
@@ -4,9 +4,9 @@
/// A [Runner] runs a function, potentially in a different scope
/// or even isolate.
-library dart.pkg.isolate.runner;
+library isolate.runner;
-import "dart:async" show Future;
+import 'dart:async' show Future;
/// Calls a function with an argument.
///
diff --git a/lib/src/errors.dart b/lib/src/errors.dart
index f724580..55b3837 100644
--- a/lib/src/errors.dart
+++ b/lib/src/errors.dart
@@ -8,9 +8,9 @@
/// The [MultiError] class combines multiple errors into one object,
/// and the [MultiError.wait] function works like [Future.wait] except
/// that it returns all the errors.
-library pkg.isolate.errors;
+library isolate.errors;
-import "dart:async";
+import 'dart:async';
class MultiError extends Error {
// Limits the number of lines included from each error's error message.
diff --git a/lib/src/lists.dart b/lib/src/lists.dart
index 5ed7066..2047ab3 100644
--- a/lib/src/lists.dart
+++ b/lib/src/lists.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
/// Utility functions to create fixed-length lists.
-library pkg.isolate.util.lists;
+library isolate.lists;
/// Create a single-element fixed-length list.
List list1(v1) => new List(1)..[0] = v1;
diff --git a/lib/src/multiplexport.dart b/lib/src/raw_receive_port_multiplexer.dart
similarity index 95%
rename from lib/src/multiplexport.dart
rename to lib/src/raw_receive_port_multiplexer.dart
index 2711c45..d5cd25e 100644
--- a/lib/src/multiplexport.dart
+++ b/lib/src/raw_receive_port_multiplexer.dart
@@ -18,14 +18,15 @@
/// write `new RawReceivePort(handler)`.
///
/// Remember to [close] the multiplexer when it is no longer needed.
-/// `
+///
/// (TODO: Check if it really is faster - creating a receive port requires a
/// global mutex, so it may be a bottleneck, but it's not clear how slow it is).
-library pkg.isolate.multiplexreceiveport;
+library isolate.raw_receive_port_multiplexer;
-import "dart:isolate";
-import "dart:collection";
-import "lists.dart";
+import 'dart:collection';
+import 'dart:isolate';
+
+import 'lists.dart';
class _MultiplexRawReceivePort implements RawReceivePort {
final RawReceivePortMultiplexer _multiplexer;
diff --git a/pubspec.yaml b/pubspec.yaml
index f0b2e2c..a65a0f6 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,11 +1,9 @@
name: isolate
-version: 0.1.1
+version: 0.2.0
author: Dart Team <misc@dartlang.org>
description: Utility functions and classes related to the 'dart:isolate' library.
homepage: https://github.com/dart-lang/isolate
-
environment:
- sdk: ">=1.8.0 <2.0.0"
-
+ sdk: '>=1.9.0-dev <2.0.0'
dev_dependencies:
- unittest: ">=0.10.0 <0.12.0"
+ unittest: '>=0.10.0 <0.12.0'
diff --git a/test/isolaterunner_test.dart b/test/isolaterunner_test.dart
index 9b0b3b6..9183d7e 100644
--- a/test/isolaterunner_test.dart
+++ b/test/isolaterunner_test.dart
@@ -4,10 +4,11 @@
library dart.pkg.isolate.isolaterunner_test;
-import "package:isolate/isolaterunner.dart";
-import "package:unittest/unittest.dart";
-import "dart:async" show Future;
-import "dart:isolate" show Capability;
+import 'dart:async' show Future;
+import 'dart:isolate' show Capability;
+
+import 'package:isolate/isolate_runner.dart';
+import 'package:unittest/unittest.dart';
const MS = const Duration(milliseconds: 1);
diff --git a/test/ports_test.dart b/test/ports_test.dart
index 795cdb9..8471c67 100644
--- a/test/ports_test.dart
+++ b/test/ports_test.dart
@@ -4,10 +4,11 @@
library dart.pkg.isolate.isolaterunner_test;
-import "package:isolate/ports.dart";
-import "package:unittest/unittest.dart";
-import "dart:async";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:isolate';
+
+import 'package:isolate/ports.dart';
+import 'package:unittest/unittest.dart';
const Duration MS = const Duration(milliseconds: 1);
diff --git a/test/registry_test.dart b/test/registry_test.dart
index c85bfcc..c67e99c 100644
--- a/test/registry_test.dart
+++ b/test/registry_test.dart
@@ -4,12 +4,13 @@
library dart.pkg.isolate.test.registry;
-import "package:isolate/isolaterunner.dart";
-import "package:isolate/registry.dart";
-import "dart:async";
-import "dart:isolate";
+import 'dart:async';
+import 'dart:isolate';
-import "package:unittest/unittest.dart";
+import 'package:isolate/isolate_runner.dart';
+import 'package:isolate/registry.dart';
+
+import 'package:unittest/unittest.dart';
const MS = const Duration(milliseconds: 1);