1pub mod bee;
9pub mod behavioral;
10pub mod cache;
11pub mod heartbeat;
12pub mod node;
13
14pub use apiary_query::ApiaryQueryContext;
15pub use bee::{BeePool, BeeState, BeeStatus, MasonChamber};
16pub use behavioral::{
17 AbandonmentDecision, AbandonmentTracker, ColonyThermometer, TemperatureRegulation,
18};
19pub use cache::{CacheEntry, CellCache};
20pub use heartbeat::{
21 Heartbeat, HeartbeatWriter, NodeState, NodeStatus, WorldView, WorldViewBuilder,
22};
23pub use node::{ApiaryNode, ColonyStatus, SwarmNodeInfo, SwarmStatus};
24
25pub fn world_view_to_node_info(world_view: &WorldView) -> Vec<apiary_query::distributed::NodeInfo> {
27 world_view
28 .alive_nodes()
29 .iter()
30 .map(|node| {
31 let cached_cells = node.heartbeat.cache.cached_cells.clone();
38
39 apiary_query::distributed::NodeInfo {
40 node_id: node.node_id.clone(),
41 state: match node.state {
42 NodeState::Alive => apiary_query::distributed::NodeState::Alive,
43 NodeState::Suspect => apiary_query::distributed::NodeState::Suspect,
44 NodeState::Dead => apiary_query::distributed::NodeState::Dead,
45 },
46 cores: node.heartbeat.capacity.cores,
47 memory_bytes: node.heartbeat.capacity.memory_total_bytes,
48 memory_per_bee: node.heartbeat.capacity.memory_per_bee,
49 target_cell_size: node.heartbeat.capacity.target_cell_size,
50 bees_total: node.heartbeat.load.bees_total,
51 bees_busy: node.heartbeat.load.bees_busy,
52 idle_bees: node.heartbeat.load.bees_idle,
53 cached_cells,
54 }
55 })
56 .collect()
57}