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>
impl<'a> PluginRegistrar<'a>
Sourcepub fn new(
plugin_id: PluginId,
effective_caps: &'a CapabilitySet,
registry: &'a PluginRegistry,
) -> Self
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.
Sourcepub fn set_plugin_id(&mut self, plugin_id: PluginId)
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.
Sourcepub fn scalar_fn(
&mut self,
qname: QName,
sig: FnSignature,
f: Arc<dyn ScalarPluginFn>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn aggregate_fn(
&mut self,
qname: QName,
sig: AggSignature,
f: Arc<dyn AggregatePluginFn>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn window_fn(
&mut self,
qname: QName,
sig: WindowSignature,
f: Arc<dyn WindowPluginFn>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn procedure(
&mut self,
qname: QName,
sig: ProcedureSignature,
p: Arc<dyn ProcedurePlugin>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn locy_aggregate(
&mut self,
qname: QName,
a: Arc<dyn LocyAggregate>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn locy_predicate(
&mut self,
qname: QName,
sig: PredSignature,
p: Arc<dyn LocyPredicate>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn operator(
&mut self,
qname: QName,
p: Arc<dyn OperatorProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn optimizer_rule(
&mut self,
r: Arc<dyn OptimizerRuleProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn index_kind(
&mut self,
kind: IndexKind,
p: Arc<dyn IndexKindProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn storage_backend(
&mut self,
scheme: &'static str,
b: Arc<dyn StorageBackend>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn label_storage(
&mut self,
label: impl Into<SmolStr>,
storage: Arc<dyn Storage>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn algorithm(
&mut self,
qname: QName,
p: Arc<dyn AlgorithmProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn pregel(
&mut self,
qname: QName,
p: Arc<dyn PregelProgramProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn crdt_kind(
&mut self,
kind: CrdtKind,
p: Arc<dyn CrdtKindProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn hook(
&mut self,
h: Arc<dyn SessionHook>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn logical_type(
&mut self,
t: Arc<dyn LogicalTypeProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn auth_provider(
&mut self,
p: Arc<dyn AuthProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn authz_policy(
&mut self,
p: Arc<dyn AuthzPolicy>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn connector(
&mut self,
c: Arc<dyn Connector>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn trigger(
&mut self,
t: Arc<dyn TriggerPlugin>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn collation(
&mut self,
c: Arc<dyn CollationProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn cdc_output(
&mut self,
c: Arc<dyn CdcOutputProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn catalog(
&mut self,
c: Arc<dyn CatalogProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn replacement_scan(
&mut self,
r: Arc<dyn ReplacementScanProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn background_job(
&mut self,
j: Arc<dyn BackgroundJobProvider>,
) -> Result<&mut Self, PluginError>
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.
Sourcepub fn commit_to_registry(self) -> Result<(), PluginError>
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.
Sourcepub fn pending_len(&self) -> usize
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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