ScaleChain / scalechain

A customizable blockchain for altcoins.
236 stars 64 forks source link

Enable switching RocksDB and MapDB in a single line of code. #120

Closed Kangmo closed 7 years ago

Kangmo commented 7 years ago

What

Enable switching RocksDB and MapDB in a single line of code.

Why

Currently, source codes assume that we are using RocksDB. But we still support MapDB, which is written in pure java. For platforms such as leJos for lego mindstorms, the default maven package of RocksDB does not have dynamic libraries for ARM cpus, which is used by mindstorms.

How

Currently, many source codes use RocksDatabase type instead of KeyValueDatabase to create TransactingRocksDatabase, which requires to pass RocksDatabase. Do not hard code RocksDatabase in source codes except for the single line that chooses RocksDatabase. (It is in DatabaseFactory.create) Create a TransactingKeyValueDatabase which supports transaction commit/abort feature. KeyValueDatabase has a method called transacting, which returns a transacting version of it.

Kangmo commented 7 years ago

done