syncbase.js: syncgroup names must contain the syncbaseSuffix.
JS equivalent of go/vcl/12830
Change-Id: If11d2720422e29e548cf417f1296ad7fa41072c2
diff --git a/src/syncbase.js b/src/syncbase.js
index 009f46b..4ef1c4a 100644
--- a/src/syncbase.js
+++ b/src/syncbase.js
@@ -7,9 +7,18 @@
module.exports = {
newService: newService,
- nosql: nosql
+ nosql: nosql,
+ // syncbaseSuffix is used for Syncbase-to-Syncbase RPCs. It should be
+ // completely internal to syncbase, but currently syncgroup names must
+ // include it for implementation-dependant reasons.
+ //
+ // TODO(nlacasse): This suffix should go away. One possibility is to detect
+ // "internal" RPCs by the method they call, and dispatch to different object
+ // based on that method. We could also have the client or server inject the
+ // suffix automatically.
+ syncbaseSuffix: '$sync'
};
function newService(fullName) {
return new Service(fullName);
-}
\ No newline at end of file
+}
diff --git a/test/integration/test-syncgroup.js b/test/integration/test-syncgroup.js
index 76cae4a..2ab187f 100644
--- a/test/integration/test-syncgroup.js
+++ b/test/integration/test-syncgroup.js
@@ -6,7 +6,9 @@
var naming = require('vanadium').naming;
var test = require('prova');
-var nosql = require('../..').nosql;
+var syncbase = require('../..');
+var nosql = syncbase.nosql;
+var syncbaseSuffix = syncbase.syncbaseSuffix;
var SyncGroup = require('../../src/nosql/syncgroup');
var verror = require('vanadium').verror;
@@ -68,7 +70,9 @@
// TODO(nlacasse): It's not obvious that the syncgroup name needs to be
// appended to a syncbase service name.
- var name = naming.join(o.service.fullName, uniqueName('syncgroup'));
+ var name = naming.join(o.service.fullName,
+ syncbaseSuffix,
+ uniqueName('syncgroup'));
var prefix = 't1/foo';
var spec = new nosql.SyncGroupSpec({
@@ -100,7 +104,9 @@
// TODO(nlacasse): It's not obvious that the syncgroup name needs to be
// appended to a syncbase service name.
- var name = naming.join(o.service.fullName, uniqueName('syncgroup'));
+ var name = naming.join(o.service.fullName,
+ syncbaseSuffix,
+ uniqueName('syncgroup'));
var spec = new nosql.SyncGroupSpec({
description: 'another syncgroup named ' + name,
@@ -207,7 +213,9 @@
];
var fullNames = names.map(function(name) {
- return naming.join(o.service.fullName, name);
+ return naming.join(o.service.fullName,
+ syncbaseSuffix,
+ name);
});
createSyncGroups();
diff --git a/test/integration/util.js b/test/integration/util.js
index 01a2aa4..50b6563 100644
--- a/test/integration/util.js
+++ b/test/integration/util.js
@@ -24,6 +24,7 @@
var vanadium = require('vanadium');
var syncbase = require('../..');
+var syncbaseSuffix = syncbase.syncbaseSuffix;
var SERVICE_NAME = require('./service-name');
@@ -112,7 +113,9 @@
}
var sgName = uniqueName('syncgroup');
- var fullSgName = vanadium.naming.join(o.service.fullName, sgName);
+ var fullSgName = vanadium.naming.join(o.service.fullName,
+ syncbaseSuffix,
+ sgName);
// TODO(nlacasse): Where does this magic number 8 come from? It's in
// syncgroup_test.go.