Skip to main content

PluginRegistry

Struct PluginRegistry 

Source
pub struct PluginRegistry { /* private fields */ }
Expand description

All-surfaces plugin registry.

Per-surface tables wrapped in arc-swap for wait-free reads. The registry tracks per-plugin ownership so remove_plugin can clean up all of a plugin’s registrations in one pass.

Implementations§

Source§

impl PluginRegistry

Source

pub fn new() -> Self

Construct an empty registry.

Source

pub fn scalar_fn(&self, q: &QName) -> Option<Arc<ScalarEntry>>

Look up a registered scalar function by qname.

Source

pub fn iter_scalars(&self) -> Vec<(QName, Arc<ScalarEntry>)>

Iterate every registered scalar function — (QName, ScalarEntry).

Collects into a Vec so the iteration does not hold a long-lived reference to the underlying DashMap (avoids subtle aliasing hazards when callers register or remove plugins mid-iteration).

§Examples
for (qname, entry) in registry.iter_scalars() {
    ctx.register_udf(ScalarUDF::new_from_impl(adapt(qname, entry)));
}
Source

pub fn iter_procedures(&self) -> Vec<(QName, Arc<ProcedureEntry>)>

Iterate every registered procedure — (QName, ProcedureEntry).

Arity-overloaded names yield one tuple per registered overload.

Source

pub fn iter_locy_aggregates(&self) -> Vec<(QName, Arc<LocyAggregateEntry>)>

Iterate every registered Locy aggregate — (QName, LocyAggregateEntry).

Source

pub fn iter_algorithms(&self) -> Vec<(QName, Arc<dyn AlgorithmProvider>)>

Iterate every registered algorithm — (QName, AlgorithmProvider).

Source

pub fn iter_index_kinds(&self) -> Vec<(IndexKind, Arc<dyn IndexKindProvider>)>

Iterate every registered index kind — (IndexKind, IndexKindProvider).

Source

pub fn catalogs(&self) -> Vec<Arc<dyn CatalogProvider>>

Snapshot the registered catalog providers.

Returns a Vec so the iteration does not hold a long-lived reference to the underlying DashMap.

Source

pub fn aggregate(&self, q: &QName) -> Option<Arc<AggregateEntry>>

Look up a registered aggregate by qname.

Source

pub fn window(&self, q: &QName) -> Option<Arc<WindowEntry>>

Look up a registered window function by qname.

Source

pub fn procedure(&self, q: &QName) -> Option<Arc<ProcedureEntry>>

Look up a registered procedure by qname.

If the qname carries multiple arity overloads (M5c.2), this returns the first registered entry, which preserves the legacy single-arity lookup contract. Arity-aware callers should use Self::procedure_with_arity instead.

Source

pub fn procedure_with_arity( &self, q: &QName, arity: usize, ) -> Option<Arc<ProcedureEntry>>

Look up a registered procedure by qname and positional argument count. Returns the entry whose signature has exactly arity arguments, or None if no overload matches.

Procedures may be registered with the same qname under multiple arities (e.g. an algorithm’s legacy 5-arg form alongside the new (graphRef, config) 2-arg form). Resolution sites that know the call’s argument count should prefer this method; the bare Self::procedure is preserved for callers that only need the first registration.

Source

pub fn procedure_overloads(&self, q: &QName) -> Vec<Arc<ProcedureEntry>>

Return all arity overloads registered under q.

The returned Vec is empty when nothing is registered. Useful for diagnostic surfaces (e.g. EXPLAIN of an ambiguous call) and for listing API.

Source

pub fn locy_aggregate(&self, q: &QName) -> Option<Arc<LocyAggregateEntry>>

Look up a registered Locy aggregate by qname.

Source

pub fn locy_predicate(&self, q: &QName) -> Option<Arc<LocyPredicateEntry>>

Look up a registered Locy predicate by qname.

Source

pub fn storage_backend(&self, scheme: &str) -> Option<Arc<dyn StorageBackend>>

Look up a registered storage backend by scheme.

Source

pub fn lookup_label_storage(&self, label: &str) -> Option<Arc<dyn Storage>>

Look up the plugin Storage (if any) registered to serve the given native label name (M5h.2). Consulted by the host’s StorageManager::scan_vertex_table before the native backend fallback — when this returns Some, the planner’s graph-scan path is routed through plugin storage instead of Lance.

Source

pub fn index_kind(&self, k: &IndexKind) -> Option<Arc<dyn IndexKindProvider>>

Look up a registered index-kind by kind.

Source

pub fn register_index_handle( &self, name: impl Into<SmolStr>, kind: IndexKind, handle: Arc<dyn IndexHandle>, )

Register a live IndexHandle under an index name.

The host calls this after building a handle from a custom IndexKindProvider (or after open() from persisted bytes). The planner consults this table from plan_vector_knn to route probes through the plugin handle instead of the native storage path.

If an entry already exists under the same name, it is replaced.

Source

pub fn index_handle(&self, name: &str) -> Option<IndexHandleEntry>

Look up a live IndexHandle by index name. Returns a cheap clone (the inner handle is Arc-wrapped).

Source

pub fn deregister_index_handle(&self, name: &str) -> Option<IndexHandleEntry>

Remove a live IndexHandle. Returns the removed entry if one existed.

Source

pub fn register_virtual_label( &self, name: impl Into<SmolStr>, table: Arc<dyn CatalogTable>, ) -> Result<u16, PluginError>

Allocate (or look up) a virtual label ID for name, owned by table. The host’s QueryPlanner calls this when an unknown label name is claimed by a CatalogProvider or ReplacementScanProvider; subsequent references to the same name return the cached ID without re-running discovery.

Idempotent: a second call with the same name returns the previously-allocated ID and replaces the stored CatalogTable (so cached LogicalPlans naturally pick up the latest table on next execute). Returns Err if the virtual range is exhausted (255 slots, see uni_common::core::schema).

Source

pub fn virtual_label_by_name(&self, name: &str) -> Option<u16>

Look up a virtual label by name. Returns None if no provider has claimed it yet (the caller hasn’t called register_virtual_label).

Source

pub fn virtual_label_by_id(&self, id: u16) -> Option<VirtualEntry>

Look up the catalog table behind a virtual label ID. Returns the entry cheaply cloned (inner Arc<dyn CatalogTable>).

Source

pub fn register_virtual_edge_type( &self, name: impl Into<SmolStr>, table: Arc<dyn CatalogTable>, ) -> Result<u32, PluginError>

Allocate (or look up) a virtual edge-type ID for name. Same semantics as Self::register_virtual_label but for the u32 edge-type ID space.

Source

pub fn virtual_edge_type_by_name(&self, name: &str) -> Option<u32>

Look up a virtual edge type by name.

Source

pub fn virtual_edge_type_by_id(&self, id: u32) -> Option<VirtualEntry>

Look up the catalog table behind a virtual edge-type ID.

Source

pub fn algorithm(&self, q: &QName) -> Option<Arc<dyn AlgorithmProvider>>

Look up a registered algorithm by qname.

Source

pub fn crdt_kind(&self, k: &CrdtKind) -> Option<Arc<dyn CrdtKindProvider>>

Look up a registered CRDT kind.

Source

pub fn logical_type( &self, name: &SmolStr, ) -> Option<Arc<dyn LogicalTypeProvider>>

Look up a registered logical type by its Arrow extension name.

Source

pub fn hooks(&self) -> Arc<Vec<Arc<dyn SessionHook>>>

Snapshot the registered hook chain.

Source

pub fn optimizer_rules(&self) -> Arc<Vec<Arc<dyn OptimizerRuleProvider>>>

Snapshot the registered optimizer-rule providers (M5h).

Source

pub fn triggers(&self) -> Arc<Vec<Arc<dyn TriggerPlugin>>>

Snapshot the registered trigger chain.

Source

pub fn cdc_outputs_snapshot(&self) -> Vec<(SmolStr, Arc<dyn CdcOutputProvider>)>

Snapshot every registered CdcOutputProvider keyed by name (FU-4).

Used by Uni::build to start a CDC stream per provider before the commit broadcaster begins pushing CdcBatches.

Source

pub fn cdc_outputs_is_empty(&self) -> bool

true when no CdcOutputProvider is registered.

Used by the commit hot-path to skip mutation-row materialization when there are no CDC subscribers — preserves the empty-registry fast path.

Source

pub fn auth_providers(&self) -> Arc<Vec<Arc<dyn AuthProvider>>>

Snapshot the registered authentication providers (M5i).

Source

pub fn authz_policies(&self) -> Arc<Vec<Arc<dyn AuthzPolicy>>>

Snapshot the registered authorization policies (M5i).

Source

pub fn connectors(&self) -> Arc<Vec<Arc<dyn Connector>>>

Snapshot the registered wire-protocol connectors (M5i).

Source

pub fn replacement_scans(&self) -> Arc<Vec<Arc<dyn ReplacementScanProvider>>>

Snapshot the registered replacement-scan providers.

Source

pub fn background_jobs(&self) -> Arc<Vec<Arc<dyn BackgroundJobProvider>>>

Snapshot the registered background jobs.

Source

pub fn iter_for_plugin(&self, plugin: &PluginId) -> Option<PluginRecordSnapshot>

Snapshot the surfaces a plugin currently owns.

Returns None when the plugin has never registered anything (or has already been removed). Used by crate::reload::ReloadDispatcher to determine which per-kind reload protocols to invoke for the old plugin.

The snapshot is a deep clone of the registry’s internal PluginRecord; mutating the registry afterward does not affect the snapshot.

Source

pub fn remove_plugin(&self, plugin: &PluginId)

Remove all registrations for the given plugin.

Used by Uni::remove_plugin and as part of hot reload’s drain step. Dispatches per family via the *Ops traits in crate::surfaces; the label-storage / logical-type / collation / cdc / catalog surfaces are dropped here too (the per-key tracking lifts the old count-only gap where hot reload leaked entries on those slots).

Trait Implementations§

Source§

impl Debug for PluginRegistry

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PluginRegistry

Source§

fn default() -> PluginRegistry

Returns the “default value” for a type. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PluginState for T
where T: Send + Sync + 'static,

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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