GWicke has uploaded a new change for review.
https://gerrit.wikimedia.org/r/171990
Change subject: Update to restbase 0.2.4
......................................................................
Update to restbase 0.2.4
Change-Id: I6421d263254d9449d491a0f4f6cb56b5e6b6976a
---
M
node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
M node_modules/restbase-cassandra/lib/db.js
M node_modules/restbase-cassandra/lib/index.js
M node_modules/restbase-cassandra/package.json
M restbase
5 files changed, 31 insertions(+), 24 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/restbase/deploy
refs/changes/90/171990/1
diff --git
a/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
b/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
index 2474729..be2cfc9 100644
---
a/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
+++
b/node_modules/mocha/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json
@@ -31,7 +31,7 @@
"shasum": "d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb",
"tarball": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz"
},
- "_from": "lru-cache@2",
+ "_from": "lru-cache@^2.5.0",
"_npmVersion": "1.3.15",
"_npmUser": {
"name": "isaacs",
diff --git a/node_modules/restbase-cassandra/lib/db.js
b/node_modules/restbase-cassandra/lib/db.js
index f75f9ed..cf3dbce 100644
--- a/node_modules/restbase-cassandra/lib/db.js
+++ b/node_modules/restbase-cassandra/lib/db.js
@@ -8,10 +8,12 @@
var cassID = dbu.cassID;
var secIndexes = require('./secondaryIndexes');
-// XXX: Use config only
-var defaultConsistency = cass.types.consistencies.one;
+function DB (client, conf) {
+ this.conf = conf;
-function DB (client) {
+ this.defaultConsistency = cass.types.consistencies[conf.defaultConsistency]
+ || cass.types.consistencies.one;
+
// cassandra client
this.client = client;
@@ -41,7 +43,7 @@
var keyspace = dbu.keyspaceName(reverseDomain, tableName);
// consistency
- var consistency = defaultConsistency;
+ var consistency = this.defaultConsistency;
var query = {
attributes: {
key: 'schema'
@@ -72,14 +74,14 @@
var keyspace = dbu.keyspaceName(reverseDomain, req.table);
// consistency
- var consistency = defaultConsistency;
+ var consistency = this.defaultConsistency;
if (req.consistency && req.consistency in {all:1, localQuorum:1}) {
consistency = cass.types.consistencies[req.consistency];
}
var schema = this.schemaCache[keyspace];
if (!schema) {
- return this._getSchema(keyspace, defaultConsistency)
+ return this._getSchema(keyspace, this.defaultConsistency)
.then(function(schema) {
//console.log('schema', schema);
self.schemaCache[keyspace] = schema;
@@ -281,7 +283,7 @@
// consistency
- var consistency = defaultConsistency;
+ var consistency = this.defaultConsistency;
if (req.consistency && req.consistency in {all:1, localQuorum:1}) {
consistency = cass.types.consistencies[req.consistency];
}
@@ -289,7 +291,7 @@
// Get the type info for the table & verify types & ops per index
var self = this;
if (!this.schemaCache[keyspace]) {
- return this._getSchema(keyspace, defaultConsistency)
+ return this._getSchema(keyspace, this.defaultConsistency)
.then(function(schema) {
self.schemaCache[keyspace] = schema;
return self._put(keyspace, req, consistency);
@@ -427,7 +429,7 @@
newerDataReq.order = {};
newerDataReq.order[schema.tid] = 'asc'; // select sibling entries
newerDataReq.limit = 2; // data entry + newer entry
- var newerRebuild = self._get(keyspace, newerDataReq,
defaultConsistency, 'data', schema)
+ var newerRebuild = self._get(keyspace, newerDataReq,
self.defaultConsistency, 'data', schema)
.then(function(res) {
var newerRebuilder = new secIndexes.IndexRebuilder(self, keyspace,
schema, secondaryKeys, reqTime);
@@ -482,7 +484,7 @@
var keyspace = dbu.keyspaceName(reverseDomain, req.table);
// consistency
- var consistency = defaultConsistency;
+ var consistency = this.defaultConsistency;
if (req.consistency && req.consistency in {all:1, localQuorum:1}) {
consistency = cass.types.consistencies[req.consistency];
}
@@ -518,7 +520,7 @@
var keyspace = dbu.keyspaceName(reverseDomain, req.table);
// consistency
- var consistency = defaultConsistency;
+ var consistency = self.defaultConsistency;
if (req.consistency && req.consistency in {all:1, localQuorum:1}) {
consistency = cass.types.consistencies[req.consistency];
}
@@ -532,13 +534,16 @@
// console.log(JSON.stringify(internalSchema, null, 2));
- if (!req.options) {
- req.options = "{ 'class': 'SimpleStrategy', 'replication_factor': 3 }";
+ var replicationOptions = '';
+ if (req.options && req.options.storageClass &&
req.options.durabilityLevel) {
+ replicationOptions = "{ 'class': '" + req.options.storageClass
+ + "', 'replication_factor': " + req.options.durabilityLevel + "}";
} else {
- req.options = "{ 'class': '"+ req.options.storageClass + "',
'replication_factor': " + req.options.durabilityLevel + "}";
+ replicationOptions = "{ 'class': 'SimpleStrategy',
'replication_factor': 3 }";
}
- return this._createKeyspace(keyspace, consistency, req.options)
+ self.schemaCache[keyspace] = internalSchema;
+ return this._createKeyspace(keyspace, consistency, replicationOptions)
.then(function() {
return Promise.all([
self._createTable(keyspace, internalSchema, 'data', consistency),
@@ -650,13 +655,15 @@
DB.prototype._createKeyspace = function (keyspace, consistency, options) {
var cql = 'create keyspace ' + cassID(keyspace)
+ ' WITH REPLICATION = ' + options;
- return this.client.execute_p(cql, [], {consistency: consistency ||
defaultConsistency});
+ return this.client.execute_p(cql, [],
+ {consistency: consistency || this.defaultConsistency});
};
DB.prototype.dropTable = function (reverseDomain, table) {
var keyspace = dbu.keyspaceName(reverseDomain, table);
- return this.client.execute_p('drop keyspace ' + cassID(keyspace), [],
{consistency: defaultConsistency});
+ return this.client.execute_p('drop keyspace ' + cassID(keyspace), [],
+ {consistency: this.defaultConsistency});
};
diff --git a/node_modules/restbase-cassandra/lib/index.js
b/node_modules/restbase-cassandra/lib/index.js
index fb5ed98..3655abb 100644
--- a/node_modules/restbase-cassandra/lib/index.js
+++ b/node_modules/restbase-cassandra/lib/index.js
@@ -36,7 +36,7 @@
return client.connect_p()
.then(function() {
- return new DB(client);
+ return new DB(client, options);
});
}
diff --git a/node_modules/restbase-cassandra/package.json
b/node_modules/restbase-cassandra/package.json
index 7f37d44..45e78e2 100644
--- a/node_modules/restbase-cassandra/package.json
+++ b/node_modules/restbase-cassandra/package.json
@@ -1,7 +1,7 @@
{
"name": "restbase-cassandra",
"description": "RESTBase table storage on Cassandra",
- "version": "0.2.3",
+ "version": "0.2.4",
"dependencies": {
"assert": "^1.1.1",
"async": "0.x.x",
@@ -22,8 +22,8 @@
},
"readme": "# [RESTBase](https://github.com/gwicke/restbase) table storage on
Cassandra\n\nProvides a high-level table storage service abstraction similar to
Amazon\nDynamoDB or Google DataStore, with a Cassandra backend. See [the
design\ndocs](https://github.com/gwicke/restbase-cassandra/tree/master/doc)
for\ndetails and background.\n\nThis is the default table storage backend
for\n[RESTBase](https://github.com/gwicke/restbase), and automatically
installed as\nan npm module dependency (`restbase-cassandra`). See the install
instructions\nthere.\n \n## Status\nPrototype, not quite ready for
production.\n\n[](https://travis-ci.org/gwicke/restbase-cassandra)\n\nFeatures:\n-
basic table storage service with REST interface, backed by Cassandra\n-
multi-tenant design: domain creation, prepared for per-domain ACLs\n- table
creation with declarative JSON schemas\n- secondary index creation and basic
maintenance\n- data insertion and retrieval by primary key, including range
queries\n\n### Next steps\n- More refined [secondary\n
index](https://github.com/gwicke/restbase-cassandra/blob/master/doc/SecondaryIndexes.md)\n
implementation\n - range queries on secondary indexes\n- Refine HTTP
interface & response formats, especially paging\n- Authentication (OAuth2 / JWT
/ JWS / auth service callbacks) and ACLs\n-
[Transactions](https://github.com/gwicke/restbase-cassandra/blob/master/doc/Transactions.md):\n
light-weight CAS and 2PC\n- Get ready for production: robustness,
performance, logging\n- Basic schema evolution support\n\n## Contributors\n*
Gabriel Wicke <[email protected]>\n* Hardik Juneja
<[email protected]>\n",
"readmeFilename": "Readme.md",
- "gitHead": "506bbaa4b5146e3bd011345dd4d2435a444bec8e",
- "_id": "[email protected]",
- "_shasum": "dba009fc8739751acdf645ab1b7a6a8582ded666",
- "_from": "restbase-cassandra@^0.2.3"
+ "gitHead": "3c8aa552adb14591ff215e18708aca75d4ec0e59",
+ "_id": "[email protected]",
+ "_shasum": "fd226b43831c15bed0494e59f24ccfe4d77871f1",
+ "_from": "restbase-cassandra@^0.2.4"
}
diff --git a/restbase b/restbase
index f76147c..1883a9e 160000
--- a/restbase
+++ b/restbase
-Subproject commit f76147cc6c384adca24cb96347ab1fdbb8c5254d
+Subproject commit 1883a9ee5a85272ef8d0ab9cbef5b757396dd645
--
To view, visit https://gerrit.wikimedia.org/r/171990
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6421d263254d9449d491a0f4f6cb56b5e6b6976a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/restbase/deploy
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits