Skip to content

Change the `DecodeBlocks` command to not require `block_dir` anymore

Description

The DecodeBlocks command currently requires to be given the complete path to the directory where blocks are stored to decode the file. This was made before any structure was decided for file structure, ie putting everything inside ~/.share/dragoonfly in an organized structure.

It would be better to only have to give the file_hash instead of a complete path, since the complete path can be deduced from the file_hash, but the latter is much shorter to write.

Solution

When dealing with the DecodeBlocks command in dragoon_swarm, the block_dir can be deduced from the filename as self.file_dir/{filename}/blocks/.

Note

Changing this would also require changing:

  • decode-blocks inside dragoon.nu
  • tests/message_exchange_block_per_block.nu which was the first test written and puts the blocks inside /tmp/dragoon_test/received_blocks instead of using the current filesystem structure