pub struct EntityIndexMaintenance;Expand description
Index maintenance operations for entity property indexes.
This struct provides static methods for maintaining secondary indexes when entities are mutated. All operations work within the provided transaction to ensure atomicity.
Implementations§
Source§impl EntityIndexMaintenance
impl EntityIndexMaintenance
Sourcepub fn on_insert<T: Transaction>(
tx: &mut DatabaseTransaction<T>,
entity: &Entity,
) -> Result<(), IndexMaintenanceError>
pub fn on_insert<T: Transaction>( tx: &mut DatabaseTransaction<T>, entity: &Entity, ) -> Result<(), IndexMaintenanceError>
Add index entries for a newly inserted entity.
Looks up all indexes for the entity’s labels and creates entries for properties that are indexed.
§Arguments
tx- The transaction to useentity- The newly inserted entity
Sourcepub fn on_update<T: Transaction>(
tx: &mut DatabaseTransaction<T>,
old_entity: &Entity,
new_entity: &Entity,
) -> Result<(), IndexMaintenanceError>
pub fn on_update<T: Transaction>( tx: &mut DatabaseTransaction<T>, old_entity: &Entity, new_entity: &Entity, ) -> Result<(), IndexMaintenanceError>
Update index entries for a modified entity.
Compares old and new property values for indexed columns, removing old entries and adding new ones as needed.
§Arguments
tx- The transaction to useold_entity- The entity before modificationnew_entity- The entity after modification
Sourcepub fn on_delete<T: Transaction>(
tx: &mut DatabaseTransaction<T>,
entity: &Entity,
) -> Result<(), IndexMaintenanceError>
pub fn on_delete<T: Transaction>( tx: &mut DatabaseTransaction<T>, entity: &Entity, ) -> Result<(), IndexMaintenanceError>
Remove index entries for a deleted entity.
Removes all index entries for properties that were indexed.
§Arguments
tx- The transaction to useentity- The entity being deleted
Auto Trait Implementations§
impl Freeze for EntityIndexMaintenance
impl RefUnwindSafe for EntityIndexMaintenance
impl Send for EntityIndexMaintenance
impl Sync for EntityIndexMaintenance
impl Unpin for EntityIndexMaintenance
impl UnsafeUnpin for EntityIndexMaintenance
impl UnwindSafe for EntityIndexMaintenance
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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