Skip to main content

Projector

Struct Projector 

Source
pub struct Projector<'a> { /* private fields */ }
Expand description

Copies journal entries into a separate graph store in journal order, idempotently, and records per actor the last projected position in the target store.

Entry graphs are written with one insert per entry, in position order. When a state source is configured (the graph side of a journal store that keeps current state, such as a tiramemsu shard), the actor’s current-state graph is then brought to the source’s content by a difference (removals and insertions, never a clear), and finally the position is recorded as <actor> vt:projectedPosition n in the graph vocab::PROJECTION_GRAPH.

Every write is idempotent for entries without blank nodes, so a run interrupted at any point (the target unreachable, the process stopped) is completed by running again: entries after the recorded position are written again and change nothing they had already written.

Implementations§

Source§

impl<'a> Projector<'a>

Source

pub fn new(journal: &'a dyn JournalStore, target: &'a dyn GraphStore) -> Self

A projector from journal into target.

Source

pub fn with_state_source(self, source: &'a dyn GraphStore) -> Self

This projector also copying each actor’s current-state graph from source.

Source

pub fn projected_position( &self, actor: &NamedNode, ) -> Result<Position, StoreError>

The last position of actor recorded in the target, 0 when none.

§Errors

The errors of GraphStore::query.

Source

pub fn project_actor( &self, actor: &NamedNode, ) -> Result<ProjectionReport, StoreError>

Projects the entries of actor after its recorded position, then its state, then records the new position.

§Errors

The errors of the journal read and of the graph store writes. Nothing already written needs undoing: running again completes the projection.

Source

pub fn project_all(&self) -> Result<Vec<ProjectionReport>, StoreError>

Projects every actor of the journal store.

§Errors

The first error of Projector::project_actor; actors before it stay projected.

Trait Implementations§

Source§

impl Debug for Projector<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Projector<'a>

§

impl<'a> !UnwindSafe for Projector<'a>

§

impl<'a> Forget for Projector<'a>

§

impl<'a> Freeze for Projector<'a>

§

impl<'a> Move for Projector<'a>

§

impl<'a> Send for Projector<'a>

§

impl<'a> Sync for Projector<'a>

§

impl<'a> Unpin for Projector<'a>

§

impl<'a> UnsafeUnpin for Projector<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V