Skip to main content

Repository

Struct Repository 

Source
pub struct Repository<S: Store> { /* private fields */ }

Implementations§

Source§

impl<S: Store> Repository<S>

Source

pub fn new(store: S, validator: Validator) -> Self

Source

pub fn with_clock(self, clock: impl Clock + 'static) -> Self

Source

pub fn store(&self) -> &S

Source

pub fn validator(&self) -> &Validator

Source

pub fn now(&self) -> Timestamp

Source

pub fn get(&self, id: &RecordId) -> Result<Record>

Source

pub fn find(&self, id: &RecordId) -> Result<Option<Record>>

Source

pub fn history(&self, id: &RecordId) -> Result<Vec<Event>>

Source

pub fn timeline(&self, id: &RecordId) -> Result<Vec<TimelineEntry>>

Source

pub fn list(&self, query: &RecordQuery) -> Result<Vec<Record>>

Source

pub fn incoming(&self, id: &RecordId) -> Result<Vec<IncomingEdge>>

Source

pub fn create(&mut self, draft: RecordDraft, meta: Meta) -> Result<Committed>

Source

pub fn amend( &mut self, id: &RecordId, changes: Vec<Change>, meta: Meta, ) -> Result<Committed>

Source

pub fn correct( &mut self, id: &RecordId, changes: Vec<Change>, corrects: Option<EventId>, meta: Meta, ) -> Result<Committed>

Source

pub fn set_extension_field( &mut self, id: &RecordId, namespace: &str, field: &str, value: Option<ExtValue>, meta: Meta, ) -> Result<Committed>

Source

pub fn retract(&mut self, id: &RecordId, meta: Meta) -> Result<Committed>

Source

pub fn supersede( &mut self, id: &RecordId, by: &RecordId, meta: Meta, ) -> Result<Committed>

Source

pub fn redact( &mut self, id: &RecordId, fields: Vec<FieldPath>, meta: Meta, ) -> Result<Committed>

Source

pub fn annotate( &mut self, id: &RecordId, name: NamespacedName, data: BTreeMap<String, ExtValue>, meta: Meta, ) -> Result<Committed>

Source

pub fn ingest(&mut self, event: Event) -> Result<Record>

Commit already-formed events received from elsewhere (import). The events keep their ids and times; they are re-projected and validated exactly like local commands.

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for Repository<S>

§

impl<S> !UnwindSafe for Repository<S>

§

impl<S> Freeze for Repository<S>
where S: Freeze,

§

impl<S> Send for Repository<S>

§

impl<S> Sync for Repository<S>
where S: Sync,

§

impl<S> Unpin for Repository<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Repository<S>
where S: UnsafeUnpin,

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> 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 = Infallible

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.