pixl-server-storage 3.1.2 → 3.1.4
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 +9 -5
- package/engines/S3.js +8 -1
- package/engines/SQLite.js +12 -0
- package/package.json +1 -1
- package/test/config.json +5 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Here is the table of contents for this current document:
|
|
|
41
41
|
* [log_event_types](#log_event_types)
|
|
42
42
|
* [max_recent_events](#max_recent_events)
|
|
43
43
|
* [expiration_updates](#expiration_updates)
|
|
44
|
+
* [lower_case_keys](#lower_case_keys)
|
|
44
45
|
* [debug (standalone)](#debug-standalone)
|
|
45
46
|
- [Engines](#engines)
|
|
46
47
|
* [Local Filesystem](#local-filesystem)
|
|
@@ -56,6 +57,7 @@ Here is the table of contents for this current document:
|
|
|
56
57
|
* [Couchbase](#couchbase)
|
|
57
58
|
* [Redis](#redis)
|
|
58
59
|
+ [RedisCluster](#rediscluster)
|
|
60
|
+
* [SQLite](#sqlite)
|
|
59
61
|
* [Hybrid](#hybrid)
|
|
60
62
|
- [Key Normalization](#key-normalization)
|
|
61
63
|
- [Basic Functions](#basic-functions)
|
|
@@ -626,16 +628,18 @@ Then configure your storage thusly:
|
|
|
626
628
|
"engine": "SQLite",
|
|
627
629
|
"SQLite": {
|
|
628
630
|
"base_dir": "data",
|
|
629
|
-
"filename": "sqlite.db"
|
|
631
|
+
"filename": "sqlite.db",
|
|
632
|
+
"pragmas": {
|
|
633
|
+
"auto_vacuum": 0,
|
|
634
|
+
"cache_size": -100000
|
|
635
|
+
}
|
|
630
636
|
}
|
|
631
637
|
}
|
|
632
638
|
```
|
|
633
639
|
|
|
634
|
-
The `base_dir` defaults to the current working directory, and will be created on startup if necessary.
|
|
635
|
-
|
|
636
|
-
The optional `keyPrefix` property works similarly to the [S3 Key Prefix](#s3-key-prefix) feature. It allows you to prefix all the SQLite keys with a common string, to separate your application's data in a shared database situation.
|
|
640
|
+
The `base_dir` defaults to the current working directory, and will be created on startup if necessary. The `filename` is the name of the SQLite DB file on disk (also created if necessary).
|
|
637
641
|
|
|
638
|
-
The optional `
|
|
642
|
+
The optional `pragmas` object allows you set one or more [SQLite Pragmas](https://www.sqlite.org/pragma.html#toc) (configuration settings) on the database at startup. Here you can specify things such as [auto_vacuum](https://www.sqlite.org/pragma.html#pragma_auto_vacuum) and [cache_size](https://www.sqlite.org/pragma.html#pragma_cache_size), among many others.
|
|
639
643
|
|
|
640
644
|
## Hybrid
|
|
641
645
|
|
package/engines/S3.js
CHANGED
|
@@ -408,9 +408,16 @@ module.exports = Class.create({
|
|
|
408
408
|
self.logDebug(9, "S3 stream download closed: " + key);
|
|
409
409
|
} );
|
|
410
410
|
|
|
411
|
+
// get full length from the ContentRange header
|
|
412
|
+
var len = 0;
|
|
413
|
+
if (data.ContentRange && data.ContentRange.toString().match(/\/\s*(\d+)\s*$/)) {
|
|
414
|
+
len = parseInt( RegExp.$1 );
|
|
415
|
+
}
|
|
416
|
+
|
|
411
417
|
callback( null, download, {
|
|
412
418
|
mod: Math.floor( (new Date(data.LastModified)).getTime() / 1000 ),
|
|
413
|
-
len:
|
|
419
|
+
len: len,
|
|
420
|
+
cr: data.ContentRange
|
|
414
421
|
} );
|
|
415
422
|
})
|
|
416
423
|
.catch( function(err) {
|
package/engines/SQLite.js
CHANGED
|
@@ -62,6 +62,18 @@ module.exports = Class.create({
|
|
|
62
62
|
self.db = new SQLite3.Database( db_file, callback );
|
|
63
63
|
},
|
|
64
64
|
function(callback) {
|
|
65
|
+
// optionally set pragmas on the db
|
|
66
|
+
if (!sql_config.pragmas) return process.nextTick(callback);
|
|
67
|
+
async.eachSeries( Object.keys(sql_config.pragmas),
|
|
68
|
+
function(key, callback) {
|
|
69
|
+
var value = sql_config.pragmas[key];
|
|
70
|
+
self.db.run(`PRAGMA ${key} = ${value};`, callback);
|
|
71
|
+
},
|
|
72
|
+
callback
|
|
73
|
+
); // eachSeries
|
|
74
|
+
},
|
|
75
|
+
function(callback) {
|
|
76
|
+
// create our table if necessary
|
|
65
77
|
self.db.run( 'CREATE TABLE IF NOT EXISTS items( key TEXT PRIMARY KEY, value BLOB, modified INTEGER )', callback );
|
|
66
78
|
},
|
|
67
79
|
function(callback) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixl-server-storage",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
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",
|