Skip to main content

PvaStateTracker

Struct PvaStateTracker 

Source
pub struct PvaStateTracker {
    pub stats: PvaStateStats,
    /* private fields */
}
Expand description

Global PVA state tracker across all connections

Fields§

§stats: PvaStateStats

Statistics

Implementations§

Source§

impl PvaStateTracker

Source

pub fn new(config: PvaStateConfig) -> Self

Source

pub fn with_defaults() -> Self

Source

pub fn get_connection(&self, key: &ConnectionKey) -> Option<&ConnectionState>

Get connection state (read-only)

Source

pub fn get_pv_name_by_sid( &self, conn_key: &ConnectionKey, sid: u32, ) -> Option<String>

Get PV name by SID for a connection

Source

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

Source

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

Source

pub fn on_destroy_channel( &mut self, conn_key: &ConnectionKey, cid: u32, sid: u32, )

Handle DESTROY_CHANNEL (cmd=8)

Source

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

Source

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

Source

pub fn on_op_destroy(&mut self, conn_key: &ConnectionKey, ioid: u32)

Handle operation DESTROY (subcmd & 0x10)

Source

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.

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.

Source

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.

Source

pub fn count_direction(&mut self, is_server: bool)

Count a PVA message direction (for messages not routed through on_message)

Source

pub fn on_message( &mut self, conn_key: &ConnectionKey, sid: u32, ioid: u32, request_type: &str, message: String, is_server: bool, )

Source

pub fn resolve_pv_name( &self, conn_key: &ConnectionKey, sid: u32, ioid: u32, ) -> Option<String>

Resolve PV name for a MONITOR/GET/PUT packet

Source

pub fn active_channel_count(&self) -> usize

Get the number of active tracked channels

Source

pub fn active_connection_count(&self) -> usize

Get the number of active tracked connections

Source

pub fn is_connection_mid_stream(&self, conn_key: &ConnectionKey) -> bool

Check if a connection is mid-stream (incomplete channel state)

Source

pub fn get_operation( &self, conn_key: &ConnectionKey, ioid: u32, ) -> Option<&OperationState>

Get operation state for decoding values

Source

pub fn cleanup_expired(&mut self)

Periodic cleanup of expired entries

Source

pub fn summary(&self) -> String

Get summary statistics

Source

pub fn channel_count(&self) -> usize

Get current channel count

Source

pub fn connection_count(&self) -> usize

Get current connection count

Source

pub fn connection_snapshots(&self) -> Vec<ConnectionSnapshot>

Source

pub fn channel_snapshots(&self) -> Vec<ChannelSnapshot>

Trait Implementations§

Source§

impl Debug for PvaStateTracker

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more