From a76ebe8cdabd10e68693f64936edbc29d9392ab0 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Wed, 8 May 2024 21:13:21 +0300 Subject: [PATCH] Remove node client re-exports --- .../src/bin/subspace-farmer/commands/farm.rs | 6 ++++-- .../src/bin/subspace-farmer/commands/shared/network.rs | 5 +++-- crates/subspace-farmer/src/farmer_cache/tests.rs | 3 +-- crates/subspace-farmer/src/lib.rs | 8 +++----- crates/subspace-farmer/src/node_client.rs | 2 +- crates/subspace-farmer/src/single_disk_farm/plotting.rs | 8 ++++---- crates/subspace-farmer/src/utils/farmer_piece_getter.rs | 2 +- crates/subspace-farmer/src/utils/piece_validator.rs | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs b/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs index 674654bb04..e5409fa800 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs @@ -26,6 +26,8 @@ use subspace_farmer::farm::{ Farm, FarmingNotification, SectorExpirationDetails, SectorPlottingDetails, SectorUpdate, }; use subspace_farmer::farmer_cache::FarmerCache; +use subspace_farmer::node_client::node_rpc_client::NodeRpcClient; +use subspace_farmer::node_client::NodeClient; use subspace_farmer::plotter::cpu::CpuPlotter; use subspace_farmer::single_disk_farm::{ SingleDiskFarm, SingleDiskFarmError, SingleDiskFarmOptions, @@ -39,7 +41,7 @@ use subspace_farmer::utils::{ recommended_number_of_farming_threads, run_future_in_dedicated_thread, thread_pool_core_indices, AsyncJoinOnDrop, }; -use subspace_farmer::{Identity, NodeClient, NodeRpcClient}; +use subspace_farmer::Identity; use subspace_farmer_components::plotting::PlottedSector; use subspace_metrics::{start_prometheus_metrics_server, RegistryAdapter}; use subspace_networking::utils::piece_provider::PieceProvider; @@ -73,7 +75,7 @@ pub(crate) struct FarmingArgs { /// /// `size` is max allocated size in human-readable format (e.g. 10GB, 2TiB) or just bytes that /// farmer will make sure to not exceed (and will pre-allocated all the space on startup to - /// ensure it will not run out of space in runtime). Also optionally `record-chunks-mode` can be + /// ensure it will not run out of space in runtime). Optionally, `record-chunks-mode` can be /// set to `ConcurrentChunks` or `WholeSector` in order to avoid internal benchmarking during /// startup. disk_farms: Vec, diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs b/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs index 1502d893dd..265c7c0a51 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/commands/shared/network.rs @@ -8,9 +8,10 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use std::path::Path; use std::sync::{Arc, Weak}; use subspace_farmer::farmer_cache::FarmerCache; -use subspace_farmer::node_client::NodeClientExt; +use subspace_farmer::node_client::node_rpc_client::NodeRpcClient; +use subspace_farmer::node_client::{NodeClient, NodeClientExt}; use subspace_farmer::utils::plotted_pieces::PlottedPieces; -use subspace_farmer::{NodeClient, NodeRpcClient, KNOWN_PEERS_CACHE_SIZE}; +use subspace_farmer::KNOWN_PEERS_CACHE_SIZE; use subspace_networking::libp2p::identity::Keypair; use subspace_networking::libp2p::kad::RecordKey; use subspace_networking::libp2p::multiaddr::Protocol; diff --git a/crates/subspace-farmer/src/farmer_cache/tests.rs b/crates/subspace-farmer/src/farmer_cache/tests.rs index 667f398763..320fd734f5 100644 --- a/crates/subspace-farmer/src/farmer_cache/tests.rs +++ b/crates/subspace-farmer/src/farmer_cache/tests.rs @@ -1,7 +1,6 @@ use crate::farmer_cache::FarmerCache; -use crate::node_client::Error; +use crate::node_client::{Error, NodeClient}; use crate::piece_cache::PieceCache; -use crate::NodeClient; use async_trait::async_trait; use futures::channel::{mpsc, oneshot}; use futures::{SinkExt, Stream, StreamExt}; diff --git a/crates/subspace-farmer/src/lib.rs b/crates/subspace-farmer/src/lib.rs index 5197f43bf7..f6da817ec7 100644 --- a/crates/subspace-farmer/src/lib.rs +++ b/crates/subspace-farmer/src/lib.rs @@ -52,11 +52,9 @@ pub mod single_disk_farm; pub mod thread_pool_manager; pub mod utils; -/// Size of the LRU cache for peers. -pub const KNOWN_PEERS_CACHE_SIZE: NonZeroUsize = NonZeroUsize::new(100).expect("Not zero; qed"); - pub use identity::Identity; pub use jsonrpsee; -pub use node_client::node_rpc_client::NodeRpcClient; -pub use node_client::{Error as RpcClientError, NodeClient}; use std::num::NonZeroUsize; + +/// Size of the LRU cache for peers. +pub const KNOWN_PEERS_CACHE_SIZE: NonZeroUsize = NonZeroUsize::new(100).expect("Not zero; qed"); diff --git a/crates/subspace-farmer/src/node_client.rs b/crates/subspace-farmer/src/node_client.rs index 1a96f12da0..07cb3cb6ce 100644 --- a/crates/subspace-farmer/src/node_client.rs +++ b/crates/subspace-farmer/src/node_client.rs @@ -1,4 +1,4 @@ -pub(crate) mod node_rpc_client; +pub mod node_rpc_client; use async_trait::async_trait; use futures::Stream; diff --git a/crates/subspace-farmer/src/single_disk_farm/plotting.rs b/crates/subspace-farmer/src/single_disk_farm/plotting.rs index 0ee1cce5f5..e09415f87a 100644 --- a/crates/subspace-farmer/src/single_disk_farm/plotting.rs +++ b/crates/subspace-farmer/src/single_disk_farm/plotting.rs @@ -1,11 +1,11 @@ use crate::farm::{SectorExpirationDetails, SectorPlottingDetails, SectorUpdate}; +use crate::node_client::{Error as NodeClientError, NodeClient}; use crate::plotter::{Plotter, SectorPlottingProgress}; #[cfg(windows)] use crate::single_disk_farm::unbuffered_io_file_windows::UnbufferedIoFileWindows; use crate::single_disk_farm::{ BackgroundTaskError, Handlers, PlotMetadataHeader, RESERVED_PLOT_METADATA, }; -use crate::{node_client, NodeClient}; use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock}; use futures::channel::{mpsc, oneshot}; use futures::stream::FuturesOrdered; @@ -53,13 +53,13 @@ pub enum PlottingError { #[error("Failed to retrieve farmer info: {error}")] FailedToGetFarmerInfo { /// Lower-level error - error: node_client::Error, + error: NodeClientError, }, /// Failed to get segment header #[error("Failed to get segment header: {error}")] FailedToGetSegmentHeader { /// Lower-level error - error: node_client::Error, + error: NodeClientError, }, /// Missing archived segment header #[error("Missing archived segment header: {segment_index}")] @@ -71,7 +71,7 @@ pub enum PlottingError { #[error("Failed to subscribe to archived segments: {error}")] FailedToSubscribeArchivedSegments { /// Lower-level error - error: node_client::Error, + error: NodeClientError, }, /// Low-level plotting error #[error("Low-level plotting error: {0}")] diff --git a/crates/subspace-farmer/src/utils/farmer_piece_getter.rs b/crates/subspace-farmer/src/utils/farmer_piece_getter.rs index 210189458a..ef424140f6 100644 --- a/crates/subspace-farmer/src/utils/farmer_piece_getter.rs +++ b/crates/subspace-farmer/src/utils/farmer_piece_getter.rs @@ -1,6 +1,6 @@ use crate::farmer_cache::FarmerCache; +use crate::node_client::NodeClient; use crate::utils::plotted_pieces::PlottedPieces; -use crate::NodeClient; use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock}; use async_trait::async_trait; use backoff::backoff::Backoff; diff --git a/crates/subspace-farmer/src/utils/piece_validator.rs b/crates/subspace-farmer/src/utils/piece_validator.rs index 4c6657caec..2e93b2e296 100644 --- a/crates/subspace-farmer/src/utils/piece_validator.rs +++ b/crates/subspace-farmer/src/utils/piece_validator.rs @@ -1,4 +1,4 @@ -use crate::NodeClient; +use crate::node_client::NodeClient; use async_trait::async_trait; use subspace_archiving::archiver::is_piece_valid; use subspace_core_primitives::crypto::kzg::Kzg;