Work on persistent state and some code reorganisation.

- Fixed invalid memory access when removing servers from ServerGroup.
- Added methods for writing persistent state atomically and
for getting consistent persistent state file paths.
- Split out methods related to persistent state into separate
module in core/ directory.
- Split out tests into separate file.
- Added methods for generating an initial server state snapshot
to allow testing systems composed of multiple machines before
implementing key space redistribution.
- Added helper script to launch full blown system.
- Used macros to cut down on amount of copy pasted code.
- Made ServerHost write_to_fd method virtual to allow subclasses
to correctly serialise their contents.