pub struct PvaStateTracker {
pub stats: PvaStateStats,
/* private fields */
}Expand description
Global PVA state tracker across all connections
Fields§
§stats: PvaStateStatsStatistics
Implementations§
Source§impl PvaStateTracker
impl PvaStateTracker
pub fn new(config: PvaStateConfig) -> Self
pub fn with_defaults() -> Self
Sourcepub fn get_connection(&self, key: &ConnectionKey) -> Option<&ConnectionState>
pub fn get_connection(&self, key: &ConnectionKey) -> Option<&ConnectionState>
Get connection state (read-only)
Sourcepub fn get_pv_name_by_sid(
&self,
conn_key: &ConnectionKey,
sid: u32,
) -> Option<String>
pub fn get_pv_name_by_sid( &self, conn_key: &ConnectionKey, sid: u32, ) -> Option<String>
Get PV name by SID for a connection
Sourcepub fn on_create_channel_request(
&mut self,
conn_key: &ConnectionKey,
cid: u32,
pv_name: String,
)
pub fn on_create_channel_request( &mut self, conn_key: &ConnectionKey, cid: u32, pv_name: String, )
Handle CREATE_CHANNEL request (client → server) Called when we see cmd=7 from client with CID and PV name
Sourcepub fn on_create_channel_response(
&mut self,
conn_key: &ConnectionKey,
cid: u32,
sid: u32,
)
pub fn on_create_channel_response( &mut self, conn_key: &ConnectionKey, cid: u32, sid: u32, )
Handle CREATE_CHANNEL response (server → client) Called when we see cmd=7 from server with CID and SID
Sourcepub fn on_destroy_channel(
&mut self,
conn_key: &ConnectionKey,
cid: u32,
sid: u32,
)
pub fn on_destroy_channel( &mut self, conn_key: &ConnectionKey, cid: u32, sid: u32, )
Handle DESTROY_CHANNEL (cmd=8)
Sourcepub fn on_op_init_request(
&mut self,
conn_key: &ConnectionKey,
sid: u32,
ioid: u32,
command: u8,
)
pub fn on_op_init_request( &mut self, conn_key: &ConnectionKey, sid: u32, ioid: u32, command: u8, )
Handle operation INIT request (client → server) subcmd & 0x08 indicates INIT
Sourcepub fn on_op_init_response(
&mut self,
conn_key: &ConnectionKey,
ioid: u32,
field_desc: Option<StructureDesc>,
)
pub fn on_op_init_response( &mut self, conn_key: &ConnectionKey, ioid: u32, field_desc: Option<StructureDesc>, )
Handle operation INIT response (server → client) Contains type introspection data
Sourcepub fn on_op_destroy(&mut self, conn_key: &ConnectionKey, ioid: u32)
pub fn on_op_destroy(&mut self, conn_key: &ConnectionKey, ioid: u32)
Handle operation DESTROY (subcmd & 0x10)
Sourcepub fn on_op_activity(
&mut self,
conn_key: &ConnectionKey,
sid: u32,
ioid: u32,
command: u8,
)
pub fn on_op_activity( &mut self, conn_key: &ConnectionKey, sid: u32, ioid: u32, command: u8, )
Touch connection, operation, and channel activity for any op message (data updates, etc.) If the IOID is unknown (mid-stream join), auto-creates a placeholder operation so the connection appears on the Connections page.
Sourcepub fn on_search(
&mut self,
pv_requests: &[(u32, String)],
source_ip: Option<IpAddr>,
)
pub fn on_search( &mut self, pv_requests: &[(u32, String)], source_ip: Option<IpAddr>, )
Cache PV name mappings from SEARCH messages (CID → PV name)
These serve as fallback when the client’s CREATE_CHANNEL request is missed.
Also retroactively resolves any existing <unknown:cid=N> channels and
placeholder operations that match the CIDs in this SEARCH.
source_ip is the IP of the client that sent the SEARCH request.
Sourcepub fn resolve_search_cids(
&mut self,
cids: &[u32],
peer_ip: Option<IpAddr>,
) -> Vec<(u32, String)>
pub fn resolve_search_cids( &mut self, cids: &[u32], peer_ip: Option<IpAddr>, ) -> Vec<(u32, String)>
Resolve PV names from SEARCH_RESPONSE CIDs using the search cache.
Returns a list of (CID, resolved_pv_name) pairs for all CIDs that could be resolved.
source_ip is optionally the IP of the server that sent the response;
we try scoped lookups using peer IPs, then fall back to flat cache.
Sourcepub fn count_direction(&mut self, is_server: bool)
pub fn count_direction(&mut self, is_server: bool)
Count a PVA message direction (for messages not routed through on_message)
pub fn on_message( &mut self, conn_key: &ConnectionKey, sid: u32, ioid: u32, request_type: &str, message: String, is_server: bool, )
Sourcepub fn resolve_pv_name(
&self,
conn_key: &ConnectionKey,
sid: u32,
ioid: u32,
) -> Option<String>
pub fn resolve_pv_name( &self, conn_key: &ConnectionKey, sid: u32, ioid: u32, ) -> Option<String>
Resolve PV name for a MONITOR/GET/PUT packet
Sourcepub fn active_channel_count(&self) -> usize
pub fn active_channel_count(&self) -> usize
Get the number of active tracked channels
Sourcepub fn active_connection_count(&self) -> usize
pub fn active_connection_count(&self) -> usize
Get the number of active tracked connections
Sourcepub fn is_connection_mid_stream(&self, conn_key: &ConnectionKey) -> bool
pub fn is_connection_mid_stream(&self, conn_key: &ConnectionKey) -> bool
Check if a connection is mid-stream (incomplete channel state)
Sourcepub fn get_operation(
&self,
conn_key: &ConnectionKey,
ioid: u32,
) -> Option<&OperationState>
pub fn get_operation( &self, conn_key: &ConnectionKey, ioid: u32, ) -> Option<&OperationState>
Get operation state for decoding values
Sourcepub fn cleanup_expired(&mut self)
pub fn cleanup_expired(&mut self)
Periodic cleanup of expired entries
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Get current channel count
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Get current connection count