go-ethereum/triedb
Arran Schlosberg ab86490b3c
refactor: abstract unsupported-method checks out of triedb.Database
Previously, `triedb.Database` would type-assert between hash- and path-based implementations to check for method support. This had two downsides:

1. The repeated type checks were noisy and reduced code clarity; and
2. It was impossible to experiment with different implementations as method support was conditioned on an explicit concrete type.

By moving the methods onto the `backend` interface type, each concrete implementation now declares its own lack of support.

This cleans up the `triedb.Database` method implementations and consigns "chore" code into the `{hash,path}db/unsupported.go` files to be conveniently ignored :). Although not in scope for this PR, these changes allow the `backend` to be embedded in `triedb.Database` to further remove repeated code by exporting `type Backend interface` and entirely removing individual methods.
2024-10-11 15:52:40 +01:00
..
database trie: relocate state execution logic into pathdb package (#29861) 2024-06-27 20:30:39 +08:00
hashdb refactor: abstract unsupported-method checks out of triedb.Database 2024-10-11 15:52:40 +01:00
pathdb refactor: abstract unsupported-method checks out of triedb.Database 2024-10-11 15:52:40 +01:00
database.go refactor: abstract unsupported-method checks out of triedb.Database 2024-10-11 15:52:40 +01:00
history.go refactor: abstract unsupported-method checks out of triedb.Database 2024-10-11 15:52:40 +01:00
preimages.go all: remove the dependency from trie to triedb (#28824) 2024-02-13 14:49:53 +01:00