Skip to main content

EntityRuntimeState

Struct EntityRuntimeState 

Source
pub struct EntityRuntimeState { /* private fields */ }

Implementations§

Source§

impl EntityRuntimeState

Source

pub fn fresh_with_shared_graph(source: &EntityRuntimeState) -> Self

Source

pub fn with_shared_graph(&self, source: &EntityRuntimeState) -> Self

Make this root resolve entities from the same flat graph as source. Existing snapshots and mutation ledger state remain owned by this root.

Source

pub fn freeze_graph( &self, builder: EntityGraphBuilder, ) -> Result<(), EntityGraphBuilder>

Publish a completely assembled graph. It becomes immutable after this call.

Source

pub fn resolve_entity<T>(&self, id: u64) -> Option<&T>
where T: Any + Send + Sync,

Resolve an entity by type and ID without locking or reference cloning.

Source

pub fn resolve_relation_list<T>( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> Option<&SmartList<T>>
where T: Any + Send + Sync,

Source

pub fn relation_list<T>( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> RelationHandle<'_, SmartList<T>>
where T: Any + Send + Sync,

Resolve a to-many relation without performing an implicit database read.

Source

pub fn resolve_relation_option<T>( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> Option<&Option<T>>
where T: Any + Send + Sync,

Source

pub fn relation_option<T>( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> RelationHandle<'_, T>
where T: Any + Send + Sync,

Resolve a to-one relation without performing an implicit database read.

Source

pub fn has_relation_view( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> bool

Source

pub fn push_change_set(&self)

Source

pub fn pop_change_set(&self) -> Option<EntityChangeSet>

Source

pub fn clear_current_change_set(&self)

Source

pub fn clear_committed(&self)

Clear all state consumed by a successfully committed ledger save. Failed saves must not call this method so their pending intent remains retryable.

Source

pub fn set( &self, key: EntityKey, field: impl Into<String>, value: impl Into<Value>, )

Source

pub fn get(&self, key: &EntityKey, field: &str) -> Option<Value>

Source

pub fn current_change_set(&self) -> EntityChangeSet

Source

pub fn set_comment(&self, comment: impl Into<String>)

Set an annotation comment on this entity root. The comment propagates through the graph save process for observability.

Source

pub fn get_comment(&self) -> Option<String>

Get the annotation comment, if any.

Source

pub fn mark_as_new(&self, key: EntityKey)

Mark this entity root as a newly created entity in memory.

Source

pub fn is_new(&self, key: &EntityKey) -> bool

Check if this entity root is marked as newly created.

Source

pub fn set_original_snapshot(&self, snapshot: EntitySnapshot)

Store an original loaded entity snapshot.

Source

pub fn set_original_compact_row(&mut self, row: CompactRow)

Store a shared-schema snapshot without allocating a mutation ledger.

Source

pub fn original_snapshot(&self) -> Option<EntitySnapshot>

Retrieve the original loaded entity snapshot.

Source

pub fn mark_as_delete(&self, key: EntityKey)

Mark an entity as deleted. The next save() call will treat this entity as a Remove operation in the graph save pipeline. Any pending field changes for this entity are cleared — they are irrelevant when the entity is being deleted.

Source

pub fn is_marked_as_delete(&self, key: &EntityKey) -> bool

Check whether an entity has been marked for deletion.

Source

pub fn changed_field_names(&self, key: &EntityKey) -> BTreeSet<String>

Get the set of field names that have been modified for the given entity key. This is the Rust equivalent of Java’s entity.getUpdatedProperties().

Source

pub fn deleted_keys(&self) -> BTreeSet<EntityKey>

Source

pub fn new_keys(&self) -> BTreeSet<EntityKey>

Source

pub fn get_original_version(&self, key: &EntityKey) -> Option<i64>

Source

pub fn get_trace_chain(&self, key: &EntityKey) -> Vec<TraceNode>

Source

pub fn set_original_version(&self, key: EntityKey, version: i64)

Trait Implementations§

Source§

impl Clone for EntityRuntimeState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EntityRuntimeState

Source§

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

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

impl Default for EntityRuntimeState

Source§

fn default() -> Self

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

impl PartialEq for EntityRuntimeState

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl RefUnwindSafe for EntityRuntimeState

Source§

impl UnwindSafe for EntityRuntimeState

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.