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'll admit, I was copy/pasting from another method here. :smiley: