subspace_farmer/
node_client.rspub mod caching_proxy_node_client;
pub mod rpc_node_client;
use async_trait::async_trait;
use futures::Stream;
use std::fmt;
use std::pin::Pin;
use subspace_core_primitives::pieces::{Piece, PieceIndex};
use subspace_core_primitives::segments::{SegmentHeader, SegmentIndex};
use subspace_rpc_primitives::{
FarmerAppInfo, RewardSignatureResponse, RewardSigningInfo, SlotInfo, SolutionResponse,
};
#[async_trait]
pub trait NodeClient: fmt::Debug + Send + Sync + 'static {
async fn farmer_app_info(&self) -> anyhow::Result<FarmerAppInfo>;
async fn subscribe_slot_info(
&self,
) -> anyhow::Result<Pin<Box<dyn Stream<Item = SlotInfo> + Send + 'static>>>;
async fn submit_solution_response(
&self,
solution_response: SolutionResponse,
) -> anyhow::Result<()>;
async fn subscribe_reward_signing(
&self,
) -> anyhow::Result<Pin<Box<dyn Stream<Item = RewardSigningInfo> + Send + 'static>>>;
async fn submit_reward_signature(
&self,
reward_signature: RewardSignatureResponse,
) -> anyhow::Result<()>;
async fn subscribe_archived_segment_headers(
&self,
) -> anyhow::Result<Pin<Box<dyn Stream<Item = SegmentHeader> + Send + 'static>>>;
async fn segment_headers(
&self,
segment_indices: Vec<SegmentIndex>,
) -> anyhow::Result<Vec<Option<SegmentHeader>>>;
async fn piece(&self, piece_index: PieceIndex) -> anyhow::Result<Option<Piece>>;
async fn acknowledge_archived_segment_header(
&self,
segment_index: SegmentIndex,
) -> anyhow::Result<()>;
}
#[async_trait]
pub trait NodeClientExt: NodeClient {
async fn last_segment_headers(&self, limit: u32) -> anyhow::Result<Vec<Option<SegmentHeader>>>;
}