pub struct PersistentTransformationDecorator<L: NamedTypeLinks> { /* private fields */ }Expand description
Replays stored triggers after every write that goes through it.
Wrap it around any NamedTypeLinks — the bare store, the transactions
decorator, the version-control decorator, or a custom one.
Implementations§
Source§impl<L: NamedTypeLinks> PersistentTransformationDecorator<L>
impl<L: NamedTypeLinks> PersistentTransformationDecorator<L>
pub fn new(links: L, triggers: TriggerStore, trace: bool) -> Self
Sourcepub fn embedded(links: L, trace: bool) -> Self
pub fn embedded(links: L, trace: bool) -> Self
Keeps the triggers in the decorated database itself.
Sourcepub fn with_sidecar(
links: L,
trigger_links: NamedTypesDecorator,
trace: bool,
) -> Self
pub fn with_sidecar( links: L, trigger_links: NamedTypesDecorator, trace: bool, ) -> Self
Keeps the triggers in trigger_links.
Sourcepub fn with_auto_create_missing_references(self, enabled: bool) -> Self
pub fn with_auto_create_missing_references(self, enabled: bool) -> Self
Whether replayed triggers may create missing references as points.
pub fn auto_create_missing_references(&self) -> bool
pub fn set_auto_create_missing_references(&mut self, enabled: bool)
pub fn inner(&self) -> &L
pub fn inner_mut(&mut self) -> &mut L
pub fn trigger_store(&self) -> &TriggerStore
pub fn trigger_store_mut(&mut self) -> &mut TriggerStore
Sourcepub fn into_parts(self) -> (L, TriggerStore)
pub fn into_parts(self) -> (L, TriggerStore)
Gives the decorated links and the trigger store back.
Sourcepub fn store_trigger(
&mut self,
kind: PersistentTransformationKind,
query: &str,
) -> Result<u32>
pub fn store_trigger( &mut self, kind: PersistentTransformationKind, query: &str, ) -> Result<u32>
Stores query as a trigger of kind and returns its root address.
Sourcepub fn remove_triggers(&mut self, query: &str) -> Result<usize>
pub fn remove_triggers(&mut self, query: &str) -> Result<usize>
Removes every stored trigger whose query equals query, and returns how
many were removed.
Sourcepub fn triggers(&mut self) -> Result<Vec<PersistentTransformation>>
pub fn triggers(&mut self) -> Result<Vec<PersistentTransformation>>
Every stored trigger, ordered by root address.
Trait Implementations§
Source§impl<L: NamedTypeLinks> NamedTypeLinks for PersistentTransformationDecorator<L>
impl<L: NamedTypeLinks> NamedTypeLinks for PersistentTransformationDecorator<L>
Source§fn ensure_created(&mut self, id: u32) -> u32
fn ensure_created(&mut self, id: u32) -> u32
Only a call that really allocates a link counts as a write.
C# hooks the raw ILinks.Create, which EnsureCreated reaches only for
addresses the store does not have yet; an EnsureCreated for an existing
address performs no operation and therefore fires no trigger. Checking
exists first reproduces that: without it a
no-op query such as () ((1: 1 1)) over an already existing point would
replay every trigger in Rust and none in C#.
Source§fn get_or_create(&mut self, source: u32, target: u32) -> u32
fn get_or_create(&mut self, source: u32, target: u32) -> u32
Fires triggers only when the pair had to be created — see
ensure_created for why.
fn create(&mut self, source: u32, target: u32) -> u32
fn get_link(&mut self, id: u32) -> Option<Link>
fn exists(&mut self, id: u32) -> bool
fn update(&mut self, id: u32, source: u32, target: u32) -> Result<Link>
fn delete(&mut self, id: u32) -> Result<Link>
Source§fn delete_observed(
&mut self,
id: u32,
observer: ChangeObserver<'_>,
) -> Result<Link>
fn delete_observed( &mut self, id: u32, observer: ChangeObserver<'_>, ) -> Result<Link>
Self::delete, reporting every change the deletion caused. Read more