Make state transfer atomic.

Create a temporary data directory and store intermediate result there,
after the transferring is done, rename this directory to data directory.

The naming of data directory is like : dataN where N is the id of the
directory.
Fixed bug of RollingLog when call sync() on empty log.
Merge pull request #200 from EasonLiao/atomic_transfering

Make state transfer atomic
Associate context with callbacks.

1. Add context object to method send, flush, remove, takeSnapshot.
2. Pass context object back to corresponding callbacks.
3. Add removed callback (corresponds to remove call).
4. Pass all the pending requests context back to user in recovering
callback to notify them the (possible)failed pending requests.