walletdb: Refactor DatabaseBatch abstract class from BerkeleyBatch
Summary:
In order to support alternative database systems, we need to have a generic Batch class. This PR adds a DatabaseBatch abstract class which is implemented by BerkeleyBatch. DatabaseBatch is now the class that is used by WalletBatch to interact with the database. To be able to get the correct type of DatabaseBatch, BerkeleyDatabase now has a MakeBatch function which returns a newly constructed std::unique_ptr<DatabaseBatch>. For BerkeleyDatabase, that will be std::unique_ptr<BerkeleyBatch>.
The Read, Write, Erase, and Exists template functions are moved from BerkeleyBatch.
This is a backport of core#19325 [1/2]
https://github.com/bitcoin/bitcoin/pull/19325/commits/eac9200814fa01da6522625be01dded730b26751
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10002