Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
esatterwhite committed May 1, 2017
1 parent 7f616e6 commit c7be03f
Show file tree
Hide file tree
Showing 36 changed files with 263 additions and 149 deletions.
4 changes: 2 additions & 2 deletions docs/api/api_project.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
define({
"name": "skyring",
"version": "4.0.1",
"version": "4.0.2",
"description": "Distributed timers as a service",
"sampleUrl": false,
"apidoc": "0.2.0",
"generator": {
"name": "apidoc",
"time": "2017-04-30T14:20:23.599Z",
"time": "2017-05-01T03:01:03.949Z",
"url": "http://apidocjs.com",
"version": "0.16.1"
}
Expand Down
4 changes: 2 additions & 2 deletions docs/api/api_project.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "skyring",
"version": "4.0.1",
"version": "4.0.2",
"description": "Distributed timers as a service",
"sampleUrl": false,
"apidoc": "0.2.0",
"generator": {
"name": "apidoc",
"time": "2017-04-30T14:20:23.599Z",
"time": "2017-05-01T03:01:03.949Z",
"url": "http://apidocjs.com",
"version": "0.16.1"
}
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
51 changes: 39 additions & 12 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,36 +82,63 @@ <h1 class="page-title">Source: index.js</h1>
* @requires keef
* @requires skyring/lib/server
**/
process.title = 'skyring';
process.chdir(__dirname);

const http = require('http')
, path = require('path')
, conf = require('keef')
, Server = require('./lib/server')
;

if( require.main !== module ){
conf.defaults(require(path.join(__dirname, 'conf/index.json')))
module.exports = require('./lib/server');
return;
}


const Server = require('./lib/server')
, debug = require('debug')('skyring')
;

process.title = 'skyring';
process.chdir(__dirname);

const server = new Server();

module.exports = server;

if( require.main === module ){
server.load().listen(conf.get('PORT'),null, null, (err) => {
if(err) return console.log(err) || process.exit(1)
debug('server listening')
});
}

server.load().listen(conf.get('PORT'),null, null, (err) => {
if(err) return console.log(err) || process.exit(1)
debug('server listening')
});

function onSignal() {
server.close(()=>{
debug('shutting down')
process.statusCode = 0
})
}

process.once('SIGINT', onSignal);
process.once('SIGTERM', onSignal);


/**
* Configuration options for skyring. See {@link module:keef} on ways to pass configuration
* @module skyring/conf
* @author Eric Satterwhite
* @since 1.0.0
* @property {String|String[]} [seeds=127.0.0.1:3455,127.0.0.1:3456] A list of seed nodes to use for bootstrapping a ring cluster
* @property {Object} channel
* @property {String} [channel.host=127.0.0.1] hostname or ip addres for tchannel to listen on
* @property {Number} [channel.port=3455] Port number for tchannel to bind to
* @property {Number} [PORT=3000] The port number for the http API server to bind to
* @property {Object} nats Nats queue specific configuration
* @property {String|String[]} [nats.hosts=127.0.0.1:4222] host:port of instances of a nats cluster. One is usually enough.
* @property {Object} [options.storage] Storage config options for level db
* @property {String[]} [options.storage.backend=memdown] a requireable module name, or absolute path to a leveldb compatible backend
* `leveldown` and `memdown` are installed by default
* @property {String} options.storage.path A directory path to a leveldb instance. One will be created if it doesn't already exist.
* If the backend is memdown, this is optional and randomly generated per timer instance
**/
</pre>
</article>
</section>
Expand Down Expand Up @@ -157,7 +184,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_json.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_nats.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_mock.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_server_node.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ <h1 class="page-title">Source: lib/server/node.js</h1>
this._ring.setupChannel();
this._ring.on('ringChanged', ( evt ) => {
const added = evt.added;
if(!added.length) return;
if(!added.length) return debug('node removed', evt.removed);
if(added.length === 1 &amp;&amp; added.indexOf(`${host}:${this._port}`) !== -1) return;
debug('node added', added)
this.emit('ringchange', evt);
Expand Down Expand Up @@ -314,7 +314,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_request.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_response.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_route.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_server_router.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
25 changes: 21 additions & 4 deletions docs/lib_timer.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ <h1 class="page-title">Source: lib/timer.js</h1>
valueEncoding: 'json'
, db: require( opts.backend )
, cacheSize: opts.cache
, writeBufferSize: opts.writeBufferSize
});

this[storage].once('ready', () => {
Expand Down Expand Up @@ -266,6 +267,7 @@ <h1 class="page-title">Source: lib/timer.js</h1>
rebalance(opts, node, cb) {
const callback = cb || noop
, size = this.size
, batch = this[storage].batch()
;

if( !size ) return;
Expand All @@ -274,6 +276,7 @@ <h1 class="page-title">Source: lib/timer.js</h1>
if ( node.owns( obj.id ) ) return;
clearTimeout( obj.timer );
this.delete( obj.id );
batch.del(obj.id)
const data = Object.assign({}, obj.payload, {
id: obj.id
, created: obj.created
Expand All @@ -285,6 +288,9 @@ <h1 class="page-title">Source: lib/timer.js</h1>
for( var record of records ) {
run( record );
}
batch.write(() => {
store('rebalance batch delete complete')
})
}

recover(cb) {
Expand Down Expand Up @@ -337,24 +343,35 @@ <h1 class="page-title">Source: lib/timer.js</h1>
const size = this.size;
const client = this.nats;

this[storage].close();
if( !size ) return this.nats.quit(cb);
if( !size ) {
this[storage].close();
return this.nats.quit(cb);
}

let sent = 0;
let acks = 0;

const batch = this[storage].batch()

client.unsubscribe( this._sid );
this._sid = null;

const run = ( obj ) => {
clearTimeout( obj.timer );
batch.del(obj.id)
const data = Object.assign({}, obj.payload, {
id: obj.id
, created: obj.created
, count: ++sent
});

this.nats.publish('skyring', JSON.stringify( data ), () => {
if( ++acks === size ) return setImmediate(this.nats.quit, cb);
if( ++acks === size ) {
return batch.write(() => {
store('batch delete finished')
setImmediate(this.nats.quit, cb);
})
}
rebalance( '%s of %s processed', data.count, acks, data.id);
});
};
Expand Down Expand Up @@ -433,7 +450,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_transports_callback.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_transports_http.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/lib_transports_index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-keef.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/module-skyring.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>

on 2017-04-30T09:20:23-05:00
on 2017-04-30T22:01:03-05:00

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
Loading

0 comments on commit c7be03f

Please sign in to comment.