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.
I kept it like the others here, in my rebased version of your tree, I update it to use ```override``` in the same commit. :wink: