Permalink
Browse files

Replace mentions of 'meta'

This nomenclature was sadly passed on from the previous versions of the
client. In the new API there is no "meta", but only a single result
object which contains both the value and any associated metadata.

Mentions of meta have been replaced with 'options' or 'result' where
applicable. Mentions of 'meta' are still within the views tests where
this 'meta' refers to an argument passed to the server-side view
function and is not related to the SDK terminology.

Change-Id: I7acc028d694ed4894a22235d9213742e995817dc
Reviewed-on: http://review.couchbase.org/29417
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Brett Lawson <brett19@gmail.com>
  • Loading branch information...
1 parent 0baba15 commit ece52000088d2efe0dd08811f9b4e81eebebc022 @mnunberg mnunberg committed with brett19 Oct 9, 2013
View
@@ -129,7 +129,7 @@ function scheduleMemcached(cb) {
cb.set(curKey, value, 0, function(err) {
markOperation(err);
- cb.get(curKey, function(err, meta) {
+ cb.get(curKey, function(err, result) {
markOperation(err);
scheduleMemcached(cb);
});
@@ -138,9 +138,9 @@ function scheduleMemcached(cb) {
function scheduleCouchbase(cb) {
var curKey = getKey();
- cb.set(curKey, value, {}, function(err, meta) {
+ cb.set(curKey, value, {}, function(err, result) {
markOperation(err);
- cb.get(curKey, function(err, meta) {
+ cb.get(curKey, function(err, result) {
markOperation(err);
scheduleCouchbase(cb);
})
@@ -149,9 +149,9 @@ function scheduleCouchbase(cb) {
function scheduleNode(cb) {
var curKey = getKey();
- cb.Set(curKey, value, function(err, meta) {
+ cb.Set(curKey, value, function(err, result) {
markOperation(err);
- cb.Get(curKey, function(err, meta) {
+ cb.Get(curKey, function(err, result) {
markOperation(err);
scheduleNode(cb);
});
View
@@ -263,17 +263,17 @@ Connection.prototype._interceptEndure = function(key, options, globalOptions, is
* @ignore
*/
Connection.prototype._invokeStorage = function(tgt, argList) {
- var meta, callback;
+ var options, callback;
if (argList.length === 3) {
- meta = {};
- meta[argList[0]] = { value: argList[1] };
+ options = {};
+ options[argList[0]] = { value: argList[1] };
callback = argList[2];
} else {
- meta = _mergeParams(argList[0], { value: argList[1] }, argList[2] );
+ options = _mergeParams(argList[0], { value: argList[1] }, argList[2] );
callback = argList[3];
}
- tgt.call(this._cb, meta, null,
- this._interceptEndure(argList[0], meta, {}, false, callback));
+ tgt.call(this._cb, options, null,
+ this._interceptEndure(argList[0], options, {}, false, callback));
};
/**
@@ -775,7 +775,7 @@ Connection.prototype.setMulti = function(kv, options, callback) {
* @see Connection#add
* @see Connection#setMulti
*/
-Connection.prototype.addMulti = function(kv, meta, callback) {
+Connection.prototype.addMulti = function(kv, options, callback) {
this._multiHelper(this._cb.addMulti, arguments);
};
@@ -789,7 +789,7 @@ Connection.prototype.addMulti = function(kv, meta, callback) {
* @see Connection#replace
* @see Connection#setMulti
*/
-Connection.prototype.replaceMulti = function(kv, meta, callback) {
+Connection.prototype.replaceMulti = function(kv, options, callback) {
this._multiHelper(this._cb.replaceMulti, arguments);
};
@@ -803,7 +803,7 @@ Connection.prototype.replaceMulti = function(kv, meta, callback) {
* @see Connection#append
* @see Connection#setMulti
*/
-Connection.prototype.appendMulti = function(kv, meta, callback) {
+Connection.prototype.appendMulti = function(kv, options, callback) {
this._multiHelper(this._cb.appendMulti, arguments);
};
@@ -817,7 +817,7 @@ Connection.prototype.appendMulti = function(kv, meta, callback) {
* @see Connection#prepend
* @see Connection#setMulti
*/
-Connection.prototype.prependMulti = function(kv, meta, callback) {
+Connection.prototype.prependMulti = function(kv, options, callback) {
this._multiHelper(this._cb.prependMulti, arguments);
};
@@ -831,7 +831,7 @@ Connection.prototype.prependMulti = function(kv, meta, callback) {
* @see Connection#get
* @see Connection#setMulti
*/
-Connection.prototype.getMulti = function(kv, meta, callback) {
+Connection.prototype.getMulti = function(kv, options, callback) {
this._multiHelper(this._cb.getMulti, arguments);
};
@@ -845,7 +845,7 @@ Connection.prototype.getMulti = function(kv, meta, callback) {
* @see Connection#lock
* @see Connection#unlockMulti
*/
-Connection.prototype.lockMulti = function(kv, meta, callback) {
+Connection.prototype.lockMulti = function(kv, options, callback) {
this._multiHelper(this._cb.lockMulti, arguments);
};
@@ -862,7 +862,7 @@ Connection.prototype.lockMulti = function(kv, meta, callback) {
* @see Connection#unlock
* @see Connection#setMulti
*/
-Connection.prototype.unlockMulti = function(kv, meta, callback) {
+Connection.prototype.unlockMulti = function(kv, options, callback) {
this._multiHelper(this._cb.unlockMulti, arguments);
};
@@ -873,7 +873,7 @@ Connection.prototype.unlockMulti = function(kv, meta, callback) {
* @param {object=} options
* @param {MultiCallback|KeyCallback} callback
*/
-Connection.prototype.removeMulti = function(kv, meta, callback) {
+Connection.prototype.removeMulti = function(kv, options, callback) {
this._multiHelper(this._cb.deleteMulti, arguments);
};
@@ -887,7 +887,7 @@ Connection.prototype.removeMulti = function(kv, meta, callback) {
*
* @see Connection#setMulti
*/
-Connection.prototype.incrMulti = function(kv, meta, callback) {
+Connection.prototype.incrMulti = function(kv, options, callback) {
this._multiHelper(this._cb.incrMulti, arguments);
};
@@ -902,7 +902,7 @@ Connection.prototype.incrMulti = function(kv, meta, callback) {
* @see Connection#decr
* @see Connection#set
*/
-Connection.prototype.decrMulti = function(kv, meta, callback) {
+Connection.prototype.decrMulti = function(kv, options, callback) {
this._multiHelper(this._cb.decrMulti, arguments);
};
@@ -913,7 +913,7 @@ Connection.prototype.decrMulti = function(kv, meta, callback) {
* @param {object} kv
* @param {MultiCallback|KeyCallback} callback
*/
-Connection.prototype.observeMulti = function(kv, meta, callback) {
+Connection.prototype.observeMulti = function(kv, options, callback) {
this._multiHelper(this._cb.observeMulti, arguments);
};
View
@@ -12,12 +12,12 @@ describe('#add', function() {
cb.remove(testkey, function(){
cb.add(testkey, "bar", H.okCallback(function() {
// try to add existing key, should fail
- cb.add(testkey, "baz", function (err, meta) {
+ cb.add(testkey, "baz", function (err, result) {
assert(err, "Can't add object at empty key");
done();
});
}));
});
});
-});
+});
View
@@ -9,12 +9,12 @@ describe('#durability', function() {
it('should successfully observe', function(done) {
var key = H.genKey("observe");
- cb.set(key, "value", H.okCallback(function(meta){
- cb.observeMulti([key], {}, H.okCallback(function(meta){
- assert(typeof meta == "object");
- assert(key in meta);
- assert(typeof meta[key] == 'object');
- assert('cas' in meta[key][0]);
+ cb.set(key, "value", H.okCallback(function(result){
+ cb.observeMulti([key], {}, H.okCallback(function(result){
+ assert(typeof result == "object");
+ assert(key in result);
+ assert(typeof result[key] == 'object');
+ assert('cas' in result[key][0]);
done();
}));
}));
@@ -26,11 +26,11 @@ describe('#durability', function() {
var key = H.genKey("endure");
cb.set(key, "value", {persist_to:1, replicate_to:0},
- H.okCallback(function(meta){
+ H.okCallback(function(result){
cb.remove(key, {persist_to:1, replicate_to:0},
- H.okCallback(function(mera) {
+ H.okCallback(function(result) {
cb.add(key, "value", {persist_to:1, replicate_to:0},
- H.okCallback(function(meta){
+ H.okCallback(function(result){
done();
}));
}));
View
@@ -8,15 +8,15 @@ describe('#get/set', function() {
it('should work in basic cases', function(done) {
var key = H.genKey("set");
- cb.set(key, "bar", H.okCallback(function(firstmeta){
+ cb.set(key, "bar", H.okCallback(function(firstresult){
// nothing broke
- cb.set(key, "baz", H.okCallback(function(secondmeta){
- assert.notDeepEqual(firstmeta.cas, secondmeta.cas, "CAS should change");
- cb.set(key, "bam", firstmeta, function(err, meta){
+ cb.set(key, "baz", H.okCallback(function(secondresult){
+ assert.notDeepEqual(firstresult.cas, secondresult.cas, "CAS should change");
+ cb.set(key, "bam", firstresult, function(err, result){
assert(err, "Key should fail with stale CAS");
cb.get(key, H.okCallback(function(result){
assert.equal(result.value, "baz");
- cb.set(key, "grr", secondmeta, H.okCallback(function(meta){
+ cb.set(key, "grr", secondresult, H.okCallback(function(result){
cb.get(key, H.okCallback(function(result){
assert.equal("grr", result.value);
done();
@@ -106,7 +106,7 @@ describe('#get/set', function() {
var value = [1,2,3,4];
var key = H.genKey("set-utf8-unconvertible");
- cb.set(key, value, { format: 'raw' }, function(err, meta){
+ cb.set(key, value, { format: 'raw' }, function(err, result){
assert(err);
done();
});
@@ -118,11 +118,11 @@ describe('#get/set', function() {
var key = H.genKey("set-raw-format");
cb.set(key, buf, H.okCallback(function(){
- cb.get(key, H.okCallback(function(meta){
- var doc = meta.value;
+ cb.get(key, H.okCallback(function(result){
+ var doc = result.value;
assert(Buffer.isBuffer(doc));
assert.deepEqual(buf, doc);
- assert.equal(meta.flags, couchbase.format.raw);
+ assert.equal(result.flags, couchbase.format.raw);
done();
}));
}));
View
@@ -23,19 +23,19 @@ describe('#getMulti/setMulti', function() {
assert.equal(doc.value, values[keys[0]].value);
}));
- cb.getMulti(keys, null, H.okCallback(function(meta){
- assert.equal(keys.length, Object.keys(meta).length);
- Object.keys(meta).forEach(function(k){
+ cb.getMulti(keys, null, H.okCallback(function(results){
+ assert.equal(keys.length, Object.keys(results).length);
+ Object.keys(results).forEach(function(k){
assert(values[k] !== undefined);
- assert(meta[k] !== undefined);
- assert(meta[k].value === values[k].value);
+ assert(results[k] !== undefined);
+ assert(results[k].value === values[k].value);
});
done();
}));
}
- var setHandler = H.okCallback(function(meta) {
+ var setHandler = H.okCallback(function(results) {
calledTimes++;
if (calledTimes > 9) {
calledTimes = 0;
@@ -52,16 +52,16 @@ describe('#getMulti/setMulti', function() {
var goodKey = H.genKey("test-multiget-spooled");
var goodValue = 'foo';
- cb.set(goodKey, goodValue, function(err, meta) {
+ cb.set(goodKey, goodValue, function(err, result) {
assert.ifError(err);
var keys = [badKey, goodKey];
- cb.getMulti(keys, null, function(err, meta) {
+ cb.getMulti(keys, null, function(err, results) {
assert.strictEqual(err.code, couchbase.errors.checkResults);
- var goodResult = meta[goodKey];
+ var goodResult = results[goodKey];
assert.equal(goodResult.value, goodValue);
- var badResult = meta[badKey];
+ var badResult = results[badKey];
assert.strictEqual(badResult.error.code, couchbase.errors.keyNotFound);
done();
View
@@ -14,7 +14,7 @@ describe('#hashkeys', function() {
cb.set(key, "bar", { hashkey: hashkey }, H.okCallback(function(){
cb.get(key, { hashkey: hashkey }, H.okCallback(function(result){
assert.equal(result.value, "bar");
- cb.get(key, function(err, meta){
+ cb.get(key, function(err, result){
assert.ok(err);
assert.equal(err.code, couchbase.errors.keyNotFound);
done();
@@ -23,4 +23,4 @@ describe('#hashkeys', function() {
}));
});
-});
+});
View
@@ -46,7 +46,7 @@ describe('#incr/decr', function() {
var key = H.genKey("incrdecr3");
cb.remove(key, function(){
- cb.incr(key, function(err, meta){
+ cb.incr(key, function(err, result){
assert(err, "Error when incrementing key that does not exist");
cb.incr(key, {initial: 500, offset: 20}, H.okCallback(function(result){
assert.equal(result.value, 500, "Offset is ignored when default is used");
@@ -69,7 +69,7 @@ describe('#incr/decr', function() {
cb.incr(key, H.okCallback(function(result){
assert.equal(result.value, 1);
setTimeout(function(){
- cb.get(key, function(err, meta){
+ cb.get(key, function(err, result){
assert(err, "Expiry with arithmetic");
done();
});
@@ -79,4 +79,4 @@ describe('#incr/decr', function() {
});
});
-});
+});
Oops, something went wrong.

0 comments on commit ece5200

Please sign in to comment.