Skip to main content

raphtory_storage/mutation/
mod.rs

1use crate::{
2    core_ops::CoreGraphOps,
3    graph::graph::Immutable,
4    mutation::{
5        addition_ops::InheritAdditionOps, deletion_ops::InheritDeletionOps,
6        property_addition_ops::InheritPropertyAdditionOps,
7    },
8};
9use raphtory_api::{
10    core::entities::properties::prop::{InvalidBigDecimal, PropError},
11    inherit::Base,
12};
13use raphtory_core::entities::{
14    graph::{logical_to_physical::InvalidNodeId, tgraph::TooManyLayers},
15    properties::{
16        props::{MetadataError, TPropError},
17        tprop::IllegalPropType,
18    },
19};
20use std::sync::Arc;
21use thiserror::Error;
22
23pub mod addition_ops;
24pub mod deletion_ops;
25pub mod property_addition_ops;
26
27#[derive(Error, Debug)]
28pub enum MutationError {
29    #[error(transparent)]
30    Immutable(#[from] Immutable),
31    #[error(transparent)]
32    TooManyLayers(#[from] TooManyLayers),
33    #[error("Node type already set")]
34    NodeTypeError,
35    #[error(transparent)]
36    InvalidNodeId(#[from] InvalidNodeId),
37    #[error(transparent)]
38    PropError(#[from] PropError),
39    #[error(transparent)]
40    TPropError(#[from] TPropError),
41    #[error(transparent)]
42    InvalidBigDecimal(#[from] InvalidBigDecimal),
43    #[error(transparent)]
44    IllegalPropType(#[from] IllegalPropType),
45    #[error(transparent)]
46    MetadataError(#[from] MetadataError),
47    #[error("Layer {layer} does not exist for edge ({src}, {dst})")]
48    InvalidEdgeLayer {
49        layer: String,
50        src: String,
51        dst: String,
52    },
53}
54
55pub trait InheritMutationOps: Base {}
56
57impl<G: InheritMutationOps> InheritAdditionOps for G {}
58impl<G: InheritMutationOps> InheritPropertyAdditionOps for G {}
59impl<G: InheritMutationOps> InheritDeletionOps for G {}
60
61impl<T: CoreGraphOps + ?Sized> InheritMutationOps for Arc<T> {}