Bunch of changes related to block log
Related: hive!731 (merged), haf!179 (merged)
Changes:
- Block log index was replaced with block log artifacts.
- No more following warnings at CI: UserWarning: Block log with following path is missing: InitNode0/blockchain/block_log.index.
- Block log artifacts during replay are treated as
optional.- Previously if were missing, warning was generated, and flag
include_artifacts=Falsehad to be used. - Now artifacts are used if provided. If are missing, then everything is OK. Replay is performed without them.
- Previously if were missing, warning was generated, and flag
-
BlockLog.copy_tonow returns copied block log object. - During copying block log, artifacts can be treated as
required,optionalorexcluded.- Are
excludedby default, to simplify use case, where user generates block log for tests and copy it to predefined location. - Removed specifying how artifacts are treated during copying from block log's initializer (because it's unneeded, way of copying artifacts is specified during copying with
BlockLog.copy_toartifactsparameter). - Valid values of
artifactsparameter are suggested with type annotations and enforced in runtime.
- Are
- Following members are now
@properties:- Block log can be get from node with syntax
node.block_log(previously wasnode.get_block_log()). - Path of block log can be get with syntax
block_log.path(previously wasblock_log.get_path()). - So now, to get path of node's block log syntax was simplified from
node.get_block_log().get_path()tonode.block_log.path.
- Block log can be get from node with syntax
- Fix bug, which caused error when node was replayed from renamed block log.
- Fix bug, which caused that name of requested output block log was ignored during block log truncation (in
BlockLog.truncatemethod). - Add documentation of
BlockLog.truncatemethod. - Add block log artifacts path getter (with
@property, consistently with path of block log). - Prevent copying block log files partially when error occurs (previously artifacts could be copied, when block log was missing).
Minor changes:
- "Block log" (instead of "blocklog", as single word) is consistenly written in whole project.
- Member variable
__ownerwas removed fromBlockLog.- So
ownerdo not have to be passed in initializer. It simplifies block log creation (fromBlockLog(None, path)toBlockLog(path)).
- So
- Fixed error message for missing artifacts in given path (previous error message was about block log, not artifacts).
- Add type annotations for path parameters (
Union[Path, str]). - Minor refactors:
- Method
Snapshot.copy_towas simplified with helper method__copy_file. - Remove unneeded local variable
block_log_artifacts_file_name.
- Method
Please review: @kmochocki @mzebrak
Edited by Mateusz Żebrak