pub struct ChannelManager { /* private fields */ }Expand description
Manages EPICS Channel Access + pvAccess connections and dispatches archived samples to storage.
Implementations§
Source§impl ChannelManager
impl ChannelManager
pub async fn new( storage: Arc<dyn StoragePlugin>, registry: Arc<PvRegistry>, policy: Option<PolicyConfig>, ) -> Result<(Self, Receiver<PvSample>)>
Sourcepub async fn new_with_drift(
storage: Arc<dyn StoragePlugin>,
registry: Arc<PvRegistry>,
policy: Option<PolicyConfig>,
server_ioc_drift_secs: u64,
) -> Result<(Self, Receiver<PvSample>)>
pub async fn new_with_drift( storage: Arc<dyn StoragePlugin>, registry: Arc<PvRegistry>, policy: Option<PolicyConfig>, server_ioc_drift_secs: u64, ) -> Result<(Self, Receiver<PvSample>)>
Construct with an explicit IOC drift bound. Java parity (6538631):
keeps tests + sites that don’t surface EngineConfig on the
existing default while letting the daemon plumb a configured value.
Sourcepub async fn restore_from_registry(&self) -> Result<u64>
pub async fn restore_from_registry(&self) -> Result<u64>
Restore all active PVs from the registry (called on startup).
pvs_by_status(Active) already filters out alias rows (they carry
status='alias'), but we re-check alias_for.is_some() here so a
future schema change can’t silently re-introduce double-archiving
of the underlying IOC PV.
Sourcepub async fn archive_pv(
&self,
pv_name: &str,
sample_mode: &SampleMode,
protocol: Protocol,
) -> Result<()>
pub async fn archive_pv( &self, pv_name: &str, sample_mode: &SampleMode, protocol: Protocol, ) -> Result<()>
Start archiving a new PV.
Sourcepub async fn update_archive_fields(
&self,
pv_name: &str,
fields: &[String],
) -> Result<()>
pub async fn update_archive_fields( &self, pv_name: &str, fields: &[String], ) -> Result<()>
Replace the archive_fields list for a running PV. Cancels per-field monitor tasks for fields that left the set, spawns fresh ones for fields that joined, and leaves unchanged fields running. Serialised per-PV by an async mutex so concurrent callers can’t double-spawn. The main PV keeps running.
Sourcepub async fn resume_pv(&self, pv_name: &str) -> Result<()>
pub async fn resume_pv(&self, pv_name: &str) -> Result<()>
Resume a paused PV. Only paused or error PVs can be resumed; calling resume on an already-active PV is a no-op (returns Ok).
Sourcepub async fn stop_pv(&self, pv_name: &str) -> Result<()>
pub async fn stop_pv(&self, pv_name: &str) -> Result<()>
Stop archiving a PV without removing it from the registry. Sets the PV status to Inactive (data retained, monitoring stopped).
Sourcepub async fn destroy_pv(&self, pv_name: &str) -> Result<()>
pub async fn destroy_pv(&self, pv_name: &str) -> Result<()>
Remove a PV from archiving entirely.
Sourcepub fn matching_pvs(&self, pattern: &str) -> Vec<String>
pub fn matching_pvs(&self, pattern: &str) -> Vec<String>
Match PVs by glob pattern (from registry).
Sourcepub fn registry(&self) -> &Arc<PvRegistry>
pub fn registry(&self) -> &Arc<PvRegistry>
Get the registry reference.
Sourcepub fn get_connection_info(&self, pv: &str) -> Option<ConnectionInfo>
pub fn get_connection_info(&self, pv: &str) -> Option<ConnectionInfo>
Get connection info for a PV.
Sourcepub fn get_never_connected_pvs(&self) -> Vec<String>
pub fn get_never_connected_pvs(&self) -> Vec<String>
Get PV names that have never received any event (connected_since == None).
Sourcepub fn pv_counters(&self, pv_name: &str) -> Option<Arc<PvCounters>>
pub fn pv_counters(&self, pv_name: &str) -> Option<Arc<PvCounters>>
Snapshot the diagnostic counters for one PV. Returns None if the
PV isn’t actively archived. The returned Arc is the live counter
— callers read with Ordering::Relaxed.
Sourcepub fn all_pv_counters(&self) -> Vec<(String, PvCountersSnapshot)>
pub fn all_pv_counters(&self) -> Vec<(String, PvCountersSnapshot)>
Snapshot every active PV’s counters. Returns (pv_name, PvCountersSnapshot) so callers don’t have to handle Arc.
Sourcepub async fn live_value(
&self,
pv_name: &str,
timeout: Duration,
) -> Option<Result<ArchiverValue>>
pub async fn live_value( &self, pv_name: &str, timeout: Duration, ) -> Option<Result<ArchiverValue>>
One-shot CA get against the running channel for pv. Returns
None if the PV isn’t actively archived. The timeout caps how
long the caller will wait for a value when the IOC is slow.
Powers getEngineDataAction / getDataAtTimeEngine.
Sourcepub fn extras_snapshot(&self, pv_name: &str) -> HashMap<String, String>
pub fn extras_snapshot(&self, pv_name: &str) -> HashMap<String, String>
Snapshot the latest cached extra-field values for pv —
(field_name, stringified_value) pairs. Empty map when the PV
isn’t archived or has no archive_fields configured.
Sourcepub fn get_currently_disconnected_pvs(&self) -> Vec<String>
pub fn get_currently_disconnected_pvs(&self) -> Vec<String>
Get PV names that are currently disconnected (is_connected == false).