added latency update

This commit is contained in:
cubedro
2015-04-03 07:00:06 +03:00
parent 9487a06dbd
commit ec14cc4d67
4 changed files with 43 additions and 0 deletions

View File

@@ -26,6 +26,16 @@ Collection.prototype.update = function(id, stats)
return node.setStats(stats);
}
Collection.prototype.updateLatency = function(id, latency)
{
var node = this.getNode({ id: id });
if(!node)
return false;
return node.setLatency(latency);
}
Collection.prototype.inactive = function(id)
{
var node = this.getNode({ spark: id });

View File

@@ -104,6 +104,18 @@ Node.prototype.setStats = function(stats)
return false;
}
Node.prototype.setLatency = function(latency)
{
if(typeof latency !== 'undefined')
{
this.stats.latency = latency;
return { id: this.id, latency: latency };
}
return false;
}
Node.prototype.getStats = function()
{
return {id: this.id, stats: this.stats};