pub struct CustomPlugin { /* private fields */ }Expand description
Top-level meta-plugin handle.
Implements uni_plugin::Plugin. Construct via
CustomPlugin::new (with a shared PluginRegistry Arc and a
Persistence backend) and add to a Uni instance through the
host’s register_builtin_plugins flow (crates/uni/src/api/mod.rs).
The plugin owns:
store— an in-memoryDeclaredPluginStoremirroring every declaration, used for dependency analysis and read-side procedures (listDeclared,dropDeclared).registry— a sharedArc<PluginRegistry>so the declare* procedures can register syntheticuni_plugin::Pluginvalues at runtime.persistence— the durable backend that replays declarations onCustomPlugin::new.
Implementations§
Source§impl CustomPlugin
impl CustomPlugin
Sourcepub fn new(
registry: Arc<PluginRegistry>,
persistence: Arc<dyn Persistence>,
) -> Result<Self, CustomError>
pub fn new( registry: Arc<PluginRegistry>, persistence: Arc<dyn Persistence>, ) -> Result<Self, CustomError>
Construct with the given registry handle and persistence backend.
On construction, the persistence backend is queried for every
previously declared plugin and each one is re-installed into
store (re-registration into registry happens lazily — the
first time the plugin is invoked, or eagerly through
Self::reactivate_into_registry).
§Errors
Returns CustomError::Persistence if the backend’s
load_all fails.
Sourcepub fn with_procedure_synthesizer(
self,
synthesizer: Arc<dyn ProcedureBodySynthesizer>,
) -> Self
pub fn with_procedure_synthesizer( self, synthesizer: Arc<dyn ProcedureBodySynthesizer>, ) -> Self
Attach a host-side synthesizer so declared procedures (and triggers) can install executable plugins at declare time.
The host (uni-db) calls this immediately after Self::new.
Synthesizer-less construction remains valid — declared
procedures/triggers are recorded + persisted but not
registered as invocable plugins.
Sourcepub fn new_in_memory() -> Self
pub fn new_in_memory() -> Self
Construct with no persistence (in-memory only) and a fresh
PluginRegistry handle.
Used by tests that exercise the meta-plugin in isolation.
Sourcepub fn store(&self) -> &Arc<DeclaredPluginStore> ⓘ
pub fn store(&self) -> &Arc<DeclaredPluginStore> ⓘ
Access the underlying declared-plugin store.
Sourcepub fn registry(&self) -> &Arc<PluginRegistry> ⓘ
pub fn registry(&self) -> &Arc<PluginRegistry> ⓘ
Access the shared registry handle.
Sourcepub fn reactivate_into_registry(&self) -> Result<(), CustomError>
pub fn reactivate_into_registry(&self) -> Result<(), CustomError>
Replay every persisted declaration into the registry.
Called by the host immediately after Self::new so that
declarations survive restart. Skips declarations whose qname
is already registered as a native plugin (they remain marked
active=false in the store).
§Errors
Returns CustomError::Registration on registrar errors
other than DuplicateRegistration (which is expected for
shadowed declarations and downgrades the record to inactive).
Trait Implementations§
Source§impl Debug for CustomPlugin
impl Debug for CustomPlugin
Source§impl Plugin for CustomPlugin
impl Plugin for CustomPlugin
Source§fn manifest(&self) -> &PluginManifest
fn manifest(&self) -> &PluginManifest
Source§fn register(&self, r: &mut PluginRegistrar<'_>) -> Result<(), PluginError>
fn register(&self, r: &mut PluginRegistrar<'_>) -> Result<(), PluginError>
Source§fn init(&self, _cx: &PluginInitContext<'_>) -> Result<(), PluginError>
fn init(&self, _cx: &PluginInitContext<'_>) -> Result<(), PluginError>
Auto Trait Implementations§
impl !Freeze for CustomPlugin
impl !RefUnwindSafe for CustomPlugin
impl !UnwindSafe for CustomPlugin
impl Send for CustomPlugin
impl Sync for CustomPlugin
impl Unpin for CustomPlugin
impl UnsafeUnpin for CustomPlugin
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