Skip to main content

spvirit_server/
state.rs

1use std::collections::HashMap;
2
3use spvirit_codec::spvd_decode::StructureDesc;
4use spvirit_types::NtPayload;
5
6#[derive(Debug, Default)]
7pub struct ConnState {
8    pub cid_to_sid: HashMap<u32, u32>,
9    pub sid_to_pv: HashMap<u32, String>,
10    pub ioid_to_desc: HashMap<u32, StructureDesc>,
11    pub ioid_to_pv: HashMap<u32, String>,
12    pub ioid_to_monitor: HashMap<u32, MonitorState>,
13}
14
15#[derive(Debug, Clone)]
16pub struct MonitorSub {
17    pub conn_id: u64,
18    pub ioid: u32,
19    pub version: u8,
20    pub is_be: bool,
21    pub running: bool,
22    pub pipeline_enabled: bool,
23    pub nfree: u32,
24    /// When set, only encode these fields in monitor data responses.
25    pub filtered_desc: Option<StructureDesc>,
26    /// Last payload sent to this subscriber. Used to produce sparse deltas on
27    /// subsequent updates (see `spvirit-server/src/monitor.rs`). `None` means
28    /// the next update is the initial full snapshot.
29    pub last_snapshot: Option<NtPayload>,
30}
31
32#[derive(Debug, Clone, Copy)]
33pub struct MonitorState {
34    pub running: bool,
35    pub pipeline_enabled: bool,
36    pub nfree: u32,
37}