etcdserver: refactor a bit