Skip to content

Commit

Permalink
Remove node client re-exports
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed May 8, 2024
1 parent a2206ad commit a76ebe8
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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<DiskFarm>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions crates/subspace-farmer/src/farmer_cache/tests.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
8 changes: 3 additions & 5 deletions crates/subspace-farmer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
2 changes: 1 addition & 1 deletion crates/subspace-farmer/src/node_client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub(crate) mod node_rpc_client;
pub mod node_rpc_client;

use async_trait::async_trait;
use futures::Stream;
Expand Down
8 changes: 4 additions & 4 deletions crates/subspace-farmer/src/single_disk_farm/plotting.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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}")]
Expand All @@ -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}")]
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer/src/utils/farmer_piece_getter.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer/src/utils/piece_validator.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit a76ebe8

Please sign in to comment.