pub struct RelationshipManager { /* private fields */ }Expand description
Cell-based RelationshipManager for handling entity relationship cascades.
This manager discovers relationships via inventory at initialization,
builds lookup indexes for efficient cascade processing, and provides
methods for processing events and establishing relations on startup.
Unlike the actor-based version, this implementation uses CellServerCtx for queries and event publishing, keeping it decoupled from direct store and event processor access.
Implementations§
Source§impl RelationshipManager
impl RelationshipManager
Sourcepub fn new() -> RelationshipManager
pub fn new() -> RelationshipManager
Create a new RelationshipManager with lookup tables built from inventory.
Sourcepub fn forward_set(
&self,
item: Arc<dyn AnyItem>,
ctx: &CellServerCtx,
) -> Result<(), PersistError>
pub fn forward_set( &self, item: Arc<dyn AnyItem>, ctx: &CellServerCtx, ) -> Result<(), PersistError>
Forward a SET event for relationship processing.
Handles EnsureFor: when a dependency entity is created, ensures all derived entities exist for all combinations.
Sourcepub fn forward_del(
&self,
item: Arc<dyn AnyItem>,
ctx: &CellServerCtx,
) -> Result<(), PersistError>
pub fn forward_del( &self, item: Arc<dyn AnyItem>, ctx: &CellServerCtx, ) -> Result<(), PersistError>
Forward a DEL event for relationship processing.
Handles:
- BelongsTo cascade deletes (parent deleted → delete children)
- OwnsMany parent deletes (parent deleted → delete owned children)
- OwnsMany child deletes (child deleted → update parent arrays)
Sourcepub fn forward_del_batch(
&self,
items: &[Arc<dyn AnyItem>],
ctx: &CellServerCtx,
) -> Result<(), PersistError>
pub fn forward_del_batch( &self, items: &[Arc<dyn AnyItem>], ctx: &CellServerCtx, ) -> Result<(), PersistError>
Forward a batch of DEL events for relationship processing.
Items should all be the same entity type. This keeps cascade deletes grouped so downstream stores and views can process one wider delete wave instead of thousands of tiny per-parent cascades.
Sourcepub fn establish_relations(
&self,
ctx: &CellServerCtx,
) -> Result<(), PersistError>
pub fn establish_relations( &self, ctx: &CellServerCtx, ) -> Result<(), PersistError>
Establish relations on startup (called after durable backend catchup).
This performs:
- BelongsTo orphan cleanup: Delete children pointing to non-existent parents
- OwnsMany orphan cleanup: Delete children not referenced by any parent
- EnsureFor initialization: Create missing entities for all dependency combinations
Trait Implementations§
Source§impl Default for RelationshipManager
impl Default for RelationshipManager
Source§fn default() -> RelationshipManager
fn default() -> RelationshipManager
Auto Trait Implementations§
impl Freeze for RelationshipManager
impl !RefUnwindSafe for RelationshipManager
impl Send for RelationshipManager
impl Sync for RelationshipManager
impl Unpin for RelationshipManager
impl UnsafeUnpin for RelationshipManager
impl UnwindSafe for RelationshipManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more