pub trait Farm {
// Required methods
fn id(&self) -> &FarmId;
fn total_sectors_count(&self) -> SectorIndex;
fn plotted_sectors(&self) -> Arc<dyn PlottedSectors + 'static>;
fn piece_reader(&self) -> Arc<dyn PieceReader + 'static>;
fn on_sector_update(
&self,
callback: HandlerFn<(SectorIndex, SectorUpdate)>,
) -> Box<dyn HandlerId>;
fn on_farming_notification(
&self,
callback: HandlerFn<FarmingNotification>,
) -> Box<dyn HandlerId>;
fn on_solution(
&self,
callback: HandlerFn<SolutionResponse>,
) -> Box<dyn HandlerId>;
fn run(self: Box<Self>) -> Pin<Box<dyn Future<Output = Result<()>> + Send>>;
}
Expand description
Abstract farm implementation
Required Methods§
sourcefn total_sectors_count(&self) -> SectorIndex
fn total_sectors_count(&self) -> SectorIndex
Number of sectors in this farm
sourcefn plotted_sectors(&self) -> Arc<dyn PlottedSectors + 'static>
fn plotted_sectors(&self) -> Arc<dyn PlottedSectors + 'static>
Get plotted sectors instance
sourcefn piece_reader(&self) -> Arc<dyn PieceReader + 'static>
fn piece_reader(&self) -> Arc<dyn PieceReader + 'static>
Get piece reader to read plotted pieces later
sourcefn on_sector_update(
&self,
callback: HandlerFn<(SectorIndex, SectorUpdate)>,
) -> Box<dyn HandlerId>
fn on_sector_update( &self, callback: HandlerFn<(SectorIndex, SectorUpdate)>, ) -> Box<dyn HandlerId>
Subscribe to sector updates
sourcefn on_farming_notification(
&self,
callback: HandlerFn<FarmingNotification>,
) -> Box<dyn HandlerId>
fn on_farming_notification( &self, callback: HandlerFn<FarmingNotification>, ) -> Box<dyn HandlerId>
Subscribe to farming notifications
sourcefn on_solution(
&self,
callback: HandlerFn<SolutionResponse>,
) -> Box<dyn HandlerId>
fn on_solution( &self, callback: HandlerFn<SolutionResponse>, ) -> Box<dyn HandlerId>
Subscribe to new solution notification