mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
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.
|
||
|---|---|---|
| .. | ||
| database | ||
| hashdb | ||
| pathdb | ||
| database.go | ||
| history.go | ||
| preimages.go | ||