Add proxy mode.

This commit is contained in:
Ben Johnson
2014-02-18 13:29:18 -07:00
parent 8485987b74
commit 1d961b8e56
13 changed files with 522 additions and 69 deletions

View File

@ -26,8 +26,13 @@ func (c *RemoveCommand) CommandName() string {
func (c *RemoveCommand) Apply(context raft.Context) (interface{}, error) {
ps, _ := context.Server().Context().(*PeerServer)
// If this is a proxy then remove it and exit.
if ps.registry.ProxyExists(c.Name) {
return []byte{0}, ps.registry.UnregisterProxy(c.Name)
}
// Remove node from the shared registry.
err := ps.registry.Unregister(c.Name)
err := ps.registry.UnregisterPeer(c.Name)
// Delete from stats
delete(ps.followersStats.Followers, c.Name)