Skip to main content

PluginRegistrar

Struct PluginRegistrar 

Source
pub struct PluginRegistrar<'a> { /* private fields */ }
Expand description

The builder passed to crate::Plugin::register.

Each registration method takes a QName and a trait-object implementation. The registrar verifies the corresponding capability is present in the effective set, rejects duplicate qnames, and forwards the registration to the PluginRegistry.

The registrar is short-lived: one is created per register() call; changes flush to the PluginRegistry when register() returns successfully. A failed register() rolls back any partial state.

Implementations§

Source§

impl<'a> PluginRegistrar<'a>

Source

pub fn new( plugin_id: PluginId, effective_caps: &'a CapabilitySet, registry: &'a PluginRegistry, ) -> Self

Construct a registrar for the given plugin.

Created by the host loader; plugin authors never construct these directly.

Source

pub fn plugin_id(&self) -> &PluginId

Returns the plugin id being registered.

Source

pub fn set_plugin_id(&mut self, plugin_id: PluginId)

Override the plugin id mid-registration.

Used by external loaders (uni-plugin-extism, uni-plugin-wasm) during their two-pass dance: pass 1 reads the plugin’s manifest export to learn the canonical id, then sets it here so that validate_qname accepts qnames in the plugin’s declared namespace.

Source

pub fn scalar_fn( &mut self, qname: QName, sig: FnSignature, f: Arc<dyn ScalarPluginFn>, ) -> Result<&mut Self, PluginError>

Register a Cypher scalar function.

§Errors

Returns PluginError::CapabilityRequired if Capability::ScalarFn is absent, or PluginError::DuplicateRegistration (raised at commit time) on qname collision.

Source

pub fn aggregate_fn( &mut self, qname: QName, sig: AggSignature, f: Arc<dyn AggregatePluginFn>, ) -> Result<&mut Self, PluginError>

Register a Cypher aggregate function.

§Errors

Returns PluginError::CapabilityRequired if Capability::AggregateFn is absent.

Source

pub fn window_fn( &mut self, qname: QName, sig: WindowSignature, f: Arc<dyn WindowPluginFn>, ) -> Result<&mut Self, PluginError>

Register a Cypher window function.

§Errors

Returns PluginError::CapabilityRequired if Capability::WindowFn is absent.

Source

pub fn procedure( &mut self, qname: QName, sig: ProcedureSignature, p: Arc<dyn ProcedurePlugin>, ) -> Result<&mut Self, PluginError>

Register a Cypher procedure.

§Errors

Returns PluginError::CapabilityRequired if the procedure’s mode’s required capability is absent.

Source

pub fn locy_aggregate( &mut self, qname: QName, a: Arc<dyn LocyAggregate>, ) -> Result<&mut Self, PluginError>

Register a Locy aggregate.

§Errors

Returns PluginError::CapabilityRequired if Capability::LocyAggregate is absent.

Source

pub fn locy_predicate( &mut self, qname: QName, sig: PredSignature, p: Arc<dyn LocyPredicate>, ) -> Result<&mut Self, PluginError>

Register a Locy predicate.

§Errors

Returns PluginError::CapabilityRequired if Capability::LocyPredicate is absent.

Source

pub fn operator( &mut self, qname: QName, p: Arc<dyn OperatorProvider>, ) -> Result<&mut Self, PluginError>

Register a physical operator.

§Errors

Returns PluginError::CapabilityRequired if Capability::Operator is absent.

Source

pub fn optimizer_rule( &mut self, r: Arc<dyn OptimizerRuleProvider>, ) -> Result<&mut Self, PluginError>

Register an optimizer rule.

§Errors

Returns PluginError::CapabilityRequired if Capability::Operator is absent.

Source

pub fn index_kind( &mut self, kind: IndexKind, p: Arc<dyn IndexKindProvider>, ) -> Result<&mut Self, PluginError>

Register an index kind.

§Errors

Returns PluginError::CapabilityRequired if Capability::Index is absent.

Source

pub fn storage_backend( &mut self, scheme: &'static str, b: Arc<dyn StorageBackend>, ) -> Result<&mut Self, PluginError>

Register a storage backend by URI scheme.

§Errors

Returns PluginError::CapabilityRequired if Capability::Storage is absent.

Source

pub fn label_storage( &mut self, label: impl Into<SmolStr>, storage: Arc<dyn Storage>, ) -> Result<&mut Self, PluginError>

Register a per-label plugin storage (M5h.2).

Native-schema label scans for label will be routed through storage instead of the host’s native backend. Distinct from Self::storage_backend, which is keyed by URI scheme and opens new Storage instances on demand.

§Errors

Returns PluginError::CapabilityRequired if Capability::Storage is absent.

Source

pub fn algorithm( &mut self, qname: QName, p: Arc<dyn AlgorithmProvider>, ) -> Result<&mut Self, PluginError>

Register a graph algorithm.

§Errors

Returns PluginError::CapabilityRequired if Capability::Algorithm is absent.

Source

pub fn pregel( &mut self, qname: QName, p: Arc<dyn PregelProgramProvider>, ) -> Result<&mut Self, PluginError>

Register a Pregel-style algorithm.

§Errors

Returns PluginError::CapabilityRequired if Capability::Algorithm is absent.

Source

pub fn crdt_kind( &mut self, kind: CrdtKind, p: Arc<dyn CrdtKindProvider>, ) -> Result<&mut Self, PluginError>

Register a CRDT kind.

§Errors

Returns PluginError::CapabilityRequired if Capability::Crdt is absent.

Source

pub fn hook( &mut self, h: Arc<dyn SessionHook>, ) -> Result<&mut Self, PluginError>

Register a session-lifecycle hook.

§Errors

Returns PluginError::CapabilityRequired if Capability::Hook is absent.

Source

pub fn logical_type( &mut self, t: Arc<dyn LogicalTypeProvider>, ) -> Result<&mut Self, PluginError>

Register a logical type.

§Errors

Returns PluginError::CapabilityRequired if Capability::Type is absent.

Source

pub fn auth_provider( &mut self, p: Arc<dyn AuthProvider>, ) -> Result<&mut Self, PluginError>

Register an authentication provider.

§Errors

Returns PluginError::CapabilityRequired if Capability::Auth is absent.

Source

pub fn authz_policy( &mut self, p: Arc<dyn AuthzPolicy>, ) -> Result<&mut Self, PluginError>

Register an authorization policy.

§Errors

Returns PluginError::CapabilityRequired if Capability::Authz is absent.

Source

pub fn connector( &mut self, c: Arc<dyn Connector>, ) -> Result<&mut Self, PluginError>

Register a wire-protocol connector.

§Errors

Returns PluginError::CapabilityRequired if Capability::Connector is absent.

Source

pub fn trigger( &mut self, t: Arc<dyn TriggerPlugin>, ) -> Result<&mut Self, PluginError>

Register a fine-grained trigger.

§Errors

Returns PluginError::CapabilityRequired if Capability::Trigger is absent.

Source

pub fn collation( &mut self, c: Arc<dyn CollationProvider>, ) -> Result<&mut Self, PluginError>

Register a collation.

§Errors

Returns PluginError::CapabilityRequired if Capability::Collation is absent.

Source

pub fn cdc_output( &mut self, c: Arc<dyn CdcOutputProvider>, ) -> Result<&mut Self, PluginError>

Register a CDC output sink.

§Errors

Returns PluginError::CapabilityRequired if Capability::Cdc is absent.

Source

pub fn catalog( &mut self, c: Arc<dyn CatalogProvider>, ) -> Result<&mut Self, PluginError>

Register a catalog provider.

§Errors

Returns PluginError::CapabilityRequired if Capability::Catalog is absent.

Source

pub fn replacement_scan( &mut self, r: Arc<dyn ReplacementScanProvider>, ) -> Result<&mut Self, PluginError>

Register a replacement-scan provider.

§Errors

Returns PluginError::CapabilityRequired if Capability::Catalog is absent.

Source

pub fn background_job( &mut self, j: Arc<dyn BackgroundJobProvider>, ) -> Result<&mut Self, PluginError>

Register a background-job provider.

§Errors

Returns PluginError::CapabilityRequired if no BackgroundJob capability variant is present in the effective set.

Source

pub fn commit_to_registry(self) -> Result<(), PluginError>

Commit batched registrations to the registry.

Called by the host loader after the plugin’s register() returns successfully; failures during register() are rolled back by simply dropping the registrar without committing.

§Errors

Returns PluginError::DuplicateRegistration if any pending qname is already taken in the registry.

Source

pub fn pending_len(&self) -> usize

Returns the number of pending registrations.

Exposed for diagnostics and integration tests that want to verify a plugin’s register() queued the expected number of items before the registrar commits.

Trait Implementations§

Source§

impl<'a> Debug for PluginRegistrar<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for PluginRegistrar<'a>

§

impl<'a> !UnwindSafe for PluginRegistrar<'a>

§

impl<'a> Freeze for PluginRegistrar<'a>

§

impl<'a> Send for PluginRegistrar<'a>

§

impl<'a> Sync for PluginRegistrar<'a>

§

impl<'a> Unpin for PluginRegistrar<'a>

§

impl<'a> UnsafeUnpin for PluginRegistrar<'a>

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