pub struct ReflectHooks<'a> {
pub pre_reflect: Option<Box<dyn Fn(&ReflectInput) -> ReflectHookDecision + Send + Sync + 'a>>,
pub post_reflect: Option<Box<dyn Fn(&ReflectOutcome) + Send + Sync + 'a>>,
pub active_keypair: Option<&'a AgentKeypair>,
}Expand description
v0.7.0 recursive-learning Task 6/8 — optional in-substrate hook
callbacks fired by reflect_with_hooks. Bundled into a single
struct so the substrate signature stays compact and so future
callbacks (e.g. on-rollback) can land without churning every
call site.
Both callbacks are Option<...>; when None, the substrate
behaves identically to the unhooked reflect entry-point. The
callback type is Box<dyn Fn(...)> so the substrate stays
allocator-friendly (one allocation per reflect call) and so test
code can pass simple closures that capture observation state.
Fields§
§pre_reflect: Option<Box<dyn Fn(&ReflectInput) -> ReflectHookDecision + Send + Sync + 'a>>Fired BEFORE the cap check (step 4 of reflect). Receives a
read-only view of the in-flight ReflectInput (the
substrate-side equivalent of crate::hooks::events::ReflectDelta
— the in-process callback gets the typed input directly,
while the cross-process wire path serialises a ReflectDelta).
Returns ReflectHookDecision::Deny to veto.
post_reflect: Option<Box<dyn Fn(&ReflectOutcome) + Send + Sync + 'a>>Fired AFTER the transaction commits (step 7 of reflect).
Receives a read-only snapshot of the post-commit outcome
(mirrors crate::hooks::events::ReflectResult). Notify-class
— return value is ignored; the reflect already landed.
active_keypair: Option<&'a AgentKeypair>Issue #815 — signing keypair for the reflects_on edges
written inside the reflect transaction. When Some, each
edge is persisted via create_link_signed with this
keypair, producing attest_level='self_signed' rows with a
64-byte Ed25519 signature. When None, edges land as
attest_level='unsigned' — the v0.6.x behaviour and the
state of the world before #815 fixed the storage::reflect
gap that #814 left behind.
Implementations§
Trait Implementations§
Source§impl<'a> Debug for ReflectHooks<'a>
impl<'a> Debug for ReflectHooks<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ReflectHooks<'a>
impl<'a> !UnwindSafe for ReflectHooks<'a>
impl<'a> Freeze for ReflectHooks<'a>
impl<'a> Send for ReflectHooks<'a>
impl<'a> Sync for ReflectHooks<'a>
impl<'a> Unpin for ReflectHooks<'a>
impl<'a> UnsafeUnpin for ReflectHooks<'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<T> ErasedDestructor for Twhere
T: 'static,
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