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