Merge "javascript/syncbase: Setup jsdoc for syncbase."
diff --git a/src/gen-vdl/v.io/v23/services/syncbase/nosql/index.js b/src/gen-vdl/v.io/v23/services/syncbase/nosql/index.js
index 05cdcad..83246c6 100644
--- a/src/gen-vdl/v.io/v23/services/syncbase/nosql/index.js
+++ b/src/gen-vdl/v.io/v23/services/syncbase/nosql/index.js
@@ -1857,8 +1857,8 @@
};
-Table.prototype.deleteRowRange = function(ctx, serverCall, schemaVersion, start, limit) {
- throw new Error('Method DeleteRowRange not implemented');
+Table.prototype.deleteRange = function(ctx, serverCall, schemaVersion, start, limit) {
+ throw new Error('Method DeleteRange not implemented');
};
@@ -1950,8 +1950,8 @@
{
- name: 'DeleteRowRange',
- doc: "// Delete deletes all rows in the given half-open range [start, limit). If\n// limit is \"\", all rows with keys >= start are included.\n// TODO(sadovsky): Delete prefix perms fully covered by the row range?",
+ name: 'DeleteRange',
+ doc: "// DeleteRange deletes all rows in the given half-open range [start, limit).\n// If limit is \"\", all rows with keys >= start are included.\n// TODO(sadovsky): Delete prefix perms fully covered by the row range?",
inArgs: [{
name: 'schemaVersion',
doc: "",
diff --git a/src/nosql/table.js b/src/nosql/table.js
index 77e5071..81037b1 100644
--- a/src/nosql/table.js
+++ b/src/nosql/table.js
@@ -134,15 +134,24 @@
};
/**
- * Delete deletes all rows in the given range. If the last row that is covered
- * by a prefix from SetPermissions is deleted, that (prefix, perms) pair is
- * removed.
+ * Delete deletes the row for the given primary key.
+ * @param {module:vanadium.context.Context} ctx Vanadium context.
+ * @param {string} key Primary key of the row.
+ * @param {function} cb Callback.
+ */
+Table.prototype.delete = function(ctx, key, cb) {
+ this.row(key).delete(ctx, cb);
+};
+
+/**
+ * deleteRange deletes all rows in the given half-open range [start, limit). If
+ * limit is "", all rows with keys >= start are included.
* @param {module:vanadium.context.Context} ctx Vanadium context.
* @param {module:syncbase.nosql.rowrange.RowRange} range Row ranges to delete.
* @param {function} cb Callback.
*/
-Table.prototype.delete = function(ctx, range, cb) {
- this._wire(ctx).deleteRowRange(
+Table.prototype.deleteRange = function(ctx, range, cb) {
+ this._wire(ctx).deleteRange(
ctx, this.schemaVersion, range.start, range.limit, cb);
};
diff --git a/test/integration/test-batch.js b/test/integration/test-batch.js
index 2b200d5..c7e0b32 100644
--- a/test/integration/test-batch.js
+++ b/test/integration/test-batch.js
@@ -258,7 +258,7 @@
}
function attemptBatchDeletePrefix() {
- batchTable.delete(ctx, range.prefix(key), function(err) {
+ batchTable.deleteRange(ctx, range.prefix(key), function(err) {
assertReadOnlyBatchError(err);
attemptBatchDeleteRow();
});
@@ -477,7 +477,7 @@
}
function assertDeleteFails(cb) {
- batchTable.delete(ctx, range.prefix(uniqueName('key')), function(err) {
+ batchTable.deleteRange(ctx, range.prefix(uniqueName('key')), function(err) {
t.ok(err, 'delete() should error');
cb(null);
});
diff --git a/test/integration/test-table.js b/test/integration/test-table.js
index 02a9dbb..3e24c89 100644
--- a/test/integration/test-table.js
+++ b/test/integration/test-table.js
@@ -188,7 +188,7 @@
},
// Delete row.
- row.delete.bind(row, o.ctx),
+ table.delete.bind(table, o.ctx, key),
// Verify row no longer exists.
row.exists.bind(row, o.ctx),
@@ -312,7 +312,7 @@
return o.teardown(t.end);
}
- table.delete(o.ctx, range, scan);
+ table.deleteRange(o.ctx, range, scan);
}
function scan(err) {