Expand description
Meta-plugin (apoc.custom.declare* analogue) for uni-db.
This crate ships a built-in plugin whose procedures (uni.plugin.declareFunction,
declareProcedure, declareAggregate, declareTrigger) accept
Cypher source and persist new plugin registrations alongside the
framework’s uni_plugin::PluginRegistry.
§M9 status (this commit)
Completed M9 deliverables:
uni.plugin.declareFunction— fully wired. Parses the Cypher expression body at declare time, persists theDeclaredPluginrecord viapersistence::Persistence, and registers a syntheticuni_plugin::traits::scalar::ScalarPluginFninto the sharedPluginRegistry.uni.plugin.declareProcedure,declareAggregate,declareTrigger— registered as Cypher-callable procedures. Their declarations are persisted and reachable viauni.plugin.listDeclared; full body execution rides on downstream host APIs (ProcedureHost::execute_inner_queryfor procedures; trigger/aggregate body invocation follows the M11 capability work).uni.plugin.listDeclared/dropDeclared— extended for cascade-aware drops.- Reactivation — declarations are reloaded into the registry on
CustomPlugin::newwhen constructed with a non-empty persistence backend. - Capability inheritance — declarations capture the declaring principal id; the registrar enforces capability gating at registration time via the synthetic plugin’s manifest.
§Persistence
Proposal §9.7 anchors the persistence schema in a Cypher-visible
system label _DeclaredPlugin. Writing to that label from inside
a procedure requires write-enabled
uni_plugin::traits::procedure::ProcedureHost execution, which
does not yet exist (the host’s execute_inner_query is read-only
and does not bind parameters — see
crates/uni-query/src/query/executor/procedure_host.rs).
M9 ships persistence behind a persistence::Persistence trait
with a JSON-sidecar implementation that preserves the exact
DeclaredPlugin shape from §9.7. The cutover to system-label
persistence — once write-enabled host execution lands — is a
drop-in replacement of the backend; no schema, store, or
procedure code changes.
Re-exports§
pub use crate::persistence::JsonFilePersistence;pub use crate::persistence::NullPersistence;pub use crate::persistence::Persistence;pub use crate::persistence::PersistenceError;
Modules§
- persistence
- Persistence backends for declared-plugin records.
- procedures
- M9-shipped procedures fronting the declared-plugin store.
Structs§
- Custom
Plugin - Top-level meta-plugin handle.
- Declared
Aggregate Fn - A Cypher-declared aggregate function.
- Declared
Plugin - Persistent record of a declared plugin (written to
uni_system.declared_pluginsper proposal §9.7 — currently shipped via JSON sidecar; see crate docs). - Declared
Plugin Store - In-memory store for declared plugins.
- Declared
Scalar Fn - A scalar function declared from Cypher via
uni.plugin.declareFunction.
Enums§
- Custom
Error - Errors raised by the meta-plugin.
Traits§
- Procedure
Body Synthesizer - Host callback that turns a declared-procedure record into an
executable
uni_plugin::traits::procedure::ProcedurePlugin.
Functions§
- install_
aggregate_ into_ registry - Compile a declared-aggregate record into a
DeclaredAggregateFnand register it intoregistryunder a synthetic plugin id derived from the qname’s namespace.