pub struct AsyncDbHandle { /* private fields */ }Expand description
A cycle-free handle for driving async-side database updates from
OUTSIDE a record’s process() cycle.
Wraps a std::sync::Weak reference to the database: a record stashes
it (via crate::server::record::Record::set_async_context) without
creating an ownership cycle — the database owns the record, so a strong
Arc<PvDatabaseInner> stored on the record would leak the whole
database. Every call upgrades the Weak to a temporary PvDatabase;
once the last strong owner drops, the upgrade fails and the call is a
no-op (nothing is stranded).
This is the out-of-band counterpart to the in-band re-entry
crate::server::record::ProcessActions: a driver / callback thread
(asyn TRACE post, AQR cancel, motor intermediate readback) holds the
handle and pushes field updates or wires a completion-driven re-entry
without going through process(). It exposes exactly the c401e2f0
PACT primitive surface, each call guarded by the live-database check.
Implementations§
Source§impl AsyncDbHandle
impl AsyncDbHandle
Sourcepub fn post_fields(
&self,
name: &str,
fields: Vec<(String, EpicsValue)>,
) -> CaResult<Vec<String>>
pub fn post_fields( &self, name: &str, fields: Vec<(String, EpicsValue)>, ) -> CaResult<Vec<String>>
Out-of-band field post — see PvDatabase::post_fields. Returns an
empty Vec (no-op) if the database has been dropped.
Sourcepub fn link_target_field_type(&self, link: &str) -> Option<DbFieldType>
pub fn link_target_field_type(&self, link: &str) -> Option<DbFieldType>
Resolve a link’s target field type for the sseq link-status
diagnostics — see PvDatabase::link_target_field_type. None if
the link is constant / external / unresolvable, or the database is
gone. (Distinct from the free server::record::link_field_type,
which returns the link class LinkType, not the target’s type.)
Sourcepub fn schedule_record_init(
&self,
record: &str,
init: impl Future<Output = ()> + Send + 'static,
)
pub fn schedule_record_init( &self, record: &str, init: impl Future<Output = ()> + Send + 'static, )
Schedule a record’s link-status classification — see
PvDatabase::schedule_record_init. This is the ONE owner every
record’s refresh_link_status goes through: during the LOAD phase the
classification is queued for iocInit (so it never reads a half-built
database, and its result is final when iocInit returns), and on a
complete database it is spawned at once. Dropped, unrun, if the database
is gone.
Sourcepub async fn read_link_value(&self, link: &str) -> Option<EpicsValue>
pub async fn read_link_value(&self, link: &str) -> Option<EpicsValue>
Read a link’s value WITHOUT processing its source record — the C
dbGetLink semantics. Parses link and reads it via
PvDatabase::read_link_value_no_process; None if the link is
constant-less / external-unresolvable or the database has been
dropped. Used by module-crate records (e.g. std throttle SYNC →
SINP→VAL) that must pull an input link from special() without
triggering a process cycle.
Sourcepub async fn put_pv(&self, name: &str, value: EpicsValue) -> CaResult<()>
pub async fn put_pv(&self, name: &str, value: EpicsValue) -> CaResult<()>
Out-of-band dbPutField on any record field, common fields included —
see PvDatabase::put_pv. Ok(()) (no-op) if the database has been
dropped.
Unlike Self::post_fields (which writes through put_field_internal
and only posts), this is the full put path: a SCAN write moves the
record between scan buckets and fires the get_ioint_info hook. C
records call dbPutField on their own fields exactly this way — asynRecord’s
cancelIOInterruptScan does dbPutField(&scanAddr, DBR_LONG, &passiveScan, 1) on its own .SCAN (asynRecord.c:794-806).
Sourcepub fn mint_async_token(&self, name: &str) -> Option<AsyncToken>
pub fn mint_async_token(&self, name: &str) -> Option<AsyncToken>
Mint an async re-entry token — see PvDatabase::mint_async_token.
None if the record is absent or the database has been dropped.
Sourcepub fn cancel_async_reentry(&self, name: &str)
pub fn cancel_async_reentry(&self, name: &str)
Cancel an outstanding async re-entry — see
PvDatabase::cancel_async_reentry. No-op if the database is gone.
Sourcepub fn new_put_notify() -> (Arc<NotifyWaitSet>, Receiver<()>)
pub fn new_put_notify() -> (Arc<NotifyWaitSet>, Receiver<()>)
Arm a put-notify wait-set — see PvDatabase::new_put_notify.
Database-independent (re-exported associated fn).
Sourcepub fn reprocess_on_notify(
&self,
token: AsyncToken,
completion: Receiver<()>,
) -> Option<TaskHandle<()>>
pub fn reprocess_on_notify( &self, token: AsyncToken, completion: Receiver<()>, ) -> Option<TaskHandle<()>>
Wire a completion oneshot to an async re-entry — see
PvDatabase::reprocess_on_notify. None if the database is gone
(the completion receiver is dropped, stranding nothing).
Sourcepub async fn put_link_notify(
&self,
record_name: &str,
link_field: &str,
link_str: &str,
value: EpicsValue,
) -> Option<Receiver<()>>
pub async fn put_link_notify( &self, record_name: &str, link_field: &str, link_str: &str, value: EpicsValue, ) -> Option<Receiver<()>>
Issue a non-blocking put-with-completion to an OUT link — see
PvDatabase::put_link_notify. None if the database is gone or
the source record is missing.
Trait Implementations§
Source§impl Clone for AsyncDbHandle
impl Clone for AsyncDbHandle
Source§fn clone(&self) -> AsyncDbHandle
fn clone(&self) -> AsyncDbHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more