Skip to main content

CustomPlugin

Struct CustomPlugin 

Source
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-memory DeclaredPluginStore mirroring every declaration, used for dependency analysis and read-side procedures (listDeclared, dropDeclared).
  • registry — a shared Arc<PluginRegistry> so the declare* procedures can register synthetic uni_plugin::Plugin values at runtime.
  • persistence — the durable backend that replays declarations on CustomPlugin::new.

Implementations§

Source§

impl CustomPlugin

Source

pub const ID: &'static str = "custom"

Reserved plugin id.

Source

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.

Source

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.

Source

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.

Source

pub fn store(&self) -> &Arc<DeclaredPluginStore>

Access the underlying declared-plugin store.

Source

pub fn registry(&self) -> &Arc<PluginRegistry>

Access the shared registry handle.

Source

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

Source§

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

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

impl Plugin for CustomPlugin

Source§

fn manifest(&self) -> &PluginManifest

Static plugin description. Read more
Source§

fn register(&self, r: &mut PluginRegistrar<'_>) -> Result<(), PluginError>

Register extension points with the host. Read more
Source§

fn init(&self, _cx: &PluginInitContext<'_>) -> Result<(), PluginError>

Optional initialization callback. Read more
Source§

fn shutdown(&self)

Optional shutdown callback. 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