TBR: travel: syncbase: s/yncGroup/yncgroup/

With this change, we establish a convention of treating
"syncgroup" as a single, common (non-proper) noun.

The main motivation for this change was consistency, for
a term that's used widely across our codebase and docs.

Arguments for "Syncgroup" over "SyncGroup" were:
- it's "Syncbase", not "SyncBase"
- we'd probably like to use "syncgroup" rather than
"sync_group" in snake-case text, e.g. in filenames like
"syncgroup_test.go"; using "SyncGroup" for camel-case
text would make these two inconsistent (Nick pointed
this out)
- avoids ambiguity about capitalization at the start of a
sentence vs. inside a sentence ("SyncGroup" vs.
"syncgroup"?)

(Note, I discussed this change with Bindu, Raja, and Nick
before making it.)

I mainly used 'find -exec perl -pi -e' to prepare this
change, plus manual inspection and tweaks. The main
painful part was updating lots of comments in the Syncbase
implementation to use "syncgroup" instead of "Syncgroup"
where that was the intended usage.

MultiPart: 11/11

Change-Id: I63c62887d1bb21022b04e768d55796ef54cd3805
diff --git a/mocks/syncbase-wrapper.js b/mocks/syncbase-wrapper.js
index a3dfd6c..d3e314c 100644
--- a/mocks/syncbase-wrapper.js
+++ b/mocks/syncbase-wrapper.js
@@ -153,7 +153,7 @@
   statics: {
     /**
      * SLA for a write to a mocked Syncbase instance to be reflected by synced
-     * instances. This is actually based on the size of the SyncGroups with the
+     * instances. This is actually based on the size of the syncgroups with the
      * current mock implementation--roughly n * SYNC_LOOP_SLA--but let's express
      * it as a constant for simplicity.
      */
@@ -185,7 +185,7 @@
       return extractData(this.repo) || {};
     },
 
-    syncGroup: function(sgAdmin, name) {
+    syncgroup: function(sgAdmin, name) {
       var repo = this.repo;
       var sgp;
 
@@ -198,7 +198,7 @@
       }
 
       function errNoExist() {
-        return new verror.NoExistError(null, 'SyncGroup does not exist.');
+        return new verror.NoExistError(null, 'Syncgroup does not exist.');
       }
 
       function getSg() {
diff --git a/src/invitation-manager.js b/src/invitation-manager.js
index 00db106..4eed040 100644
--- a/src/invitation-manager.js
+++ b/src/invitation-manager.js
@@ -33,7 +33,7 @@
       return this.sgmPromise.then(function(sgm) {
         return Promise.all([
             self.addTripCollaborator(owner, tripId, recipient),
-            sgm.joinSyncGroup(recipient, 'invitations')
+            sgm.joinSyncgroup(recipient, 'invitations')
           ]).then(function() {
             return sgm.syncbaseWrapper.put(
               invitationKey(recipient, owner, tripId), self.username);
@@ -50,7 +50,7 @@
     invitation: defineClass.innerClass({
       publics: {
         accept: function() {
-          return this.outer.joinTripSyncGroup(this.owner, this.tripId)
+          return this.outer.joinTripSyncgroup(this.owner, this.tripId)
             .then(this.delete);
         },
 
@@ -85,16 +85,16 @@
       }
     }),
 
-    createTripSyncGroup: function(tripId, initialCollaborators) {
+    createTripSyncgroup: function(tripId, initialCollaborators) {
       return this.sgmPromise.then(function(sgm) {
-        return sgm.createSyncGroup(tripSgName(tripId), [['trips', tripId]],
+        return sgm.createSyncgroup(tripSgName(tripId), [['trips', tripId]],
           [sgm.identity.username].concat(initialCollaborators));
       });
     },
 
-    joinTripSyncGroup: function(owner, tripId) {
+    joinTripSyncgroup: function(owner, tripId) {
       return this.sgmPromise.then(function(sgm) {
-        return sgm.joinSyncGroup(owner, tripSgName(tripId));
+        return sgm.joinSyncgroup(owner, tripSgName(tripId));
       });
     },
 
@@ -106,7 +106,7 @@
           .catch(function(err) {
             if (err instanceof verror.NoExistError &&
                 owner === self.username) {
-              return self.createTripSyncGroup(tripId, collaborator);
+              return self.createTripSyncgroup(tripId, collaborator);
             } else {
               throw err;
             }
@@ -114,14 +114,14 @@
       });
     },
 
-    manageTripSyncGroups: function(trips) {
+    manageTripSyncgroups: function(trips) {
       var self = this;
 
       //TODO(rosswang): maybe make this more intelligent, and handle ejection
       if (trips) {
         $.each(trips, function(tripId, trip) {
           if (trip.owner) {
-            self.joinTripSyncGroup(trip.owner, tripId)
+            self.joinTripSyncgroup(trip.owner, tripId)
               .catch(function(err) {
                 if (!(err instanceof verror.NoExistError)) {
                   throw err;
@@ -135,7 +135,7 @@
     processUpdates: function(data) {
       var self = this;
 
-      this.manageTripSyncGroups(data.trips);
+      this.manageTripSyncgroups(data.trips);
 
       var toMe = data.invitations &&
         data.invitations[SyncbaseWrapper.escapeKeyElement(this.username)];
@@ -210,7 +210,7 @@
     this.invitations = {};
 
     sgmPromise.then(function(sgm) {
-      sgm.createSyncGroup('invitations',
+      sgm.createSyncgroup('invitations',
           [['invitations', SyncbaseWrapper.escapeKeyElement(self.username)]],
           ['...'])
         .catch(self.onError);
diff --git a/src/syncgroup-manager.js b/src/syncgroup-manager.js
index f0562fd..6e5e7de 100644
--- a/src/syncgroup-manager.js
+++ b/src/syncgroup-manager.js
@@ -12,10 +12,10 @@
 
 var SyncgroupManager = defineClass({
   publics: {
-    createSyncGroup: function(name, prefixes, initialCollaborators) {
+    createSyncgroup: function(name, prefixes, initialCollaborators) {
       var self = this;
 
-      var sg = this.syncbaseWrapper.syncGroup(self.sgAdmin, name);
+      var sg = this.syncbaseWrapper.syncgroup(self.sgAdmin, name);
 
       var mgmt = vanadium.naming.join(this.mountNames.app, 'sgmt');
       var spec = sg.buildSpec(prefixes, [mgmt], this.identity.account,
@@ -25,7 +25,7 @@
         }));
 
       return sg.joinOrCreate(spec).then(function() {
-        // TODO(rosswang): this is a hack to make the SyncGroup joinable
+        // TODO(rosswang): this is a hack to make the syncgroup joinable
         return self.vanadiumWrapper.setPermissions(mgmt, new Map([
           ['Admin', {in: ['...']}],
           ['Read', {in: ['...']}],
@@ -36,17 +36,17 @@
       });
     },
 
-    destroySyncGroup: function(name) {
-      return this.syncbaseWrapper.syncGroup(this.sgAdmin, name).destroy();
+    destroySyncgroup: function(name) {
+      return this.syncbaseWrapper.syncgroup(this.sgAdmin, name).destroy();
     },
 
-    joinSyncGroup: function(owner, name) {
-      return this.getForeignSyncGroup(owner, name).join();
+    joinSyncgroup: function(owner, name) {
+      return this.getForeignSyncgroup(owner, name).join();
     },
 
     addCollaborator: function(owner, sgName, username) {
       var blessing = Identity.blessingForUsername(username);
-      return this.getForeignSyncGroup(owner, sgName)
+      return this.getForeignSyncgroup(owner, sgName)
         .changeSpec(function(spec) {
           ['Read', 'Write', 'Resolve'].forEach(function(perm) {
             spec.perms.get(perm).in.push(blessing);
@@ -56,8 +56,8 @@
   },
 
   privates: {
-    getForeignSyncGroup: function(owner, name) {
-      return this.syncbaseWrapper.syncGroup(
+    getForeignSyncgroup: function(owner, name) {
+      return this.syncbaseWrapper.syncgroup(
         vanadium.naming.join(naming.appMount(owner), 'sgadmin'), name);
     },
 
diff --git a/src/travelsync.js b/src/travelsync.js
index 386dfec..69faa90 100644
--- a/src/travelsync.js
+++ b/src/travelsync.js
@@ -59,8 +59,8 @@
       this.tripManager.watchForTrip(tripId);
     },
 
-    joinTripSyncGroup: function(owner, tripId) {
-      return this.tripManager.joinTripSyncGroup(owner, tripId);
+    joinTripSyncgroup: function(owner, tripId) {
+      return this.tripManager.joinTripSyncgroup(owner, tripId);
     },
 
     getRelatedDevices: function(direction) {
@@ -148,17 +148,17 @@
       return gm;
     },
 
-    createPrimarySyncGroup: function(syncgroupManager) {
+    createPrimarySyncgroup: function(syncgroupManager) {
       var self = this;
 
-      this.status.userSyncGroup = 'creating';
-      return syncgroupManager.createSyncGroup('user', [[]],
+      this.status.userSyncgroup = 'creating';
+      return syncgroupManager.createSyncgroup('user', [[]],
         [syncgroupManager.identity.username])
         .then(function(sg) {
-          self.status.userSyncGroup = 'created';
+          self.status.userSyncgroup = 'created';
           return sg;
         }, function(err) {
-          self.status.userSyncGroup = 'failed';
+          self.status.userSyncgroup = 'failed';
           throw err;
         });
     },
@@ -249,8 +249,8 @@
       .then(function(args) {
         return self.createSyncgroupManager(args[0], args[1]);
       });
-    var createPrimarySyncGroup = this.startSyncgroupManager
-      .then(this.createPrimarySyncGroup);
+    var createPrimarySyncgroup = this.startSyncgroupManager
+      .then(this.createPrimarySyncgroup);
 
     this.vanadiumWrapperPromise = prereqs.then(function(args) {
       return args.vanadiumWrapper;
@@ -277,7 +277,7 @@
         startRpc,
         startSyncbase,
         this.startSyncgroupManager,
-        createPrimarySyncGroup
+        createPrimarySyncgroup
       ]).then(function(values) {
         return {
           server: values[0],
diff --git a/src/vanadium-wrapper/syncbase-wrapper.js b/src/vanadium-wrapper/syncbase-wrapper.js
index 9072b1a..882dd2d 100644
--- a/src/vanadium-wrapper/syncbase-wrapper.js
+++ b/src/vanadium-wrapper/syncbase-wrapper.js
@@ -75,7 +75,7 @@
   }
 }
 
-var SG_MEMBER_INFO = new syncbase.nosql.SyncGroupMemberInfo();
+var SG_MEMBER_INFO = new syncbase.nosql.SyncgroupMemberInfo();
 
 // TODO(rosswang): generalize this
 // If this is updated, the regex in escapeKeyElement needs updating too.
@@ -273,11 +273,11 @@
       }
     },
 
-    syncGroup: function(sgAdmin, name) {
+    syncgroup: function(sgAdmin, name) {
       var self = this;
 
       name = vanadium.naming.join(sgAdmin, '%%sync', name);
-      var sg = this.db.syncGroup(name);
+      var sg = this.db.syncgroup(name);
 
       //syncgroup-promisified
       var sgp;
@@ -321,7 +321,7 @@
        * args. */
       sgp = {
         buildSpec: function(prefixes, mountTables, admin, initialPermissions) {
-          return new syncbase.nosql.SyncGroupSpec({
+          return new syncbase.nosql.SyncgroupSpec({
             perms: new Map([
               ['Admin', {in: [admin]}],
               ['Read', {in: initialPermissions}],
@@ -330,7 +330,7 @@
               ['Debug', {in: [admin]}]
             ]),
             prefixes: prefixes.map(function(p) {
-              return new syncbase.nosql.SyncGroupPrefix({
+              return new syncbase.nosql.SyncgroupPrefix({
                 tableName: 't',
                 rowPrefix: joinKey(p)
               });
@@ -423,7 +423,7 @@
   },
 
   init: function(context, db, mountName) {
-    // TODO(rosswang): mountName probably won't be necessary after SyncGroup
+    // TODO(rosswang): mountName probably won't be necessary after syncgroup
     // admin instances are hosted (see group-manager).
     var self = this;
     this.context = context;
diff --git a/test/travel.js b/test/travel.js
index 79e247e..b4ae816 100644
--- a/test/travel.js
+++ b/test/travel.js
@@ -22,8 +22,8 @@
 var UI_SLA = 100;
 /**
  * Syncbase doesn't yet provide us any notification that the first sync after
- * joining the initial sync groups has happened. This SLA is currently based on
- * a similar timeout in the Travel app, though in the future if that logic gets
+ * joining the initial syncgroups has happened. This SLA is currently based on a
+ * similar timeout in the Travel app, though in the future if that logic gets
  * smarter we can shrink it to the sync SLA.
  *
  * Set to 2500 for real testing, 250 for watch.