GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/191822

Change subject: Update to latest master (enable deflate support)
......................................................................

Update to latest master (enable deflate support)

Change-Id: I2d0d5a63f6d9619ee1967fb6fb1c9b2fae5c089b
---
M node_modules/istanbul/package.json
M node_modules/js-yaml/node_modules/argparse/node_modules/lodash/package.json
M 
node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json
M node_modules/js-yaml/node_modules/argparse/package.json
M node_modules/js-yaml/node_modules/esprima/package.json
M node_modules/js-yaml/package.json
M node_modules/mocha/node_modules/mkdirp/package.json
M node_modules/preq/node_modules/bluebird/package.json
M node_modules/restbase-mod-table-cassandra/lib/db.js
M node_modules/restbase-mod-table-cassandra/lib/dbutils.js
M node_modules/restbase-mod-table-cassandra/package.json
M node_modules/restbase-mod-table-cassandra/test/index.js
M node_modules/swagger-router/node_modules/bluebird/package.json
M restbase
14 files changed, 82 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/restbase/deploy 
refs/changes/22/191822/1

diff --git a/node_modules/istanbul/package.json 
b/node_modules/istanbul/package.json
index 36c6115..24e9260 100644
--- a/node_modules/istanbul/package.json
+++ b/node_modules/istanbul/package.json
@@ -220,5 +220,6 @@
     "tarball": "http://registry.npmjs.org/istanbul/-/istanbul-0.3.5.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.3.5.tgz";
+  "_resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.3.5.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git 
a/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/package.json 
b/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/package.json
index f06681c..df3570a 100644
--- 
a/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/package.json
+++ 
b/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/package.json
@@ -89,5 +89,6 @@
     "tarball": "http://registry.npmjs.org/lodash/-/lodash-3.2.0.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/lodash/-/lodash-3.2.0.tgz";
+  "_resolved": "https://registry.npmjs.org/lodash/-/lodash-3.2.0.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git 
a/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json
 
b/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json
index 43c805c..582645c 100644
--- 
a/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json
+++ 
b/node_modules/js-yaml/node_modules/argparse/node_modules/sprintf-js/package.json
@@ -46,5 +46,6 @@
     "tarball": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.2.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.2.tgz";
+  "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.2.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/node_modules/js-yaml/node_modules/argparse/package.json 
b/node_modules/js-yaml/node_modules/argparse/package.json
index 2e3773c..80208a6 100644
--- a/node_modules/js-yaml/node_modules/argparse/package.json
+++ b/node_modules/js-yaml/node_modules/argparse/package.json
@@ -57,5 +57,6 @@
     "tarball": "http://registry.npmjs.org/argparse/-/argparse-1.0.0.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.0.tgz";
+  "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.0.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/node_modules/js-yaml/node_modules/esprima/package.json 
b/node_modules/js-yaml/node_modules/esprima/package.json
index 77d6cab..50fe250 100644
--- a/node_modules/js-yaml/node_modules/esprima/package.json
+++ b/node_modules/js-yaml/node_modules/esprima/package.json
@@ -88,5 +88,6 @@
   },
   "directories": {},
   "_shasum": "609ac5c2667eae5433b41eb9ecece2331b41498f",
-  "_resolved": "https://registry.npmjs.org/esprima/-/esprima-2.0.0.tgz";
+  "_resolved": "https://registry.npmjs.org/esprima/-/esprima-2.0.0.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/node_modules/js-yaml/package.json 
b/node_modules/js-yaml/package.json
index 7f23c70..bfc9103 100644
--- a/node_modules/js-yaml/package.json
+++ b/node_modules/js-yaml/package.json
@@ -78,5 +78,6 @@
     "tarball": "http://registry.npmjs.org/js-yaml/-/js-yaml-3.2.7.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.2.7.tgz";
+  "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.2.7.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/node_modules/mocha/node_modules/mkdirp/package.json 
b/node_modules/mocha/node_modules/mkdirp/package.json
index a915c51..b7fe466 100644
--- a/node_modules/mocha/node_modules/mkdirp/package.json
+++ b/node_modules/mocha/node_modules/mkdirp/package.json
@@ -39,7 +39,7 @@
     "shasum": "1d73076a6df986cd9344e15e71fcc05a4c9abf12",
     "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz";
   },
-  "_from": "[email protected]",
+  "_from": "[email protected]",
   "_npmVersion": "1.4.3",
   "_npmUser": {
     "name": "substack",
diff --git a/node_modules/preq/node_modules/bluebird/package.json 
b/node_modules/preq/node_modules/bluebird/package.json
index 54dddb1..f53de78 100644
--- a/node_modules/preq/node_modules/bluebird/package.json
+++ b/node_modules/preq/node_modules/bluebird/package.json
@@ -74,7 +74,7 @@
   "gitHead": "a99cba2657b6fdd6c14be4e5e361e8c66683f5ae",
   "_id": "[email protected]",
   "_shasum": "b108b6d659a7bb0b88d08a8079c91bcfc43e15a6",
-  "_from": "bluebird@^2.7.1",
+  "_from": "bluebird@^2.3.2",
   "_npmVersion": "2.5.1",
   "_nodeVersion": "1.2.0",
   "_npmUser": {
@@ -92,5 +92,6 @@
     "tarball": "http://registry.npmjs.org/bluebird/-/bluebird-2.9.12.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.12.tgz";
+  "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.12.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/node_modules/restbase-mod-table-cassandra/lib/db.js 
b/node_modules/restbase-mod-table-cassandra/lib/db.js
index bcb090f..ebcc645 100644
--- a/node_modules/restbase-mod-table-cassandra/lib/db.js
+++ b/node_modules/restbase-mod-table-cassandra/lib/db.js
@@ -728,7 +728,11 @@
         cql += ' and clustering order by ( ' + orderBits.join(',') + ' )';
     }
 
-    // console.log(cql);
+    if (schema.options && schema.options.compression) {
+        // check if we support one of the desired ones
+        cql += dbu.getTableCompressionCQL(schema.options.compression);
+    }
+    //console.log(cql);
 
     // TODO: If the table already exists, check that the schema actually
     // matches / can be upgraded!
diff --git a/node_modules/restbase-mod-table-cassandra/lib/dbutils.js 
b/node_modules/restbase-mod-table-cassandra/lib/dbutils.js
index fd7c713..c038d97 100644
--- a/node_modules/restbase-mod-table-cassandra/lib/dbutils.js
+++ b/node_modules/restbase-mod-table-cassandra/lib/dbutils.js
@@ -171,9 +171,20 @@
     if (schema.options) {
         var opts = schema.options;
         for (var key in opts) {
+            var val = opts[key];
             switch(key) {
+            case 'compression':
+                if (!Array.isArray(val)
+                        || !val.length
+                        || val.some(function(algo) {
+                            var cassAlgo = 
dbu.validCompressionAlgorithms[algo.algorithm];
+                            return cassAlgo === undefined || cassAlgo === 
false;
+                        })) {
+                    throw new Error('Invalid compression settings: '
+                            + JSON.stringify(val));
+                }
+                break;
             case 'durability':
-                var val = opts[key];
                 if (val !== 'low' && val !== 'standard') {
                     throw new Error ('Invalid durability level: ' + opts[key]);
                 }
@@ -770,4 +781,37 @@
     return {query: cql, params: params};
 };
 
+
+dbu.validCompressionAlgorithms = {
+    lz4: 'LZ4Compressor',
+    deflate: 'DeflateCompressor',
+    lzma: false,
+    snappy: 'SnappyCompressor'
+};
+
+dbu.validCompressionBlockSizes = {
+    64: 1,
+    128: 1,
+    256: 1,
+    512: 1,
+    1024: 1
+};
+
+dbu.getTableCompressionCQL = function(compressions) {
+    for (var i = 0; i < compressions.length; i++) {
+        var option = compressions[i];
+        if (option
+                && dbu.validCompressionAlgorithms[option.algorithm]
+                && 
dbu.validCompressionAlgorithms[option.algorithm].constructor === String
+                && dbu.validCompressionBlockSizes[option.block_size]) {
+            return " and compression = { 'sstable_compression' : '"
+                + dbu.validCompressionAlgorithms[option.algorithm]
+                + "', 'chunk_length_kb' : " + option.block_size + " }";
+        }
+    }
+    return '';
+};
+
+
+
 module.exports = dbu;
diff --git a/node_modules/restbase-mod-table-cassandra/package.json 
b/node_modules/restbase-mod-table-cassandra/package.json
index 00f205a..2dff26f 100644
--- a/node_modules/restbase-mod-table-cassandra/package.json
+++ b/node_modules/restbase-mod-table-cassandra/package.json
@@ -1,7 +1,7 @@
 {
   "name": "restbase-mod-table-cassandra",
   "description": "RESTBase table storage on Cassandra",
-  "version": "0.4.6",
+  "version": "0.4.7",
   "dependencies": {
     "async": "0.x.x",
     "bluebird": "~2.3.10",
@@ -33,11 +33,11 @@
   },
   "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## Issue tracking\n\nWe use [Phabricator to 
track\nissues](https://phabricator.wikimedia.org/maniphest/task/create/?projects=PHID-PROJ-xdgck5inpvozg2uwmj3f).
 See the [list of current issues in 
RESTBase-cassandra](https://phabricator.wikimedia.org/tag/restbase-cassandra/).\n\n##
 Status\n\nPreparing for production.\n\n[![Build 
Status](https://travis-ci.org/wikimedia/restbase-cassandra.svg?branch=master)](https://travis-ci.org/wikimedia/restbase-cassandra)\n[![coverage
 
status](https://coveralls.io/repos/wikimedia/restbase-cassandra/badge.png)](https://coveralls.io/r/wikimedia/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": "b43d2c1a31eec3e747d2f57b05705f27dfaaf48a",
+  "gitHead": "c48b2fd47b2d20ecf77de010005709874b25b432",
   "bugs": {
     "url": "https://github.com/wikimedia/restbase-mod-table-cassandra/issues";
   },
-  "_id": "[email protected]",
-  "_shasum": "03ff1efbd1662c94cb46a28368d552e953e8d955",
-  "_from": "restbase-mod-table-cassandra@^0.4.5"
+  "_id": "[email protected]",
+  "_shasum": "009ead9585db0f42fd66873286d26bc466fc42f2",
+  "_from": "restbase-mod-table-cassandra@^0.4.7"
 }
diff --git a/node_modules/restbase-mod-table-cassandra/test/index.js 
b/node_modules/restbase-mod-table-cassandra/test/index.js
index 33dcff5..ddf592c 100644
--- a/node_modules/restbase-mod-table-cassandra/test/index.js
+++ b/node_modules/restbase-mod-table-cassandra/test/index.js
@@ -80,7 +80,15 @@
                     domain: 'restbase.cassandra.test.local',
                     table: 'simple-table',
                     consistency: 'localQuorum',
-                    options: { durability: 'low' },
+                    options: {
+                        durability: 'low',
+                        compression: [
+                            {
+                                algorithm: 'deflate',
+                                block_size: 256
+                            }
+                        ]
+                    },
                     attributes: {
                         key: 'string',
                         tid: 'timeuuid',
diff --git a/node_modules/swagger-router/node_modules/bluebird/package.json 
b/node_modules/swagger-router/node_modules/bluebird/package.json
index 54dddb1..759de5c 100644
--- a/node_modules/swagger-router/node_modules/bluebird/package.json
+++ b/node_modules/swagger-router/node_modules/bluebird/package.json
@@ -92,5 +92,6 @@
     "tarball": "http://registry.npmjs.org/bluebird/-/bluebird-2.9.12.tgz";
   },
   "directories": {},
-  "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.12.tgz";
+  "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.12.tgz";,
+  "readme": "ERROR: No README data found!"
 }
diff --git a/restbase b/restbase
index a2fc252..2647407 160000
--- a/restbase
+++ b/restbase
-Subproject commit a2fc2524216eca92d39b7c9482b9736b4c97b444
+Subproject commit 2647407a0661736683209025d3e57498d0220e9f

-- 
To view, visit https://gerrit.wikimedia.org/r/191822
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d0d5a63f6d9619ee1967fb6fb1c9b2fae5c089b
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

Reply via email to