Skip to main content

StagingLog

Struct StagingLog 

Source
pub struct StagingLog { /* private fields */ }
Expand description

The loose intermediate representation: order-free ingestion, dangling references allowed, schema grows as observed.

Implementations§

Source§

impl StagingLog

Source

pub fn new() -> Self

Source

pub fn from_ocel(ocel: Ocel) -> Self

Re-stage an existing log so further data can merge into it (the basis for incremental sync). Schemas are seeded from the declarations, so attribute types survive the round trip.

Once a log has passed the gate, from_ocel(log).into_ocel() reproduces it unchanged.

Source

pub fn add_event(&mut self, event: StagingEvent)

Add an event (any order; its object references may not exist yet).

Source

pub fn upsert_object(&mut self, id: &str, object_type: &str)

Ensure an object exists with the given type. Repeated calls merge; a later non-empty type fills in a placeholder created by references.

Source

pub fn add_object_attribute( &mut self, id: &str, name: &str, value: AttrValue, time: DateTime<Utc>, )

Record a dynamic attribute observation for an object (created as a placeholder if unseen).

Source

pub fn add_o2o(&mut self, source_id: &str, target_id: &str, qualifier: &str)

Record an O2O relation (either endpoint may not exist yet).

Source

pub fn map_object_ids(&mut self, f: impl Fn(&str) -> String)

Re-key every object id; E2O and O2O references follow. Old ids mapping to the same new id merge: attribute observations and relations append, the first non-empty object type wins. Identity resolution is applying an alias table; anonymization is applying a hash — both are instances of this.

Source

pub fn map_events(&mut self, f: impl FnMut(&mut StagingEvent))

Rewrite every event in place (rename types, edit attributes, re-point relations). The event schema is rebuilt from the mapped events, so a renamed type replaces its old entry instead of leaving it behind.

Source

pub fn retain_events(&mut self, pred: impl FnMut(&StagingEvent) -> bool)

Keep only events matching the predicate. The event schema is rebuilt, so a type whose last event is dropped disappears from the log.

Source

pub fn into_ocel(self) -> Result<Ocel, Vec<Violation>>

The validation gate: convert into a spec-conformant Ocel.

Late attribute observations are re-checked against the final schema (values whose type degraded to string are stringified), then everything is delegated to ocel::OcelBuilder — dangling references, duplicate ids, and placeholder objects that never received a type surface as Violations.

§Errors

Returns every Violation found when the staged data does not form a valid OCEL 2.0 log.

Trait Implementations§

Source§

impl Debug for StagingLog

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for StagingLog

Source§

fn default() -> StagingLog

Returns the “default value” for a type. Read more

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<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, 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.