refactor: delete duplicated logic and wrap DBLevel calls
Motivation
Wrap Exleveldb and :eleveldb calls into Db module to centralize logic, and refactor Db module to avoid duplicated code and decrease effort by adding leveldb functions.
Description
-
Refactor
Dbmodule, extracting repeated logic toperform/2function -
Replace
Exleveldband:eleveldbcalls by adding the functions toDbmodule -
TODO: Add all the features of
Exleveldbwith tests -
TODO: Implement macros if necessary
Closes #1191
Arkenan Sorry for the delay. There is no problem!
Only to confirm, is it okay to quit the Exleveldb calls iterator_close and iterator_move from BlobDB and KVSchema and use them wrapped in the DB module?
This should be the refactor in that case -> https://github.com/lambdaclass/lambda_ethereum_consensus/pull/1285/files
Hi @leobz thanks for the update! I really like the code. Marked it ready for review and run CI. It seems to be doing pretty well, but dialyzer (type analyzer) failed. You may debug that locally by running make dialyzer and seeing what's wrong. At a first glance, it seems that the typespec for the Db.iterator_move function is too restrictive or doesn't match the contract.
Thank you @Arkenan! Sorry for the delay, I wasn't available these weeks, but I'm going to fix it :raised_hands: