Add new GeneratedService and ProtobufClient interfaces used when generating dart server and client stubs.
This is a prerequisite for the protoc-plugin change coming shortly.
R=sgjesse@google.com, skybrian@google.com
BUG=
Review URL: https://chromiumcodereview.appspot.com//1197833007
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4495ae8..758ed77 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 0.3.10
+ * Add GeneratedService and ProtobufClient interfaces.
+
## 0.3.9
* Add experimental mixins_meta library
* Add experimental PbMapMixin class (in a separate library).
diff --git a/lib/protobuf.dart b/lib/protobuf.dart
index d74c9c8..50926d4 100644
--- a/lib/protobuf.dart
+++ b/lib/protobuf.dart
@@ -4,6 +4,7 @@
library protobuf;
+import 'dart:async' show Future;
import 'dart:collection' show ListMixin;
import 'dart:convert' show JSON, Utf8Codec;
import 'dart:math' as math;
@@ -20,8 +21,10 @@
part 'src/protobuf/extension_registry.dart';
part 'src/protobuf/field_info.dart';
part 'src/protobuf/generated_message.dart';
+part 'src/protobuf/generated_service.dart';
part 'src/protobuf/pb_list.dart';
part 'src/protobuf/protobuf_enum.dart';
+part 'src/protobuf/rpc_client';
part 'src/protobuf/unknown_field_set.dart';
part 'src/protobuf/utils.dart';
part 'src/protobuf/wire_format.dart';
diff --git a/lib/src/protobuf/generated_service.dart b/lib/src/protobuf/generated_service.dart
new file mode 100644
index 0000000..27d5105
--- /dev/null
+++ b/lib/src/protobuf/generated_service.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+part of protobuf;
+
+/// Server side context.
+class ServerContext {
+ // TODO: Place server specific information in this class.
+}
+
+/// Abstract class used to implement a Service API.
+///
+/// The protoc compiler generates subclasses of this class containing abstract
+/// methods for each defined service method and a handleCall method that
+/// dispatches to the corresponding abstract method.
+abstract class GeneratedService {
+ Future<List<int>> handleCall(
+ ServerContext ctx, String methodName, List<int> request);
+}
diff --git a/lib/src/protobuf/rpc_client.dart b/lib/src/protobuf/rpc_client.dart
new file mode 100644
index 0000000..b3fb97d
--- /dev/null
+++ b/lib/src/protobuf/rpc_client.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+part of protobuf;
+
+/// Client side context.
+class ClientContext {
+ // TODO: Place client side specific information here.
+}
+
+/// Client interface.
+///
+/// This must be implemented by protobuf clients which are passed to the
+/// generated client stub class at construction.
+abstract class RpcClient {
+ Future<List<int>> Invoke(
+ ClientContext ctx, String methodName, List<int> request);
+}
diff --git a/pubspec.yaml b/pubspec.yaml
index 5285246..34125fc 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: protobuf
-version: 0.3.9
+version: 0.3.10
author: Dart Team <misc@dartlang.org>
description: Runtime library for protobuf support.
homepage: https://github.com/dart-lang/dart-protobuf