Generic atomic update code

Couldn't resist doing a little cleanup before writing a test.
Was trying to avoid forcing people to do a type assertion, but on second thought, passing it in would allow one to use a non-closure as an EtcdUpdateFunc, so I guess I'll change it.