ether: Add streams to syncbase.mojom, fix up README and Makefile
Change-Id: I6439084bd15f22a5afe58e2424823efc30e9d19c
diff --git a/Makefile b/Makefile
index 082092b..48ce1b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
PWD=$(shell pwd)
-DART_FILES = $(shell find $(PWD)/dart -name *.dart ! -name *.part.dart)
+DART_FILES=$(shell find $(PWD)/dart -name *.dart ! -name *.part.dart)
V23_GOPATH=$(shell echo `v23 run env | grep GOPATH | cut -d\= -f2`)
ifndef MOJO_DIR
@@ -90,7 +90,7 @@
$(call MOJOM_GEN,$<,gen,go)
gofmt -w $@
-gen/mojo/echo_server.mojo: go/src/echo_server.go $(MOJO_SHARED_LIB)
+gen/mojo/echo_server.mojo: go/src/echo_server.go gen-mojom $(MOJO_SHARED_LIB)
$(call MOGO_BUILD,$<,$@)
# Check that the dart-style is being met. Note: Comments are ignored when
diff --git a/README.md b/README.md
index a30c93f..b9353e3 100644
--- a/README.md
+++ b/README.md
@@ -6,23 +6,23 @@
## Initial Mojo setup
-You must have the Mojo repo in $MOJO_DIR.
+You must have the Mojo repo in `$MOJO_DIR`.
This section only needs to be run once.
-See the [mojo readme] for more comprehensive instructions.
+See the [Mojo readme] for more comprehensive instructions.
### Install Mojo prereqs
1. Install [depot tools].
2. Install [Goma][goma].
-3. Put the following in your .bashrc:
+3. Put the following in your `.bashrc`:
- # NOTE: Actual locations depend on where you installed depot_tools and goma.
- export PATH=${PATH}:${HOME}/dev/depot_tools
- export GOMA_DIR=${HOME}/goma
-
- export MOJO_DIR=${HOME}/mojo
+ # NOTE: Actual locations depend on where you installed depot_tools and
+ # goma.
+ export PATH=${PATH}:${HOME}/dev/depot_tools
+ export GOMA_DIR=${HOME}/goma
+ export MOJO_DIR=${HOME}/mojo
### Download Mojo repo
@@ -33,6 +33,9 @@
# NOTE: This step also takes about 10 min. Furthermore, the script uses
# 'sudo', so you will need to enter your password.
+ $ cd src && ./build/install-build-deps.sh
+
+ # Or, to include Android deps as well:
$ cd src && ./build/install-build-deps-android.sh
## Update Mojo and compile resources
@@ -44,20 +47,28 @@
1. Start by updating the repo.
- $ cd $MOJO_DIR/src
- $ git checkout master
- $ git pull
- $ gclient sync
+ $ cd $MOJO_DIR/src
+ $ git checkout master
+ $ git pull
+ $ gclient sync
-2. Compile for Linux. Built resources will be in $MOJO_DIR/src/out/Debug
+2. Compile for Linux. Built resources will be in `$MOJO_DIR/src/out/Debug`
- $ ./mojo/tools/mojob.py gn
- $ ./mojo/tools/mojob.py build # NOTE: This can take up to 10 minutes.
+ $ ./mojo/tools/mojob.py gn
+ $ ./mojo/tools/mojob.py build # NOTE: This can take up to 10 minutes.
-3. Compile for Android. Built resources will be in $MOJO_DIR/src/out/android_Debug
+3. Compile for Android. Built resources will be in
+ `$MOJO_DIR/src/out/android_Debug`
- $ ./mojo/tools/mojob.py gn --android
- $ ./mojo/tools/mojob.py build --android # NOTE: This can take up to 10 minutes.
+ $ ./mojo/tools/mojob.py gn --android
+ $ ./mojo/tools/mojob.py build --android # NOTE: This can take up to 10 minutes.
+
+## Install Dart SDK
+
+To run Dart apps, you must install the Dart SDK.
+
+Googlers: http://go/install-dart
+External: https://www.dartlang.org/downloads/
[architecture proposal]: https://docs.google.com/document/d/1TyxPYIhj9VBCtY7eAXu_MEV9y0dtRx7n7UY4jm76Qq4/edit
[depot tools]: http://www.chromium.org/developers/how-tos/install-depot-tools
diff --git a/mojom/syncbase.mojom b/mojom/syncbase.mojom
index 6a18c04..6fd799b 100644
--- a/mojom/syncbase.mojom
+++ b/mojom/syncbase.mojom
@@ -4,7 +4,7 @@
// TODO(sadovsky): Put structs in a separate types.mojom file.
// TODO(sadovsky): Loose representation of verror. Improve this.
struct Error {
- string id;
+ string id; // empty string means no error
uint32 action_code;
string msg;
};
@@ -36,6 +36,25 @@
uint8 sync_priority;
};
+struct Result {
+ array<array<uint8>> values;
+};
+
+interface ExecStream {
+ OnResult(Result result);
+ OnDone(Error err);
+};
+
+struct KeyValue {
+ string key;
+ array<uint8> value;
+};
+
+interface ScanStream {
+ OnKeyValue(KeyValue key_value);
+ OnDone(Error err);
+};
+
// TODO(sadovsky): Add schema version to all RPCs. See v.io/c/13734.
// All 'name' params are service-relative object names.
@@ -64,8 +83,7 @@
DbCreate(string name, Perms perms) => (Error err);
DbDelete(string name) => (Error err);
DbExists(string name) => (Error err, bool exists);
- // TODO(sadovsky): Figure out how to stream back replies.
- DbExec(string query) => (Error err);
+ DbExec(string query, ExecStream& stream) => (Error err);
DbBeginBatch(string name, BatchOptions? bo) => (Error err, string batch_dn);
DbCommit(string name) => (Error err);
DbAbort(string name) => (Error err);
@@ -105,8 +123,9 @@
TableExists(string name) => (Error err, bool exists);
TableDeleteRowRange(string name, array<uint8> start, array<uint8> limit)
=> (Error err);
- // TODO(sadovsky): Figure out how to stream back replies.
- TableScan(string name, array<uint8> start, array<uint8> limit) => (Error err);
+ TableScan(
+ string name, array<uint8> start, array<uint8> limit, ScanStream& stream)
+ => (Error err);
TableGetPermissions(string name, string key)
=> (Error err, array<PrefixPerms> perms_arr);
TableSetPermissions(string name, string prefix, Perms perms) => (Error err);