Skip to content

Commit

Permalink
Merge pull request #60 from nazar-pc/import-upstream-locking-fix
Browse files Browse the repository at this point in the history
Import locking fix from upstream
  • Loading branch information
nazar-pc authored Dec 20, 2023
2 parents 0a80f99 + 3cf254c commit e141fd8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "space-acres"
description = "Space Acres is an opinionated unofficial GUI application for farming on Subspace Network"
license = "0BSD"
version = "0.0.10"
version = "0.0.11"
authors = ["Nazar Mokrynskyi <nazar@mokrynskyi.com>"]
repository = "https://github.com/nazar-pc/space-acres"
edition = "2021"
Expand Down
39 changes: 12 additions & 27 deletions src/backend/farmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use subspace_core_primitives::{PublicKey, Record, SectorIndex};
use subspace_erasure_coding::ErasureCoding;
use subspace_farmer::piece_cache::{CacheWorker, PieceCache};
use subspace_farmer::single_disk_farm::{
SingleDiskFarm, SingleDiskFarmError, SingleDiskFarmOptions, SingleDiskFarmSummary,
SingleDiskFarm, SingleDiskFarmError, SingleDiskFarmOptions,
};
use subspace_farmer::utils::farmer_piece_getter::FarmerPieceGetter;
use subspace_farmer::utils::piece_validator::SegmentCommitmentPieceValidator;
Expand Down Expand Up @@ -300,7 +300,17 @@ pub(super) async fn create_farmer(farmer_options: FarmerOptions) -> anyhow::Resu
}
};

print_disk_farm_info(disk_farm.directory, disk_farm_index);
let info = single_disk_farm.info();
println!("Single disk farm {disk_farm_index}:");
println!(" ID: {}", info.id());
println!(" Genesis hash: 0x{}", hex::encode(info.genesis_hash()));
println!(" Public key: 0x{}", hex::encode(info.public_key()));
println!(
" Allocated space: {} ({})",
bytesize::to_string(info.allocated_space(), true),
bytesize::to_string(info.allocated_space(), false)
);
println!(" Directory: {}", disk_farm.directory.display());

single_disk_farms.push(single_disk_farm);
}
Expand Down Expand Up @@ -506,28 +516,3 @@ pub(super) async fn create_farmer(farmer_options: FarmerOptions) -> anyhow::Resu
handlers,
})
}

fn print_disk_farm_info(directory: PathBuf, disk_farm_index: usize) {
println!("Single disk farm {disk_farm_index}:");
match SingleDiskFarm::collect_summary(directory) {
SingleDiskFarmSummary::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!(
" Allocated space: {} ({})",
bytesize::to_string(info.allocated_space(), true),
bytesize::to_string(info.allocated_space(), false)
);
println!(" Directory: {}", directory.display());
}
SingleDiskFarmSummary::NotFound { directory } => {
println!(" Plot directory: {}", directory.display());
println!(" No farm found here yet");
}
SingleDiskFarmSummary::Error { directory, error } => {
println!(" Directory: {}", directory.display());
println!(" Failed to open farm info: {error}");
}
}
}

0 comments on commit e141fd8

Please sign in to comment.