vocdoni-node
vocdoni-node copied to clipboard
feature: implement the db interface with goleveldb
Describe the feature
Implement the db
package interface using goleveldb (next to badger).
Motivation Compare badger with goleveldb.
Proposal
- [ ] Add a new package implementing the same interface badgerdb does, but using goleveldb.
- [ ] Add a flag
--dbBackend
for choosing among existing db implementations (badger and leveldb). - [ ] Make the flag set the packages
statedb/statedb.go
andtree/tree.go
to use the database selected
There's also https://github.com/etcd-io/bbolt, a port of LMDB, as opposed to goleveldb's LevelDB:
If you require a high random write throughput (>10,000 w/sec) or you need to use spinning disks then LevelDB could be a good choice. If your application is read-heavy or does a lot of range scans then Bolt could be a good choice.
Software-wise, I'd tend to prefer relying on etcd's bbolt, as etcd is a large project with enough people to test and maintain it. I think goleveldb has comparatively fewer resources.
@mvdan any updates about this issue ?
I'm currently focusing on replacing badgerhold, which I think is more urgent. Once we've removed badgerdb from the scrutinizer, then it will make more sense to stop relying on badger as a KV database elsewhere.
FYI, badger is removed from the db package now. The only "production" implementation we have now is with https://github.com/cockroachdb/pebble. It's worked well for over a year at this point, so I don't personally see a reason to stop using it or consider alternatives.