From 44a8fcd905c3c594edeae671406ab1d041446803 Mon Sep 17 00:00:00 2001 From: Jeff Wolski Date: Thu, 10 Sep 2015 11:00:14 +0200 Subject: [PATCH] Add checksum to ring stats --- index.js | 2 +- lib/ring.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index cf8ceac5..501354ac 100644 --- a/index.js +++ b/index.js @@ -403,7 +403,7 @@ RingPop.prototype.getStats = function getStats() { serverRate: this.serverRate.printObj().m1, totalRate: this.totalRate.printObj().m1 }, - ring: Object.keys(this.ring.servers), + ring: this.ring.getStats(), version: this.ringpopVersion, timestamp: timestamp, uptime: uptime diff --git a/lib/ring.js b/lib/ring.js index afed5610..11c4acdb 100644 --- a/lib/ring.js +++ b/lib/ring.js @@ -108,6 +108,13 @@ HashRing.prototype.getServerCount = function getServerCount() { return Object.keys(this.servers).length; }; +HashRing.prototype.getStats = function getStats() { + return { + checksum: this.checksum, + servers: Object.keys(this.servers) + }; +}; + HashRing.prototype.hasServer = function hasServer(name) { return !!this.servers[name]; };