Keeps a view of cluster state in Zookeeper. This includes the list of live servers and their ordering.
For simplicity, this is done using a directory with one file per server. We assume that the number of servers is relatively small (<100 or so) and changes very rare so that very simple approaches to updates such as having all nodes watch the state directory are feasible.
When each server starts, it will establish a local server id and will build a file in Zookeeper named according to that server id name. The contents of the file will include a description of the server that includes all of the addresses on which it might be reached.
The operations allowable on the state include
- asking when the last change was (for cache invalidation)
- asking whether we are connected
- asking which server an integer hash should be sent to
- asking for all of the connection details for all servers.
- asking for whether operations can proceed at all.