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
use std::{collections::HashMap, hash::Hash, net::SocketAddr};
use serde::Serialize;
use crate::{components::chainspec_loader::ChainspecInfo, types::Block};
#[derive(Debug, Serialize)]
#[serde(bound = "I: Eq + Hash + Serialize")]
pub struct StatusFeed<I> {
pub last_added_block: Option<Block>,
pub peers: HashMap<I, SocketAddr>,
pub chainspec_info: ChainspecInfo,
pub version: &'static str,
}
impl<I> StatusFeed<I> {
pub(crate) fn new(
last_added_block: Option<Block>,
peers: HashMap<I, SocketAddr>,
chainspec_info: ChainspecInfo,
) -> Self {
StatusFeed {
last_added_block,
peers,
chainspec_info,
version: crate::VERSION_STRING.as_str(),
}
}
}