1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
//! Represents cluster configuration.
use serde::{Deserialize, Serialize};
/// Represents config for a network.
#[derive(Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum NetworkConfig {
/// Represents constant bandwidth network, see [make_constant_network](dslab_dfs::network::make_constant_network).
Constant {
racks: usize,
hosts_per_rack: usize,
bandwidth: f64,
internal_bw: f64,
},
/// Represents shared bandwidth network, see [make_shared_network](dslab_dfs::network::make_shared_network).
Shared {
racks: usize,
hosts_per_rack: usize,
bandwidth: f64,
internal_bw: f64,
},
/// Represents tree network, see [make_tree_topology](dslab_dfs::network::make_tree_topology).
Tree {
star_count: usize,
hosts_per_star: usize,
downlink_bw: f64,
uplink_bw: f64,
internal_bw: f64,
},
/// Represents fat tree network, see [make_fat_tree_topology](dslab_dfs::network::make_fat_tree_topology).
FatTree {
l2_switch_count: usize,
l1_switch_count: usize,
hosts_per_switch: usize,
downlink_bw: f64,
uplink_bw: f64,
internal_bw: f64,
},
}
/// Represents one host.
#[derive(Clone, Serialize, Deserialize)]
pub struct HostConfig {
/// Host name or "default", see [SystemConfig::hosts] for more.
pub name: String,
/// Speed of a single core.
pub speed: f64,
/// Total space on a host.
pub available_space: u64,
/// Total number of cores on a host.
pub available_cores: u32,
/// Total memory on a host.
pub available_memory: u64,
}
/// Represents cluster.
#[derive(Clone, Serialize, Deserialize)]
pub struct SystemConfig {
/// Network of a cluster.
pub network: NetworkConfig,
/// Chunk size of [DFS](dslab_dfs::dfs::DistributedFileSystem).
pub chunk_size: u64,
/// Information about hosts.
///
/// Each host must be named in the format `host_{rack_id}_{host_id}` where both ids start from 0 and `host_id`
/// is independend on each rack. If there is a config with name "default" it will be used as config for all
/// unspecified hosts.
pub hosts: Vec<HostConfig>,
}