node events notifications

This commit is contained in:
cubedro
2015-02-18 08:06:41 +02:00
parent 71b1f7503a
commit 1959e77407
6 changed files with 36 additions and 7 deletions

View File

@@ -28,6 +28,18 @@ Collection.prototype.update = function(id, stats)
return node.getStats();
}
Collection.prototype.inactive = function(id)
{
var node = this.getNode({ spark: id });
if(!node)
return false;
node.stats.active = false;
return node.getStats();
}
Collection.prototype.getIndex = function(search)
{
return _.findIndex(this._list, search);

View File

@@ -36,6 +36,9 @@ var Node = function Node(data)
this.setGeo(data.ip);
}
if(typeof data.spark !== 'undefined')
this.spark = data.spark;
return this;
}
@@ -53,6 +56,9 @@ Node.prototype.setInfo = function(data)
this.info.ip = data.ip;
this.setGeo(data.ip);
}
if(typeof data.spark !== 'undefined')
this.spark = data.spark;
}
Node.prototype.getInfo = function()