pixl-server-storage 3.0.20 → 3.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -523,10 +523,12 @@ Note that binary records are **not** cached, as they are generally large. Only
523
523
 
524
524
  ## Couchbase
525
525
 
526
- If you want to use [Couchbase](http://www.couchbase.com/nosql-databases/couchbase-server) as a backing store, here is how to do so. First, you need to manually install the [couchbase](https://www.npmjs.com/package/couchbase) module into your app:
526
+ Please note that as of this writing (April 2022), pixl-server-storage only supports Couchbase Client v2, so you need to force install version `2.6.12` (see instructions below). Work is underway to support the v3 API, which has many breaking changes.
527
+
528
+ If you want to use [Couchbase](http://www.couchbase.com/nosql-databases/couchbase-server) as a backing store, here is how to do so. First, you need to manually install the [couchbase](https://www.npmjs.com/package/couchbase) module into your app, and it **must be v2**:
527
529
 
528
530
  ```
529
- npm install --save couchbase
531
+ npm install --save couchbase@2.6.12
530
532
  ```
531
533
 
532
534
  Then configure your storage thusly:
package/engines/S3.js CHANGED
@@ -275,7 +275,7 @@ module.exports = Class.create({
275
275
  if (done) return; else done = true;
276
276
 
277
277
  if (err) {
278
- if (err.code == 'NoSuchKey') {
278
+ if ((err.code == 'NoSuchKey') || (err.code == 'NotFound')) {
279
279
  // key not found, special case, don't log an error
280
280
  // always include "Not found" in error message
281
281
  err = new Error("Failed to fetch key: " + key + ": Not found");
@@ -346,9 +346,17 @@ module.exports = Class.create({
346
346
  if (done) return; else done = true;
347
347
 
348
348
  if (err) {
349
- if ((err.code != 'NoSuchKey') && (err.code != 'NotFound')) {
350
- self.logError('s3', "Failed to head key: " + key + ": " + (err.message || err), err);
349
+ if ((err.code == 'NoSuchKey') || (err.code == 'NotFound')) {
350
+ // key not found, special case, don't log an error
351
+ // always include "Not found" in error message
352
+ err = new Error("Failed to fetch key: " + key + ": Not found");
353
+ err.code = "NoSuchKey";
354
+ }
355
+ else {
356
+ // some other error
357
+ self.logError('s3', "Failed to fetch key: " + key + ": " + (err.message || err), err);
351
358
  }
359
+
352
360
  download.destroy();
353
361
  callback( err, null );
354
362
  return;
@@ -397,9 +405,17 @@ module.exports = Class.create({
397
405
  if (done) return; else done = true;
398
406
 
399
407
  if (err) {
400
- if ((err.code != 'NoSuchKey') && (err.code != 'NotFound')) {
401
- self.logError('s3', "Failed to head key: " + key + ": " + (err.message || err), err);
408
+ if ((err.code == 'NoSuchKey') || (err.code == 'NotFound')) {
409
+ // key not found, special case, don't log an error
410
+ // always include "Not found" in error message
411
+ err = new Error("Failed to fetch key: " + key + ": Not found");
412
+ err.code = "NoSuchKey";
402
413
  }
414
+ else {
415
+ // some other error
416
+ self.logError('s3', "Failed to fetch key: " + key + ": " + (err.message || err), err);
417
+ }
418
+
403
419
  download.destroy();
404
420
  callback( err, null );
405
421
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-server-storage",
3
- "version": "3.0.20",
3
+ "version": "3.0.23",
4
4
  "description": "A key/value/list storage component for the pixl-server framework.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-server-storage",
@@ -26,7 +26,7 @@
26
26
  "pixl-tools": "^1.0.24",
27
27
  "pixl-perf": "^1.0.0",
28
28
  "pixl-cache": "^1.0.1",
29
- "async": "2.6.0",
29
+ "async": "2.6.4",
30
30
  "nearley": "2.20.1",
31
31
  "moo": "0.4.3",
32
32
  "porter-stemmer": "0.9.1",
package/storage.js CHANGED
@@ -893,6 +893,7 @@ module.exports = Class.create({
893
893
  },
894
894
  function() {
895
895
  // all locks released
896
+ self.logDebug(9, "All locks released.");
896
897
  callback();
897
898
  }
898
899
  ); // whilst
package/test/test-hash.js CHANGED
@@ -10,7 +10,7 @@ var async = require('async');
10
10
  var Tools = require('pixl-tools');
11
11
 
12
12
  // const BAD_KEYS = Object.getOwnPropertyNames( Object.prototype );
13
- const BAD_KEYS = ['constructor', '__defineGetter__', '__defineSetter__', 'hasOwnProperty', '__lookupGetter__', '__lookupSetter__', 'isPrototypeOf', 'propertyIsEnumerable', 'toString', 'valueOf', '__proto__', 'toLocaleString'];
13
+ const BAD_KEYS = ['constructor', '__defineGetter__', '__defineSetter__', 'hasOwnProperty', '__lookupGetter__', '__lookupSetter__', 'isPrototypeOf', 'propertyIsEnumerable', 'toString', 'valueOf', 'toLocaleString'];
14
14
 
15
15
  module.exports = {
16
16
  tests: [
package/transaction.js CHANGED
@@ -638,14 +638,17 @@ module.exports = Class.create({
638
638
  }
639
639
 
640
640
  // complete, unlock and remove transaction from memory
641
- self.unlock( 'C|'+path );
642
- self._transUnlock(path);
643
641
  self.transactions[path].keys = {}; // release memory
644
642
  self.transactions[path].values = {}; // release memory
645
643
  self.transactions[path].queue = []; // release memory
646
644
  delete self.transactions[path];
647
645
 
648
646
  self.logDebug(3, "Transaction rollback complete: " + trans.id, { path: path });
647
+
648
+ // unlock at the VERY end, as a new transaction may be waiting on the same path
649
+ self.unlock( 'C|'+path );
650
+ self._transUnlock(path);
651
+
649
652
  callback();
650
653
  }); // fs.unlink
651
654
  } // done with log