DocuSignDev/node-redis-sentinel-client — pull request #14 by yanatan16 (2014-04-20 07:38:53+00:00)
Title: More Features. Refactor.

I made some changes to improve things. I added one main feature (multiple sentinels monitoring multiple masters), did some simplification of the code, and completely refactored the tests.

- Now handles multiple sentinels monitoring multiple clusters. It does this by passing in a `sentinels: [[host1, port1],[host2,port2]]` option and rotating through that list when sentinels fail. It also filters messages that cause reconnections by testing for equality with `options.masterName`.
- Tests now start redis themselves and test authentication and pubsub through sentinel failures, manual failovers, and forced failovers through SIGTERMs. All tests are now in `test/test-full.js`
- Cleanup of codebase and reduction of options: debug, `master_auth_pass` can now be `options.auth_pass`
- Now uses visionmedia/debug instead of manual debugging
- add `.getSentinel()` and `.sentinel()` methods (latter is a `send_command`)
- Events were simplified to `sentinel (connect|connected|disconnected)` and `failover (start|end)` and `switch master`

#### Possible todo list:
- The tests are more thorough in some ways (like testing through different failure conditions) but still may be incomplete to test all configurations and other housekeeping.
- Ideally, we could also create slave connections from a SentinelClient
- Possible create multiple master connections (two for pub/sub for example) from a single cluster of sentinel connections.

Maybe along the lines of:
```
var masterCli1 = sentinelClient.masterFor('mymaster')
, masterCli2 = sentinelClient.masterFor('mymaster')
, slaveCli = sentinelClient.slaveFor('mymaster')
, masterOtherClusterCli = sentinelClient.masterFor('otherCluster')
```