pub struct EntityRoot { /* private fields */ }Implementations§
Source§impl EntityRoot
impl EntityRoot
Make this root resolve entities from the same flat graph as source.
Existing snapshots and mutation ledger state remain owned by this root.
Sourcepub fn freeze_graph(
&self,
builder: EntityGraphBuilder,
) -> Result<(), EntityGraphBuilder>
pub fn freeze_graph( &self, builder: EntityGraphBuilder, ) -> Result<(), EntityGraphBuilder>
Publish a completely assembled graph. It becomes immutable after this call.
Sourcepub fn resolve_entity<T>(&self, id: u64) -> Option<&T>
pub fn resolve_entity<T>(&self, id: u64) -> Option<&T>
Resolve an entity by type and ID without locking or reference cloning.
pub fn resolve_relation_list<T>( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> Option<&SmartList<T>>
pub fn resolve_relation_option<T>( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> Option<&Option<T>>
pub fn has_relation_view( &self, owner_entity: &str, owner_id: u64, relation: &str, ) -> bool
pub fn push_change_set(&self)
pub fn pop_change_set(&self) -> Option<EntityChangeSet>
pub fn clear_current_change_set(&self)
Sourcepub fn clear_committed(&self)
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.
pub fn set( &self, key: EntityKey, field: impl Into<String>, value: impl Into<Value>, )
pub fn get(&self, key: &EntityKey, field: &str) -> Option<Value>
pub fn current_change_set(&self) -> EntityChangeSet
Sourcepub fn set_comment(&self, comment: impl Into<String>)
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.
Sourcepub fn get_comment(&self) -> Option<String>
pub fn get_comment(&self) -> Option<String>
Get the annotation comment, if any.
Sourcepub fn mark_as_new(&self, key: EntityKey)
pub fn mark_as_new(&self, key: EntityKey)
Mark this entity root as a newly created entity in memory.
Sourcepub fn is_new(&self, key: &EntityKey) -> bool
pub fn is_new(&self, key: &EntityKey) -> bool
Check if this entity root is marked as newly created.
Sourcepub fn set_original_snapshot(&self, snapshot: EntitySnapshot)
pub fn set_original_snapshot(&self, snapshot: EntitySnapshot)
Store an original loaded entity snapshot.
Sourcepub fn set_original_compact_row(&self, row: CompactRow)
pub fn set_original_compact_row(&self, row: CompactRow)
Store a shared-schema snapshot without eagerly allocating a map.
Sourcepub fn original_snapshot(&self) -> Option<EntitySnapshot>
pub fn original_snapshot(&self) -> Option<EntitySnapshot>
Retrieve the original loaded entity snapshot.
Sourcepub fn mark_as_delete(&self, key: EntityKey)
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.
Sourcepub fn is_marked_as_delete(&self, key: &EntityKey) -> bool
pub fn is_marked_as_delete(&self, key: &EntityKey) -> bool
Check whether an entity has been marked for deletion.
Sourcepub fn changed_field_names(&self, key: &EntityKey) -> BTreeSet<String>
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().
pub fn deleted_keys(&self) -> BTreeSet<EntityKey>
pub fn new_keys(&self) -> BTreeSet<EntityKey>
pub fn get_original_version(&self, key: &EntityKey) -> Option<i64>
pub fn get_trace_chain(&self, key: &EntityKey) -> Vec<TraceNode>
pub fn set_original_version(&self, key: EntityKey, version: i64)
Trait Implementations§
Source§impl Clone for EntityRoot
impl Clone for EntityRoot
Source§fn clone(&self) -> EntityRoot
fn clone(&self) -> EntityRoot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more