Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: trevnorris/norrd
base: 7f93774cba
...
head fork: trevnorris/norrd
compare: 8dc4122c33
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
6 collector.js
@@ -24,6 +24,7 @@ var http = require( 'http' ),
cli.version( '0.1.0' )
.option( '-f, --dir [dir]', 'Directory containing the receiver.js socket files', String, './sockets' )
+ .option( '-m, --multi', 'Set if this is a collector of collections' )
.option( '-p, --port [port]', 'Port or path to broadcast aggregated data', 7331 )
.option( '-s, --scan [numb]', 'Time to rescan socket dir for new socket files', Number, 30000 )
.option( '-t, --time [numb]', 'Time interval (in milliseconds) between data broadcasts', Number, 1000 )
@@ -116,7 +117,7 @@ function socketConnect( path ) {
// scan folder for new socket files
fs.readdir( cli.dir, function( e, files ) {
for ( var i = 0; i < files.length; i++ ) {
- if ( sPath.indexOf( files[i] ) === -1 && rSock.test( files[i] )) {
+ if ( sPath.indexOf( cli.dir + '/' + files[i] ) === -1 && rSock.test( files[i] )) {
// send path to receiver socket connector
socketConnect( cli.dir + '/' + files[i] );
}
@@ -128,7 +129,8 @@ function socketConnect( path ) {
// aggregate data from receivers at interval then broadcast to all listeners
gtime = ptime = Date.now() - cli.time;
-(function aggregate() {
+// if collector of collectors, then no need to broadcast
+if ( !cli.multi ) (function aggregate() {
// make sure aggregation is still not happening
if ( isAgg ) {
setTimeout( aggregate, 15 );
View
31 db/couchdb.js
@@ -1,31 +0,0 @@
-var net = require( 'net' ),
- cli = require( 'commander' ),
- nano = require( 'nano' ),
- netClient, db;
-
-require( './utils' );
-
-cli.option( '-b, --db [name]', 'Name of CouchDB database to use', String, 'norrd-data' )
- .option( '-c, --conn [url]', 'Location of the CouchDB instance', String, 'http://localhost' )
- .option( '-p, --port [port]', 'Port number of the CouchDB instance', 5984 )
- .option( '-n, --net [loc]', 'Location (URL or socket) of collector', '/tmp/norrd-collector.sock' )
- .option( '-d, --debug', 'Enable debugging' )
- .parse( process.argv );
-
-nano = nano( cli.conn + ':' + cli.port );
-db = nano.db.use( cli.db );
-netClient = net.connect( cli.net );
-
-function receiveDbData( er, ok ) {
- if ( cli.debug ) {
- if ( er ) debugLog( 'ERROR:', er );
- }
-}
-
-function onNetData( data ) {
- db.insert( JSON.parse( data.toString()), Date.now(), receiveDbData );
-}
-
-netClient.on( 'data', onNetData );
-
-console.log( 'server started' );
View
0  db/redis.js
No changes.
View
3  package.json
@@ -14,7 +14,8 @@
}],
"dependencies" : {
"commander" : "0.6.x",
- "nano" : "2.1.x",
+ "hiredis" : "0.1.x",
+ "redis" : "0.7.x",
"socket.io" : "0.9.x"
},
"repository" : {

No commit comments for this range

Something went wrong with that request. Please try again.