Skip to main content

AsyncDbHandle

Struct AsyncDbHandle 

Source
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

Source

pub fn is_alive(&self) -> bool

True while the backing database is still alive.

Source

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.

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.)

Source

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.

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 → SINPVAL) that must pull an input link from special() without triggering a process cycle.

Source

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).

Source

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.

Source

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.

Source

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).

Source

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).

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

Source§

fn clone(&self) -> AsyncDbHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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