-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1194 from subspace/improve-farmer-ux-cleanup
Improve farmer UX by printing useful details, improve logging format and other minor details
- Loading branch information
Showing
9 changed files
with
138 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod farm; | ||
mod info; | ||
mod shared; | ||
|
||
pub(crate) use farm::farm_multi_disk; | ||
pub(crate) use info::info; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
crates/subspace-farmer/src/bin/subspace-farmer/commands/shared.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use std::path::PathBuf; | ||
use subspace_farmer::single_disk_plot::{SingleDiskPlot, SingleDiskPlotSummary}; | ||
|
||
pub(crate) fn print_disk_farm_info(directory: PathBuf, disk_farm_index: usize) { | ||
println!("Single disk farm {disk_farm_index}:"); | ||
match SingleDiskPlot::collect_summary(directory) { | ||
SingleDiskPlotSummary::Found { info, directory } => { | ||
println!(" ID: {}", info.id()); | ||
println!(" Genesis hash: 0x{}", hex::encode(info.genesis_hash())); | ||
println!(" Public key: 0x{}", hex::encode(info.public_key())); | ||
println!(" First sector index: {}", info.first_sector_index()); | ||
println!( | ||
" Allocated space: {} ({})", | ||
bytesize::to_string(info.allocated_space(), true), | ||
bytesize::to_string(info.allocated_space(), false) | ||
); | ||
println!(" Directory: {}", directory.display()); | ||
} | ||
SingleDiskPlotSummary::NotFound { directory } => { | ||
println!(" Plot directory: {}", directory.display()); | ||
println!(" No farm found here yet"); | ||
} | ||
SingleDiskPlotSummary::Error { directory, error } => { | ||
println!(" Directory: {}", directory.display()); | ||
println!(" Failed to open farm info: {error}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.