Agnostic Database Implementation #1886
Replies: 1 comment 1 reply
-
Hi there, We are currently (actually: already for the last couple of months) preparing breaking releases on most of the libraries (including the MPT library) and releases are - relatively - imminent, within a couple of weeks (let's say 4-6 weeks roughly), so this would be a good time to do such kind of work. We are doing all breaking work towards the Be aware that there are already a lot of breaking changes merged, so the code on this branch deviates substantially from the In the Trie library breaking changes are limited though, one major thing is that options are now passed in as an options dictionary - as it is being done in the other libraries - which in doubt should make your life rather easier though. |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is already planned or was discussed but what's the status on an agnostic database implementation? Right now LevelDB is hardcoded through the
db.ts
file, so if you want to use something like https://github.com/DoctorEvidence/lmdb-js you will need to fork and modify that file.The least invasive approach would probably be to change https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/baseTrie.ts#L64 to
this.db = db ?? new DB()
and https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/trie/src/baseTrie.ts#L60 toconstructor(db?: DB | null, root?: Buffer, deleteFromDB: boolean = false) {
whereDB
would then become an interface. This is obviously a small breaking change but would allow the use of custom DB implementations.Are there any unique characteristics that make LMDB a requirement/best-in-class for how the package is designed or would you be open to a pull-request to make it agnostic and allow for swapping out through the trie constructor?
Example of an LMDB driver
Beta Was this translation helpful? Give feedback.
All reactions