Skip to main content

PersistentTransformationDecorator

Struct PersistentTransformationDecorator 

Source
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>

Source

pub fn new(links: L, triggers: TriggerStore, trace: bool) -> Self

Source

pub fn embedded(links: L, trace: bool) -> Self

Keeps the triggers in the decorated database itself.

Source

pub fn with_sidecar( links: L, trigger_links: NamedTypesDecorator, trace: bool, ) -> Self

Keeps the triggers in trigger_links.

Source

pub fn with_auto_create_missing_references(self, enabled: bool) -> Self

Whether replayed triggers may create missing references as points.

Source

pub fn auto_create_missing_references(&self) -> bool

Source

pub fn set_auto_create_missing_references(&mut self, enabled: bool)

Source

pub fn inner(&self) -> &L

Source

pub fn inner_mut(&mut self) -> &mut L

Source

pub fn trigger_store(&self) -> &TriggerStore

Source

pub fn trigger_store_mut(&mut self) -> &mut TriggerStore

Source

pub fn into_parts(self) -> (L, TriggerStore)

Gives the decorated links and the trigger store back.

Source

pub fn store_trigger( &mut self, kind: PersistentTransformationKind, query: &str, ) -> Result<u32>

Stores query as a trigger of kind and returns its root address.

Source

pub fn remove_triggers(&mut self, query: &str) -> Result<usize>

Removes every stored trigger whose query equals query, and returns how many were removed.

Source

pub fn triggers(&mut self) -> Result<Vec<PersistentTransformation>>

Every stored trigger, ordered by root address.

Trait Implementations§

Source§

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

Fires triggers only when the pair had to be created — see ensure_created for why.

Source§

fn create(&mut self, source: u32, target: u32) -> u32

Source§

fn exists(&mut self, id: u32) -> bool

Source§

fn update(&mut self, id: u32, source: u32, target: u32) -> Result<Link>

Source§

fn delete(&mut self, id: u32) -> Result<Link>

Source§

fn delete_observed( &mut self, id: u32, observer: ChangeObserver<'_>, ) -> Result<Link>

Self::delete, reporting every change the deletion caused. Read more
Source§

fn search(&mut self, source: u32, target: u32) -> Option<u32>

Source§

fn get_name(&mut self, id: u32) -> Result<Option<String>>

Source§

fn set_name(&mut self, id: u32, name: &str) -> Result<u32>

Source§

fn get_by_name(&mut self, name: &str) -> Result<Option<u32>>

Source§

fn remove_name(&mut self, id: u32) -> Result<()>

Source§

fn save(&mut self) -> Result<()>

Source§

fn try_ensure_created(&mut self, id: u32) -> Result<u32>

Source§

fn get_or_create_named(&mut self, name: &str) -> Result<u32>

Source§

fn format_reference(&mut self, id: u32) -> Result<String>

Source§

fn format_lino(&mut self, link: &Link) -> Result<String>

Source§

fn lino_lines(&mut self) -> Result<Vec<String>>

Source§

fn write_lino_output<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Source§

fn print_all_lino(&mut self) -> Result<()>

Source§

fn print_change_lino( &mut self, before: &Option<Link>, after: &Option<Link>, ) -> Result<()>

Source§

fn format_structure(&mut self, id: u32) -> Result<String>

Source§

fn format_structure_recursive( &mut self, id: u32, visited: &mut HashSet<u32>, ) -> Result<String>

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.