Skip to main content

ab_farmer/
lib.rs

1#![feature(
2    const_block_items,
3    exact_size_is_empty,
4    fmt_helpers_for_derive,
5    future_join,
6    iter_collect_into,
7    try_blocks
8)]
9#![warn(rust_2018_idioms, missing_debug_implementations, missing_docs)]
10
11//! `ab-farmer` is both a library and an app for everything related to farming.
12//!
13//! # Library
14//!
15//! Library exposes all the necessary utilities for plotting, maintaining and farming plots.
16//! Conceptually [`farm::Farm`] is an abstraction that contains a plot, a small piece cache and
17//! corresponding metadata. [`single_disk_farm::SingleDiskFarm`] is the primary abstraction that
18//! implements [`farm::Farm`] and encapsulates those components stored on local disk with high-level
19//! API with events that allow to orchestrate farms from the outside (for example in CLI).
20//!
21//! While local farming is one option, there is also a way to have cluster setup, implemented in
22//! [`cluster`] module. Cluster contains a special implementation of [`farm::Farm`] and other
23//! components that are not stored on local disk, but rather are somewhere on the network (typically
24//! LAN). This allows to better manage resources, which is primarily useful for large farmers.
25//! Cluster setup usually consists from heterogeneous machines where different machines are
26//! specialized with different tasks (some machines do farming, some plotting, some both, etc.).
27//! Cluster setup also allows for even greater composition and allows for combining various pieces
28//! of the software from different vendors (like unofficial plotters for example).
29//!
30//! Since various key components are implementations of traits, it is possible to use some part of
31//! the library as is (like farming), while swapping others (like plotting). The library is meant to
32//! be somewhat generic and allowing different composition scenarios.
33//!
34//! # CLI
35//!
36//! CLI provides reference implementation of the farmer software, it wraps library components and
37//! orchestrates them as a final user-facing application.
38//!
39//! CLI exposes many key options to fine tune various aspects, but primarily for experimentation and
40//! improving defaults, the goal is for default behavior to be already as optimal as efficient as
41//! possible.
42
43#[cfg(feature = "cluster")]
44pub mod cluster;
45pub mod disk_piece_cache;
46pub mod farm;
47pub mod farmer_cache;
48pub mod farmer_piece_getter;
49pub mod node_client;
50pub mod plotter;
51pub mod single_disk_farm;
52pub mod thread_pool_manager;
53pub mod utils;
54
55/// Size of the LRU cache for peers.
56pub const KNOWN_PEERS_CACHE_SIZE: u32 = 100;