Skip to main content

GraphMutationStore

Trait GraphMutationStore 

Source
pub trait GraphMutationStore: GraphStore {
    // Required methods
    fn delete_node<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 NodeId,
    ) -> Pin<Box<dyn Future<Output = Result<(), GrustError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn delete_edge<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        from: &'life1 NodeId,
        label: &'life2 Label,
        to: &'life3 NodeId,
    ) -> Pin<Box<dyn Future<Output = Result<(), GrustError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn apply_mutations<'life0, 'life1, 'async_trait>(
        &'life0 self,
        mutations: &'life1 [GraphMutation],
    ) -> Pin<Box<dyn Future<Output = Result<(), GrustError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: Sync + 'async_trait { ... }
}
Expand description

Incremental mutation support for stores that can delete elements.

Deletes are idempotent: removing an element that does not exist is not an error.

Required Methods§

Source

fn delete_node<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 NodeId, ) -> Pin<Box<dyn Future<Output = Result<(), GrustError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Deletes a node and all edges incident to it.

Source

fn delete_edge<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, from: &'life1 NodeId, label: &'life2 Label, to: &'life3 NodeId, ) -> Pin<Box<dyn Future<Output = Result<(), GrustError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Deletes the edge(s) matching (from, label, to).

Provided Methods§

Source

fn apply_mutations<'life0, 'life1, 'async_trait>( &'life0 self, mutations: &'life1 [GraphMutation], ) -> Pin<Box<dyn Future<Output = Result<(), GrustError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: Sync + 'async_trait,

Applies mutations in order, stopping at the first error.

The default implementation calls the single-mutation methods one at a time and is not atomic: if a later mutation fails, earlier successful mutations are not rolled back. Backends with transaction support should override this method and apply the whole slice in one transaction.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§