[suggestion] Kura inspector UX
Feature request
I believe that Kura inspector can be improved, because its current behavior is confusing:
$ ./target/debug/kura_inspector ./storage/ print
thread 'main' panicked at 'Index count is zero.
This could be because there are no blocks in the store: "./storage/"',
tools/kura_inspector/src/main.rs:70:5
$ ./target/debug/kura_inspector ./storage/blocks.index print
thread 'main' panicked at
'Failed to read index count from block store
{block_store_path:?}.: IO(Os { code: 20, kind: NotADirectory, message: "Not a directory" })',
tools/kura_inspector/src/main.rs:69:10
$ ./target/debug/kura_inspector ./storage/blocks.data print
thread 'main' panicked at
'Failed to read index count from block store
{block_store_path:?}.: IO(Os { code: 20, kind: NotADirectory, message: "Not a directory" })',
tools/kura_inspector/src/main.rs:69:10
Yesterday, while trying to find an answer to G. Bazior's question, I've copied the block data from Iroha 2, built Kura inspector and ran it with different options, supplying a path to a directory, a path to blocks.index and a path to blocks.data. None of the three worked. I assume path_to_block_store means it's a directory from the code, especially after seeing the impl StdFileBlockStore part, but not every user would look at it.
In my opinion, an ideal behavior would be to allow it to print the correct data in all three cases: if there are only two files, the path may be auto-corrected. It also needs to check data consistency and display a warning message when the file containing the blocks is damaged.
Also, "this could be because there are no blocks in the store" message is wrong. In my case, both files I copied from Docker were empty, so this wasn't detected. The user wants to know the contents, but "Kura inspector" both fails and leaves actual contents to guessing. If there are no blocks, the utility should explain that. If there are, but another error had happened, this needs to be explained as well.
Motivation
I'd like the Kura inspector to be a more convenient tool.