Add a method to get the tree size of the local database.

This is to be able to resume from a partially replicated database after a restart.
How will this play with the multi-source following code later on ?
e.g. it's not hard to imagine a situation where the entries come back from other logs in a non-contiguous fashion and so the tree in the local DB is potentially sparse above latest_sth.tree_size()