Skip to content

Commit

Permalink
not to expose membership functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Hu committed Jul 30, 2015
1 parent 1c37d2e commit eb69f2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
20 changes: 17 additions & 3 deletions benchmarks/convergence-time/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var program = require('commander');
var TChannel = require('tchannel');

var Swim = require('../../');
var leaveHandler = require('../../server/admin-leave-handler');
var joinHandler = require('../../server/admin-join-handler');

if (require.main === module) {
parseArgs();
Expand Down Expand Up @@ -67,7 +69,7 @@ function handleMessage(swim) {
});
break;
case 'join':
swim.adminJoin(function onAdminJoin(err) {
join(swim, function onJoin(err) {
if (err) {
console.error(err);
process.exit(1);
Expand All @@ -81,10 +83,10 @@ function handleMessage(swim) {
});
break;
case 'leave':
swim.adminLeave(function onLeave() {});
leave(swim, function onLeave() {});
break;
case 'shutdown':
swim.adminLeave(function onLeave() {});
leave(swim, function onLeave() {});
process.removeListener('message', onMessage);
process.exit();
break;
Expand Down Expand Up @@ -131,3 +133,15 @@ function bootstrap(callback) {

swim.channel.listen(Number(port), host);
}

function join(swim, callback) {
joinHandler({
ringpop: swim
}, callback);
}

function leave(swim, callback) {
leaveHandler({
ringpop: swim
}, callback);
}
14 changes: 0 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ var rawHead = require('./lib/request-proxy/util.js').rawHead;
var RequestProxy = require('./lib/request-proxy/index.js');
var safeParse = require('./lib/util').safeParse;
var sendJoin = require('./lib/swim/join-sender.js').joinCluster;
var adminLeaveHandler = require('./server/admin-leave-handler.js');
var adminJoinHandler = require('./server/admin-join-handler.js');

var HOST_PORT_PATTERN = /^(\d+.\d+.\d+.\d+):\d+$/;
var MAX_JOIN_DURATION = 300000;
Expand Down Expand Up @@ -192,18 +190,6 @@ RingPop.prototype.setupChannel = function setupChannel() {
createServer(this, this.channel);
};

RingPop.prototype.adminJoin = function adminJoin(callback) {
adminJoinHandler({
ringpop: this
}, callback);
};

RingPop.prototype.adminLeave = function adminLeave(callback) {
adminLeaveHandler({
ringpop: this
}, callback);
};

/*
* opts are:
* - bootstrapFile: File or array used to seed join process
Expand Down

0 comments on commit eb69f2c

Please sign in to comment.