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.
Source§fn try_create(&mut self, source: u32, target: u32) -> Result<u32>
fn try_create(&mut self, source: u32, target: u32) -> Result<u32>
fn try_ensure_created(&mut self, id: u32) -> Result<u32>
Source§fn try_get_or_create(&mut self, source: u32, target: u32) -> Result<u32>
fn try_get_or_create(&mut self, source: u32, target: u32) -> Result<u32>
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
Source§fn update_observed(
&mut self,
id: u32,
source: u32,
target: u32,
observer: ChangeObserver<'_>,
) -> Result<Link>
fn update_observed( &mut self, id: u32, source: u32, target: u32, observer: ChangeObserver<'_>, ) -> Result<Link>
Self::update, reporting every change the update caused. Read moreSource§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 morefn all_links(&mut self) -> Vec<Link> ⓘ
Source§fn query_links(
&mut self,
index: Option<u32>,
source: Option<u32>,
target: Option<u32>,
) -> Vec<Link> ⓘ
fn query_links( &mut self, index: Option<u32>, source: Option<u32>, target: Option<u32>, ) -> Vec<Link> ⓘ
None matches any value, in
the order of their addresses. Read morefn search(&mut self, source: u32, target: u32) -> Option<u32>
fn get_name(&mut self, id: u32) -> Result<Option<String>>
fn set_name(&mut self, id: u32, name: &str) -> Result<u32>
fn get_by_name(&mut self, name: &str) -> Result<Option<u32>>
fn remove_name(&mut self, id: u32) -> Result<()>
fn save(&mut self) -> Result<()>
Source§fn query_limits(&self) -> Option<QueryLimits>
fn query_limits(&self) -> Option<QueryLimits>
Source§fn reserve_query_allocations(
&mut self,
_processor: &GenericQueryProcessor<T>,
_restriction: &LinoLink,
_substitution: &LinoLink,
) -> Result<Option<HashSet<T>>>
fn reserve_query_allocations( &mut self, _processor: &GenericQueryProcessor<T>, _restriction: &LinoLink, _substitution: &LinoLink, ) -> Result<Option<HashSet<T>>>
Source§fn reference_exists(&mut self, id: T) -> bool
fn reference_exists(&mut self, id: T) -> bool
id names a link that exists. Read moreSource§fn claims(&mut self, id: T) -> Option<bool>
fn claims(&mut self, id: T) -> Option<bool>
id is an address of this store, so a link created there
(Self::ensure_created, the undo of a delete) belongs in it; None
for a plain store, which has no addresses of its own. Read moreSource§fn next_created_addresses(&mut self, count: usize) -> Result<Vec<T>>
fn next_created_addresses(&mut self, count: usize) -> Result<Vec<T>>
count links created in the store get. Read more