iavl
iavl copied to clipboard
Consider dropping error result from ImmutableTree.Export
ImmutableTree.Export
could be simplified to return no error.
Currently, it has two error cases:
https://github.com/cosmos/iavl/blob/64ffc2749400f762d6279db0fd1ccc2b22e69492/export.go#L41-L47
The first case, tree == nil
, can be handled by (1) declaring the case a programmer error and accepting the panic or (2) by returning an *Exporter
whose Next
returns ErrorExportDone
immediately.
The second case, tree.ndb == nil
, signifies an in-memory database which doesn't warrant an error. Why not skip the call to tree.ndb.incrVersionReaders
and proceed with the export?
CC @odeke-em