stellar_xdr/generated/
time_sliced_node_data.rs1#[allow(unused_imports, clippy::wildcard_imports)]
2use super::*;
3
4#[cfg_attr(feature = "alloc", derive(Default))]
29#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
30#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
31#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
32#[cfg_attr(
33 all(feature = "serde", feature = "alloc"),
34 serde_with::serde_as,
35 derive(serde::Serialize, serde::Deserialize),
36 serde(rename_all = "snake_case")
37)]
38#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
39pub struct TimeSlicedNodeData {
40 pub added_authenticated_peers: u32,
41 pub dropped_authenticated_peers: u32,
42 pub total_inbound_peer_count: u32,
43 pub total_outbound_peer_count: u32,
44 pub p75_scp_first_to_self_latency_ms: u32,
45 pub p75_scp_self_to_other_latency_ms: u32,
46 pub lost_sync_count: u32,
47 pub is_validator: bool,
48 pub max_inbound_peer_count: u32,
49 pub max_outbound_peer_count: u32,
50}
51
52impl ReadXdr for TimeSlicedNodeData {
53 #[cfg(feature = "std")]
54 fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
55 r.with_limited_depth(|r| {
56 Ok(Self {
57 added_authenticated_peers: u32::read_xdr(r)?,
58 dropped_authenticated_peers: u32::read_xdr(r)?,
59 total_inbound_peer_count: u32::read_xdr(r)?,
60 total_outbound_peer_count: u32::read_xdr(r)?,
61 p75_scp_first_to_self_latency_ms: u32::read_xdr(r)?,
62 p75_scp_self_to_other_latency_ms: u32::read_xdr(r)?,
63 lost_sync_count: u32::read_xdr(r)?,
64 is_validator: bool::read_xdr(r)?,
65 max_inbound_peer_count: u32::read_xdr(r)?,
66 max_outbound_peer_count: u32::read_xdr(r)?,
67 })
68 })
69 }
70}
71
72impl WriteXdr for TimeSlicedNodeData {
73 #[cfg(feature = "std")]
74 fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
75 w.with_limited_depth(|w| {
76 self.added_authenticated_peers.write_xdr(w)?;
77 self.dropped_authenticated_peers.write_xdr(w)?;
78 self.total_inbound_peer_count.write_xdr(w)?;
79 self.total_outbound_peer_count.write_xdr(w)?;
80 self.p75_scp_first_to_self_latency_ms.write_xdr(w)?;
81 self.p75_scp_self_to_other_latency_ms.write_xdr(w)?;
82 self.lost_sync_count.write_xdr(w)?;
83 self.is_validator.write_xdr(w)?;
84 self.max_inbound_peer_count.write_xdr(w)?;
85 self.max_outbound_peer_count.write_xdr(w)?;
86 Ok(())
87 })
88 }
89}