Skip to main content

SearchResolver

Type Alias SearchResolver 

Source
pub type SearchResolver = Arc<dyn Fn(String, Option<SocketAddr>) -> Pin<Box<dyn Future<Output = bool> + Send>> + Send + Sync>;
Expand description

Async hook invoked by PvDatabase::has_name when a name is not yet in the database. Used by the CA gateway and similar proxy components to lazily populate PVs on first search.

The resolver should:

  1. Determine whether the name should be served (e.g., check ACL)
  2. Take whatever action is needed to make has_name return true on a subsequent call (e.g., subscribe to an upstream IOC and call add_pv with a placeholder value)
  3. Return true if the name is now resolvable, false otherwise

Returning true causes has_name to re-check the database. The resolver may take some time (TCP search, upstream connect handshake); the caller (UDP search responder, TCP CREATE_CHANNEL handler) will .await it. The second argument is the downstream client’s socket address when the lookup originates from a CA/PVA search or channel-create on behalf of an identified peer (None for host-less internal lookups: preload, iocsh, link processing). the CA gateway needs this to evaluate .pvlist DENY FROM host rules at search time, the way C ca-gateway’s pvExistTest passes the client host to gateAs::findEntry.

Aliased Type§

pub struct SearchResolver { /* private fields */ }