diff --git a/docs/api/api_project.js b/docs/api/api_project.js
index d2e7923a..67134513 100644
--- a/docs/api/api_project.js
+++ b/docs/api/api_project.js
@@ -1,13 +1,13 @@
define({
"name": "skyring",
- "version": "6.0.0-alpha.1",
+ "version": "6.0.0",
"description": "Distributed timers as a service",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
- "time": "2018-02-22T04:33:17.651Z",
+ "time": "2018-03-11T18:53:52.639Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
diff --git a/docs/api/api_project.json b/docs/api/api_project.json
index c4692966..74a33290 100644
--- a/docs/api/api_project.json
+++ b/docs/api/api_project.json
@@ -1,13 +1,13 @@
{
"name": "skyring",
- "version": "6.0.0-alpha.1",
+ "version": "6.0.0",
"description": "Distributed timers as a service",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
- "time": "2018-02-22T04:33:17.651Z",
+ "time": "2018-03-11T18:53:52.639Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
diff --git a/docs/classes.list.html b/docs/classes.list.html
index b2aedb64..6f5f031b 100644
--- a/docs/classes.list.html
+++ b/docs/classes.list.html
@@ -247,7 +247,7 @@
Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/global.html b/docs/global.html
index 6e80db73..2c691ff5 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -820,7 +820,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/index.html b/docs/index.html
index 0a58e58f..8d4a5edb 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -189,7 +189,13 @@ Create a timer
POST /timer
memdown backend is used, and wil not
persists between starts. To enable full persistence and recovery, you must configure skyring to use a
persistent backend for levelup
. Leveldown is installed by default.
-skyring run --storage:backend=leveldown --storage:path='/var/data/skyring'
Custom Transports
Skyring ships with a single HTTP transport, but support custom transports. A transport
is a named function
+
skyring run --storage:backend=leveldown --storage:path='/var/data/skyring'
Custom Storage
In situations when the local disk is not reliable enough, you can install and use any levelup backend to suite your needs.
+If, for example you want to off load data storage to a mongo
+or scylladb cluster, you would just include the backend package
+as a dependency in your project and specify it by name as the stoargae package. Options for the backend can be passed via the storage
attribute
+npm install @skyring/scylladown
+skyring run --storage:backend=@skyring/scylladown --storage:path=skyring-1 --storage:contactPoints=0.0.0.0:9042 --storage:contactPoints=0.0.0.0:9043
+skyring run --storage:backend=@skyring/scylladown --storage:path=skyring-2 --storage:contactPoints=0.0.0.0:9042 --storage:contactPoints=0.0.0.0:9043
Custom Transports
Skyring ships with a single HTTP transport, but support custom transports. A transport
is a named function
that can be executed when a timer triggers. To register a transport, you can pass an array of named functions, or
requireable paths to the skyring server constructor via via the transports option
Optionally, for transports that need to perform some clean up work, a function property shutdown
may be defined
@@ -265,7 +271,7 @@
Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/index.js.html b/docs/index.js.html
index 83ca00e7..fa146c00 100644
--- a/docs/index.js.html
+++ b/docs/index.js.html
@@ -117,7 +117,7 @@ Source: index.js
const server = new Server();
- server.load().listen(conf.get('PORT'), (err) => {
+ server.listen(conf.get('PORT'), (err) => {
if(err) {
process.exitCode = 1;
console.error(err);
@@ -202,7 +202,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_json.js.html b/docs/lib_json.js.html
index 15dc6330..0788e3b9 100644
--- a/docs/lib_json.js.html
+++ b/docs/lib_json.js.html
@@ -167,7 +167,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_nats.js.html b/docs/lib_nats.js.html
index 42844ca1..2aeb2eaf 100644
--- a/docs/lib_nats.js.html
+++ b/docs/lib_nats.js.html
@@ -229,7 +229,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_index.js.html b/docs/lib_server_index.js.html
index 3d15f7a5..ced136ef 100644
--- a/docs/lib_server_index.js.html
+++ b/docs/lib_server_index.js.html
@@ -105,8 +105,10 @@ Source: lib/server/index.js
*/
const http = require('http')
+ , util = require('util')
, Debug = require('debug')
, mock = require('./mock')
+ , routes = require('./api')
, Node = require('./node')
, Router = require('./router')
, Timer = require('../timer')
@@ -176,43 +178,13 @@ Source: lib/server/index.js
this._node = new Node();
}
this._group = this._node.name;
- this._timers = new Timer({
- nats: this.options.nats
- , storage: this.options.storage
- , transports: this.options.transports
- });
- this._router = new Router(this._node, this._timers);
- this._node.on('ringchange', (evt) => {
- this._timers.rebalance(evt, this._node, (data) => {
- this.proxy(data);
- });
- });
this._node.on('bootstrap', (seeds) => {
this.emit('bootstrap', seeds);
});
- }
- /**
- * loads application routes if not already loaded
- * @method module:skyring/lib/server#load
- * @return {module:skyring/lib/server}
- **/
- load() {
- if( this.loaded ) return this;
- const routes = require('./api');
- Object.keys(routes)
- .forEach((name) => {
- const item = routes[name];
- const route = this._router.route(
- item.path
- , item.method
- , item.handler
- );
-
- item.middleware && route.before( item.middleware );
- });
-
- return this;
+ this.load = util.deprecate(() => {
+ return this
+ }, 'server#load is deprecated and will be removed in future version')
}
/**
@@ -227,18 +199,42 @@ Source: lib/server/index.js
listen(port, ...args) {
const callback = args[args.length - 1]
debug('seed nodes', this.options.seeds);
- this._node.join(this.options.seeds, (err) => {
- if (err) {
- console.error(err);
- return typeof callback === 'function' ? callback(err) : null;
+
+ this._timers = new Timer({
+ nats: this.options.nats
+ , storage: this.options.storage
+ , transports: this.options.transports
+ }, (err) => {
+ if (err) return typeof callback === 'function' ? callback(err) : null;
+ this._router = new Router(this._node, this._timers);
+ for (const key of Object.keys(routes)) {
+ const item = routes[key]
+ const route = this._router.route(
+ item.path
+ , item.method
+ , item.handler
+ );
+
+ item.middleware && route.before( item.middleware );
}
- this._node.handle(( req, res ) => {
- this._router.handle( req, res );
+ this._node.on('ringchange', (evt) => {
+ this._timers.rebalance(evt, this._node, (data) => {
+ this.proxy(data);
+ });
});
- this._timers.watch(`skyring:${this._group}`, (err, data) => {
- this.proxy(data);
+ this._node.join(this.options.seeds, (err) => {
+ if (err) {
+ console.error(err);
+ return typeof callback === 'function' ? callback(err) : null;
+ }
+ this._node.handle(( req, res ) => {
+ this._router.handle( req, res );
+ });
+ this._timers.watch(`skyring:${this._group}`, (err, data) => {
+ this.proxy(data);
+ });
+ super.listen(port, ...args);
});
- super.listen(port, ...args);
});
return this;
}
@@ -337,7 +333,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_mock.js.html b/docs/lib_server_mock.js.html
index 73286f86..adf24109 100644
--- a/docs/lib_server_mock.js.html
+++ b/docs/lib_server_mock.js.html
@@ -317,7 +317,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_node.js.html b/docs/lib_server_node.js.html
index 1a00d42c..07adbbf8 100644
--- a/docs/lib_server_node.js.html
+++ b/docs/lib_server_node.js.html
@@ -340,7 +340,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_request.js.html b/docs/lib_server_request.js.html
index 8018f935..296b8c49 100644
--- a/docs/lib_server_request.js.html
+++ b/docs/lib_server_request.js.html
@@ -220,7 +220,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_response.js.html b/docs/lib_server_response.js.html
index f3db7db0..2fdb4bd3 100644
--- a/docs/lib_server_response.js.html
+++ b/docs/lib_server_response.js.html
@@ -261,7 +261,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_route.js.html b/docs/lib_server_route.js.html
index 5a9b9b43..88d3d2b2 100644
--- a/docs/lib_server_route.js.html
+++ b/docs/lib_server_route.js.html
@@ -250,7 +250,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_server_router.js.html b/docs/lib_server_router.js.html
index b05b11e9..13bd8714 100644
--- a/docs/lib_server_router.js.html
+++ b/docs/lib_server_router.js.html
@@ -308,7 +308,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_timer.js.html b/docs/lib_timer.js.html
index 11fb60c6..da1a22cb 100644
--- a/docs/lib_timer.js.html
+++ b/docs/lib_timer.js.html
@@ -198,9 +198,7 @@ Source: lib/timer.js
this[kNode] = generateId(store_opts.path)
this.nats = nats.createClient( this.options.nats );
this.transports = new Transports(this.options.transports);
- this[storage] = levelup(backend, opts)
-
- this[storage].once('ready', () => {
+ this[storage] = levelup(backend, opts, (err) => {
store('storage backend ready', store_opts);
debug('node id', this[kNode])
this.recover(() => {
@@ -209,7 +207,8 @@ Source: lib/timer.js
, type: EVENT_STATUS.READY
}), cb)
});
- });
+ })
+
}
/**
@@ -644,7 +643,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_transports_callback.js.html b/docs/lib_transports_callback.js.html
index 264831ca..2127e901 100644
--- a/docs/lib_transports_callback.js.html
+++ b/docs/lib_transports_callback.js.html
@@ -148,7 +148,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_transports_http.js.html b/docs/lib_transports_http.js.html
index 5d2ec29a..6e11f89e 100644
--- a/docs/lib_transports_http.js.html
+++ b/docs/lib_transports_http.js.html
@@ -200,7 +200,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/lib_transports_index.js.html b/docs/lib_transports_index.js.html
index a0496749..a7c3d52b 100644
--- a/docs/lib_transports_index.js.html
+++ b/docs/lib_transports_index.js.html
@@ -277,7 +277,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-keef.html b/docs/module-keef.html
index 57b0e866..b2dc74c5 100644
--- a/docs/module-keef.html
+++ b/docs/module-keef.html
@@ -331,7 +331,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring.html b/docs/module-skyring.html
index c8ca8e8d..3acc550d 100644
--- a/docs/module-skyring.html
+++ b/docs/module-skyring.html
@@ -246,7 +246,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_conf.html b/docs/module-skyring_conf.html
index af943724..40a6138b 100644
--- a/docs/module-skyring_conf.html
+++ b/docs/module-skyring_conf.html
@@ -726,7 +726,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_json.html b/docs/module-skyring_lib_json.html
index b0caaf89..11ed2a4b 100644
--- a/docs/module-skyring_lib_json.html
+++ b/docs/module-skyring_lib_json.html
@@ -522,7 +522,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_nats.html b/docs/module-skyring_lib_nats.html
index a273d940..6ec6d1aa 100644
--- a/docs/module-skyring_lib_nats.html
+++ b/docs/module-skyring_lib_nats.html
@@ -510,7 +510,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server.html b/docs/module-skyring_lib_server.html
index 6353d092..c403f1e7 100644
--- a/docs/module-skyring_lib_server.html
+++ b/docs/module-skyring_lib_server.html
@@ -1027,113 +1027,6 @@ Parameters:
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
-
- -
- Type
-
- -
-
-module:skyring/lib/server
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- load()
-
-
-
-
-
-
-
-
loads application routes if not already loaded
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1250,7 +1143,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_mock.Request.html b/docs/module-skyring_lib_server_mock.Request.html
index 7a96641d..b7e519ad 100644
--- a/docs/module-skyring_lib_server_mock.Request.html
+++ b/docs/module-skyring_lib_server_mock.Request.html
@@ -269,7 +269,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_mock.Response.html b/docs/module-skyring_lib_server_mock.Response.html
index 94250cd4..8fb95edf 100644
--- a/docs/module-skyring_lib_server_mock.Response.html
+++ b/docs/module-skyring_lib_server_mock.Response.html
@@ -269,7 +269,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_mock.html b/docs/module-skyring_lib_server_mock.html
index 59dc72be..186f4b9d 100644
--- a/docs/module-skyring_lib_server_mock.html
+++ b/docs/module-skyring_lib_server_mock.html
@@ -255,7 +255,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_node.html b/docs/module-skyring_lib_server_node.html
index a6e136bd..3e5dcade 100644
--- a/docs/module-skyring_lib_server_node.html
+++ b/docs/module-skyring_lib_server_node.html
@@ -1723,7 +1723,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_request.html b/docs/module-skyring_lib_server_request.html
index 4903a180..aeeda5e3 100644
--- a/docs/module-skyring_lib_server_request.html
+++ b/docs/module-skyring_lib_server_request.html
@@ -241,7 +241,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_response.html b/docs/module-skyring_lib_server_response.html
index a670ba9a..9adba054 100644
--- a/docs/module-skyring_lib_server_response.html
+++ b/docs/module-skyring_lib_server_response.html
@@ -1499,7 +1499,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_route.html b/docs/module-skyring_lib_server_route.html
index 48148cc5..cb9fb68f 100644
--- a/docs/module-skyring_lib_server_route.html
+++ b/docs/module-skyring_lib_server_route.html
@@ -628,7 +628,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_server_router.html b/docs/module-skyring_lib_server_router.html
index bc338a0e..77274e59 100644
--- a/docs/module-skyring_lib_server_router.html
+++ b/docs/module-skyring_lib_server_router.html
@@ -1879,7 +1879,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_timer.html b/docs/module-skyring_lib_timer.html
index 90930521..898b0aef 100644
--- a/docs/module-skyring_lib_timer.html
+++ b/docs/module-skyring_lib_timer.html
@@ -2805,7 +2805,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_transports.html b/docs/module-skyring_lib_transports.html
index 3539d8ee..986d0751 100644
--- a/docs/module-skyring_lib_transports.html
+++ b/docs/module-skyring_lib_transports.html
@@ -729,7 +729,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_transports_http.html b/docs/module-skyring_lib_transports_http.html
index b0c78d18..1a38d5de 100644
--- a/docs/module-skyring_lib_transports_http.html
+++ b/docs/module-skyring_lib_transports_http.html
@@ -419,7 +419,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/module-skyring_lib_transports_timer.html b/docs/module-skyring_lib_transports_timer.html
index 914e7583..8334cd3f 100644
--- a/docs/module-skyring_lib_transports_timer.html
+++ b/docs/module-skyring_lib_transports_timer.html
@@ -233,7 +233,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/modules.list.html b/docs/modules.list.html
index 3f2e0612..28cf7c76 100644
--- a/docs/modules.list.html
+++ b/docs/modules.list.html
@@ -247,7 +247,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/node_modules_keef_index.js.html b/docs/node_modules_keef_index.js.html
index 3241c9c8..0760b0a4 100644
--- a/docs/node_modules_keef_index.js.html
+++ b/docs/node_modules_keef_index.js.html
@@ -404,7 +404,7 @@ Search results
Documentation generated by JSDoc 3.5.5
- on 2018-02-21T23:33:17-05:00
+ on 2018-03-11T13:53:52-05:00
using the DocStrap template.
diff --git a/docs/quicksearch.html b/docs/quicksearch.html
index da36e734..aa1cfbbd 100644
--- a/docs/quicksearch.html
+++ b/docs/quicksearch.html
@@ -7,7 +7,7 @@