graphrecords 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {graphrecords-0.2.0 → graphrecords-0.3.0}/Cargo.lock +6 -6
- {graphrecords-0.2.0 → graphrecords-0.3.0}/Cargo.toml +7 -7
- {graphrecords-0.2.0 → graphrecords-0.3.0}/PKG-INFO +1 -1
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/mod.rs +5 -1
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/plugins/graphrecord.rs +115 -71
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/plugins/mod.rs +6 -2
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/mod.rs +38 -2
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/plugins.rs +14 -2
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/graphrecord.pyi +5 -1
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/graphrecord.py +44 -2
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/plugins.py +11 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/types.py +3 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/pyproject.toml +1 -1
- {graphrecords-0.2.0 → graphrecords-0.3.0}/README.md +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/Cargo.toml +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/README.md +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/errors/graph.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/errors/graphrecord.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/errors/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/attributes.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/datatypes/attribute.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/datatypes/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/datatypes/value.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/graph/edge.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/graph/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/graph/node.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/group_mapping.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/overview/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/overview/tabled_modifiers.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/polars.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/attributes/group_by.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/attributes/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/attributes/operand.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/attributes/operation.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/edges/group_by.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/edges/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/edges/operand.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/edges/operation.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/group_by.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/nodes/group_by.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/nodes/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/nodes/operand.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/nodes/operation.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/aggregation.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/arithmetic.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/comparison.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/indexing.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/is_type.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/logic.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/membership.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/numeric_utils.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/string_ops.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/operand_traits/structure.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/values/group_by.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/values/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/values/operand.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/values/operation.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/querying/wrapper.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/schema.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/lib.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/prelude.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/Cargo.toml +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/README.md +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/conversion_lut.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/attribute.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/borrowed.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/datatype.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/errors.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/overview.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/querying/attributes.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/querying/edges.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/querying/mod.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/querying/nodes.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/querying/values.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/schema.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/traits.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/graphrecord/value.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/lib.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/prelude.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-python/src/pyo3_bindings.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-utils/Cargo.toml +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-utils/README.md +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-utils/src/aliases.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-utils/src/lib.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-utils/src/macros.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/py-graphrecords/Cargo.toml +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/py-graphrecords/README.md +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/crates/py-graphrecords/src/lib.rs +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/__init__.py +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/__init__.pyi +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/datatype.pyi +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/overview.pyi +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/plugins.pyi +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/querying.pyi +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/_graphrecords/schema.pyi +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/builder.py +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/datatype.py +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/indexers.py +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/overview.py +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/py.typed +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/querying.py +0 -0
- {graphrecords-0.2.0 → graphrecords-0.3.0}/graphrecords/schema.py +0 -0
|
@@ -804,7 +804,7 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
|
804
804
|
|
|
805
805
|
[[package]]
|
|
806
806
|
name = "graphrecords"
|
|
807
|
-
version = "0.
|
|
807
|
+
version = "0.3.0"
|
|
808
808
|
dependencies = [
|
|
809
809
|
"graphrecords-core",
|
|
810
810
|
"graphrecords-utils",
|
|
@@ -812,7 +812,7 @@ dependencies = [
|
|
|
812
812
|
|
|
813
813
|
[[package]]
|
|
814
814
|
name = "graphrecords-core"
|
|
815
|
-
version = "0.
|
|
815
|
+
version = "0.3.0"
|
|
816
816
|
dependencies = [
|
|
817
817
|
"chrono",
|
|
818
818
|
"graphrecords-utils",
|
|
@@ -830,7 +830,7 @@ dependencies = [
|
|
|
830
830
|
|
|
831
831
|
[[package]]
|
|
832
832
|
name = "graphrecords-pyo3-interop"
|
|
833
|
-
version = "0.
|
|
833
|
+
version = "0.3.0"
|
|
834
834
|
dependencies = [
|
|
835
835
|
"bincode 1.3.3",
|
|
836
836
|
"graphrecords",
|
|
@@ -840,7 +840,7 @@ dependencies = [
|
|
|
840
840
|
|
|
841
841
|
[[package]]
|
|
842
842
|
name = "graphrecords-python"
|
|
843
|
-
version = "0.
|
|
843
|
+
version = "0.3.0"
|
|
844
844
|
dependencies = [
|
|
845
845
|
"bincode 1.3.3",
|
|
846
846
|
"chrono",
|
|
@@ -858,7 +858,7 @@ dependencies = [
|
|
|
858
858
|
|
|
859
859
|
[[package]]
|
|
860
860
|
name = "graphrecords-utils"
|
|
861
|
-
version = "0.
|
|
861
|
+
version = "0.3.0"
|
|
862
862
|
dependencies = [
|
|
863
863
|
"hashbrown 0.16.1",
|
|
864
864
|
]
|
|
@@ -2217,7 +2217,7 @@ dependencies = [
|
|
|
2217
2217
|
|
|
2218
2218
|
[[package]]
|
|
2219
2219
|
name = "py-graphrecords"
|
|
2220
|
-
version = "0.
|
|
2220
|
+
version = "0.3.0"
|
|
2221
2221
|
dependencies = [
|
|
2222
2222
|
"graphrecords-core",
|
|
2223
2223
|
"graphrecords-python",
|
|
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
|
|
3
3
|
resolver = "2"
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.3.0"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
repository = "https://github.com/medmodels/graphrecords"
|
|
9
9
|
license = "MIT"
|
|
@@ -22,12 +22,12 @@ bincode = "1.3.3"
|
|
|
22
22
|
typetag = "0.2.21"
|
|
23
23
|
|
|
24
24
|
# Workspace members
|
|
25
|
-
graphrecords = { version = "0.
|
|
26
|
-
graphrecords-core = { version = "0.
|
|
27
|
-
graphrecords-utils = { version = "0.
|
|
28
|
-
graphrecords-python = { version = "0.
|
|
29
|
-
py-graphrecords = { version = "0.
|
|
30
|
-
graphrecords-pyo3-interop = { version = "0.
|
|
25
|
+
graphrecords = { version = "0.3.0", path = "crates/graphrecords" }
|
|
26
|
+
graphrecords-core = { version = "0.3.0", path = "crates/graphrecords-core" }
|
|
27
|
+
graphrecords-utils = { version = "0.3.0", path = "crates/graphrecords-utils" }
|
|
28
|
+
graphrecords-python = { version = "0.3.0", path = "crates/graphrecords-python" }
|
|
29
|
+
py-graphrecords = { version = "0.3.0", path = "crates/py-graphrecords" }
|
|
30
|
+
graphrecords-pyo3-interop = { version = "0.3.0", path = "crates/graphrecords-pyo3-interop" }
|
|
31
31
|
|
|
32
32
|
[workspace.lints.clippy]
|
|
33
33
|
pedantic = { level = "deny", priority = -1 }
|
|
@@ -15,6 +15,8 @@ pub use self::{
|
|
|
15
15
|
group_mapping::Group,
|
|
16
16
|
};
|
|
17
17
|
use crate::errors::GraphRecordResult;
|
|
18
|
+
#[cfg(feature = "plugins")]
|
|
19
|
+
use crate::graphrecord::plugins::PluginName;
|
|
18
20
|
use crate::{
|
|
19
21
|
errors::GraphRecordError,
|
|
20
22
|
graphrecord::{
|
|
@@ -25,6 +27,8 @@ use crate::{
|
|
|
25
27
|
};
|
|
26
28
|
use ::polars::frame::DataFrame;
|
|
27
29
|
use graph::Graph;
|
|
30
|
+
#[cfg(feature = "plugins")]
|
|
31
|
+
use graphrecords_utils::aliases::GrHashMap;
|
|
28
32
|
use graphrecords_utils::aliases::GrHashSet;
|
|
29
33
|
use group_mapping::GroupMapping;
|
|
30
34
|
#[cfg(feature = "plugins")]
|
|
@@ -175,7 +179,7 @@ impl GraphRecord {
|
|
|
175
179
|
|
|
176
180
|
#[cfg(feature = "plugins")]
|
|
177
181
|
pub fn with_plugins(
|
|
178
|
-
plugins:
|
|
182
|
+
plugins: GrHashMap<PluginName, Box<dyn plugins::Plugin>>,
|
|
179
183
|
) -> GraphRecordResult<PluginGraphRecord> {
|
|
180
184
|
PluginGraphRecord::new(Self::default(), plugins)
|
|
181
185
|
}
|
|
@@ -15,10 +15,11 @@ use super::{
|
|
|
15
15
|
PreRemoveNodeFromGroupContext, PreSetSchemaContext,
|
|
16
16
|
};
|
|
17
17
|
use crate::{
|
|
18
|
-
errors::GraphRecordResult,
|
|
18
|
+
errors::{GraphRecordError, GraphRecordResult},
|
|
19
19
|
graphrecord::{EdgeDataFrameInput, GraphRecord, NodeDataFrameInput},
|
|
20
|
-
prelude::{Attributes, EdgeIndex, Group, NodeIndex, Schema},
|
|
20
|
+
prelude::{Attributes, EdgeIndex, GraphRecordAttribute, Group, NodeIndex, Schema},
|
|
21
21
|
};
|
|
22
|
+
use graphrecords_utils::aliases::GrHashMap;
|
|
22
23
|
#[cfg(feature = "serde")]
|
|
23
24
|
use serde::{Deserialize, Serialize};
|
|
24
25
|
use std::{
|
|
@@ -27,18 +28,20 @@ use std::{
|
|
|
27
28
|
sync::Arc,
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
pub type PluginName = GraphRecordAttribute;
|
|
32
|
+
|
|
30
33
|
#[derive(Debug, Clone)]
|
|
31
34
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
|
32
35
|
pub struct PluginGraphRecord {
|
|
33
36
|
graphrecord: GraphRecord,
|
|
34
|
-
plugins: Arc<
|
|
37
|
+
plugins: Arc<GrHashMap<PluginName, Box<dyn Plugin>>>,
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
impl Default for PluginGraphRecord {
|
|
38
41
|
fn default() -> Self {
|
|
39
42
|
Self {
|
|
40
43
|
graphrecord: GraphRecord::default(),
|
|
41
|
-
plugins: Arc::new(
|
|
44
|
+
plugins: Arc::new(GrHashMap::new()),
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -73,7 +76,7 @@ impl From<GraphRecord> for PluginGraphRecord {
|
|
|
73
76
|
fn from(graphrecord: GraphRecord) -> Self {
|
|
74
77
|
Self {
|
|
75
78
|
graphrecord,
|
|
76
|
-
plugins: Arc::new(
|
|
79
|
+
plugins: Arc::new(GrHashMap::new()),
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
}
|
|
@@ -85,7 +88,10 @@ impl From<PluginGraphRecord> for GraphRecord {
|
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
impl PluginGraphRecord {
|
|
88
|
-
pub fn new(
|
|
91
|
+
pub fn new(
|
|
92
|
+
graphrecord: GraphRecord,
|
|
93
|
+
plugins: GrHashMap<PluginName, Box<dyn Plugin>>,
|
|
94
|
+
) -> GraphRecordResult<Self> {
|
|
89
95
|
let mut graphrecord = Self {
|
|
90
96
|
graphrecord,
|
|
91
97
|
plugins: Arc::new(plugins),
|
|
@@ -95,18 +101,56 @@ impl PluginGraphRecord {
|
|
|
95
101
|
|
|
96
102
|
plugins
|
|
97
103
|
.iter()
|
|
98
|
-
.try_for_each(|plugin| plugin.initialize(&mut graphrecord))?;
|
|
104
|
+
.try_for_each(|(_, plugin)| plugin.initialize(&mut graphrecord))?;
|
|
99
105
|
|
|
100
106
|
Ok(graphrecord)
|
|
101
107
|
}
|
|
102
108
|
|
|
109
|
+
pub fn add_plugin(
|
|
110
|
+
&mut self,
|
|
111
|
+
name: PluginName,
|
|
112
|
+
plugin: Box<dyn Plugin>,
|
|
113
|
+
) -> GraphRecordResult<()> {
|
|
114
|
+
if self.plugins.contains_key(&name) {
|
|
115
|
+
return Err(GraphRecordError::KeyError(format!(
|
|
116
|
+
"Plugin with name '{name}' already exists"
|
|
117
|
+
)));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
plugin.initialize(self)?;
|
|
121
|
+
|
|
122
|
+
let plugins = Arc::make_mut(&mut self.plugins);
|
|
123
|
+
|
|
124
|
+
plugins.insert(name, plugin);
|
|
125
|
+
|
|
126
|
+
Ok(())
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
pub fn remove_plugin(&mut self, name: &PluginName) -> GraphRecordResult<()> {
|
|
130
|
+
let plugin = {
|
|
131
|
+
let plugins = Arc::make_mut(&mut self.plugins);
|
|
132
|
+
|
|
133
|
+
plugins.remove(name).ok_or_else(|| {
|
|
134
|
+
GraphRecordError::KeyError(format!("Plugin with name '{name}' does not exist"))
|
|
135
|
+
})?
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
plugin.finalize(self)?;
|
|
139
|
+
|
|
140
|
+
Ok(())
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
pub fn plugin_names(&self) -> impl Iterator<Item = &PluginName> {
|
|
144
|
+
self.plugins.keys()
|
|
145
|
+
}
|
|
146
|
+
|
|
103
147
|
pub fn set_schema(&mut self, schema: Schema) -> GraphRecordResult<()> {
|
|
104
148
|
let plugins = self.plugins.clone();
|
|
105
149
|
|
|
106
150
|
let pre_context = PreSetSchemaContext { schema };
|
|
107
151
|
let pre_context = plugins
|
|
108
152
|
.iter()
|
|
109
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
153
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
110
154
|
plugin.pre_set_schema(self, pre_context)
|
|
111
155
|
})?;
|
|
112
156
|
|
|
@@ -114,20 +158,20 @@ impl PluginGraphRecord {
|
|
|
114
158
|
|
|
115
159
|
plugins
|
|
116
160
|
.iter()
|
|
117
|
-
.try_for_each(|plugin| plugin.post_set_schema(self))?;
|
|
161
|
+
.try_for_each(|(_, plugin)| plugin.post_set_schema(self))?;
|
|
118
162
|
|
|
119
163
|
Ok(())
|
|
120
164
|
}
|
|
121
165
|
|
|
122
166
|
pub fn freeze_schema(&mut self) -> GraphRecordResult<()> {
|
|
123
167
|
let plugins = self.plugins.clone();
|
|
124
|
-
for plugin in plugins.iter() {
|
|
168
|
+
for (_, plugin) in plugins.iter() {
|
|
125
169
|
plugin.pre_freeze_schema(self)?;
|
|
126
170
|
}
|
|
127
171
|
|
|
128
172
|
self.graphrecord.freeze_schema();
|
|
129
173
|
|
|
130
|
-
for plugin in plugins.iter() {
|
|
174
|
+
for (_, plugin) in plugins.iter() {
|
|
131
175
|
plugin.post_freeze_schema(self)?;
|
|
132
176
|
}
|
|
133
177
|
|
|
@@ -136,13 +180,13 @@ impl PluginGraphRecord {
|
|
|
136
180
|
|
|
137
181
|
pub fn unfreeze_schema(&mut self) -> GraphRecordResult<()> {
|
|
138
182
|
let plugins = self.plugins.clone();
|
|
139
|
-
for plugin in plugins.iter() {
|
|
183
|
+
for (_, plugin) in plugins.iter() {
|
|
140
184
|
plugin.pre_unfreeze_schema(self)?;
|
|
141
185
|
}
|
|
142
186
|
|
|
143
187
|
self.graphrecord.unfreeze_schema();
|
|
144
188
|
|
|
145
|
-
for plugin in plugins.iter() {
|
|
189
|
+
for (_, plugin) in plugins.iter() {
|
|
146
190
|
plugin.post_unfreeze_schema(self)?;
|
|
147
191
|
}
|
|
148
192
|
|
|
@@ -162,7 +206,7 @@ impl PluginGraphRecord {
|
|
|
162
206
|
};
|
|
163
207
|
let pre_context = plugins
|
|
164
208
|
.iter()
|
|
165
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
209
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
166
210
|
plugin.pre_add_node(self, pre_context)
|
|
167
211
|
})?;
|
|
168
212
|
|
|
@@ -173,7 +217,7 @@ impl PluginGraphRecord {
|
|
|
173
217
|
|
|
174
218
|
plugins
|
|
175
219
|
.iter()
|
|
176
|
-
.try_for_each(|plugin| plugin.post_add_node(self, post_context.clone()))?;
|
|
220
|
+
.try_for_each(|(_, plugin)| plugin.post_add_node(self, post_context.clone()))?;
|
|
177
221
|
|
|
178
222
|
Ok(())
|
|
179
223
|
}
|
|
@@ -194,7 +238,7 @@ impl PluginGraphRecord {
|
|
|
194
238
|
};
|
|
195
239
|
let pre_context = plugins
|
|
196
240
|
.iter()
|
|
197
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
241
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
198
242
|
plugin.pre_add_node_with_group(self, pre_context)
|
|
199
243
|
})?;
|
|
200
244
|
|
|
@@ -206,9 +250,9 @@ impl PluginGraphRecord {
|
|
|
206
250
|
|
|
207
251
|
let post_context = PostAddNodeWithGroupContext { node_index, group };
|
|
208
252
|
|
|
209
|
-
plugins
|
|
210
|
-
.
|
|
211
|
-
|
|
253
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
254
|
+
plugin.post_add_node_with_group(self, post_context.clone())
|
|
255
|
+
})?;
|
|
212
256
|
|
|
213
257
|
Ok(())
|
|
214
258
|
}
|
|
@@ -221,7 +265,7 @@ impl PluginGraphRecord {
|
|
|
221
265
|
};
|
|
222
266
|
let pre_context = plugins
|
|
223
267
|
.iter()
|
|
224
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
268
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
225
269
|
plugin.pre_remove_node(self, pre_context)
|
|
226
270
|
})?;
|
|
227
271
|
|
|
@@ -233,7 +277,7 @@ impl PluginGraphRecord {
|
|
|
233
277
|
|
|
234
278
|
plugins
|
|
235
279
|
.iter()
|
|
236
|
-
.try_for_each(|plugin| plugin.post_remove_node(self, post_context.clone()))?;
|
|
280
|
+
.try_for_each(|(_, plugin)| plugin.post_remove_node(self, post_context.clone()))?;
|
|
237
281
|
|
|
238
282
|
Ok(attributes)
|
|
239
283
|
}
|
|
@@ -244,7 +288,7 @@ impl PluginGraphRecord {
|
|
|
244
288
|
let pre_context = PreAddNodesContext { nodes };
|
|
245
289
|
let pre_context = plugins
|
|
246
290
|
.iter()
|
|
247
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
291
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
248
292
|
plugin.pre_add_nodes(self, pre_context)
|
|
249
293
|
})?;
|
|
250
294
|
|
|
@@ -256,7 +300,7 @@ impl PluginGraphRecord {
|
|
|
256
300
|
|
|
257
301
|
plugins
|
|
258
302
|
.iter()
|
|
259
|
-
.try_for_each(|plugin| plugin.post_add_nodes(self, post_context.clone()))?;
|
|
303
|
+
.try_for_each(|(_, plugin)| plugin.post_add_nodes(self, post_context.clone()))?;
|
|
260
304
|
|
|
261
305
|
Ok(())
|
|
262
306
|
}
|
|
@@ -272,7 +316,7 @@ impl PluginGraphRecord {
|
|
|
272
316
|
let pre_context = PreAddNodesWithGroupContext { nodes, group };
|
|
273
317
|
let pre_context = plugins
|
|
274
318
|
.iter()
|
|
275
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
319
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
276
320
|
plugin.pre_add_nodes_with_group(self, pre_context)
|
|
277
321
|
})?;
|
|
278
322
|
|
|
@@ -284,9 +328,9 @@ impl PluginGraphRecord {
|
|
|
284
328
|
group: pre_context.group,
|
|
285
329
|
};
|
|
286
330
|
|
|
287
|
-
plugins
|
|
288
|
-
.
|
|
289
|
-
|
|
331
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
332
|
+
plugin.post_add_nodes_with_group(self, post_context.clone())
|
|
333
|
+
})?;
|
|
290
334
|
|
|
291
335
|
Ok(())
|
|
292
336
|
}
|
|
@@ -302,7 +346,7 @@ impl PluginGraphRecord {
|
|
|
302
346
|
};
|
|
303
347
|
let pre_context = plugins
|
|
304
348
|
.iter()
|
|
305
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
349
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
306
350
|
plugin.pre_add_nodes_dataframes(self, pre_context)
|
|
307
351
|
})?;
|
|
308
352
|
|
|
@@ -313,9 +357,9 @@ impl PluginGraphRecord {
|
|
|
313
357
|
nodes_dataframes: pre_context.nodes_dataframes,
|
|
314
358
|
};
|
|
315
359
|
|
|
316
|
-
plugins
|
|
317
|
-
.
|
|
318
|
-
|
|
360
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
361
|
+
plugin.post_add_nodes_dataframes(self, post_context.clone())
|
|
362
|
+
})?;
|
|
319
363
|
|
|
320
364
|
Ok(())
|
|
321
365
|
}
|
|
@@ -333,7 +377,7 @@ impl PluginGraphRecord {
|
|
|
333
377
|
};
|
|
334
378
|
let pre_context = plugins
|
|
335
379
|
.iter()
|
|
336
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
380
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
337
381
|
plugin.pre_add_nodes_dataframes_with_group(self, pre_context)
|
|
338
382
|
})?;
|
|
339
383
|
|
|
@@ -347,7 +391,7 @@ impl PluginGraphRecord {
|
|
|
347
391
|
group: pre_context.group,
|
|
348
392
|
};
|
|
349
393
|
|
|
350
|
-
plugins.iter().try_for_each(|plugin| {
|
|
394
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
351
395
|
plugin.post_add_nodes_dataframes_with_group(self, post_context.clone())
|
|
352
396
|
})?;
|
|
353
397
|
|
|
@@ -370,7 +414,7 @@ impl PluginGraphRecord {
|
|
|
370
414
|
};
|
|
371
415
|
let pre_context = plugins
|
|
372
416
|
.iter()
|
|
373
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
417
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
374
418
|
plugin.pre_add_edge(self, pre_context)
|
|
375
419
|
})?;
|
|
376
420
|
|
|
@@ -384,7 +428,7 @@ impl PluginGraphRecord {
|
|
|
384
428
|
|
|
385
429
|
plugins
|
|
386
430
|
.iter()
|
|
387
|
-
.try_for_each(|plugin| plugin.post_add_edge(self, post_context.clone()))?;
|
|
431
|
+
.try_for_each(|(_, plugin)| plugin.post_add_edge(self, post_context.clone()))?;
|
|
388
432
|
|
|
389
433
|
Ok(edge_index)
|
|
390
434
|
}
|
|
@@ -407,7 +451,7 @@ impl PluginGraphRecord {
|
|
|
407
451
|
};
|
|
408
452
|
let pre_context = plugins
|
|
409
453
|
.iter()
|
|
410
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
454
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
411
455
|
plugin.pre_add_edge_with_group(self, pre_context)
|
|
412
456
|
})?;
|
|
413
457
|
|
|
@@ -420,9 +464,9 @@ impl PluginGraphRecord {
|
|
|
420
464
|
|
|
421
465
|
let post_context = PostAddEdgeWithGroupContext { edge_index };
|
|
422
466
|
|
|
423
|
-
plugins
|
|
424
|
-
.
|
|
425
|
-
|
|
467
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
468
|
+
plugin.post_add_edge_with_group(self, post_context.clone())
|
|
469
|
+
})?;
|
|
426
470
|
|
|
427
471
|
Ok(edge_index)
|
|
428
472
|
}
|
|
@@ -435,7 +479,7 @@ impl PluginGraphRecord {
|
|
|
435
479
|
};
|
|
436
480
|
let pre_context = plugins
|
|
437
481
|
.iter()
|
|
438
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
482
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
439
483
|
plugin.pre_remove_edge(self, pre_context)
|
|
440
484
|
})?;
|
|
441
485
|
|
|
@@ -447,7 +491,7 @@ impl PluginGraphRecord {
|
|
|
447
491
|
|
|
448
492
|
plugins
|
|
449
493
|
.iter()
|
|
450
|
-
.try_for_each(|plugin| plugin.post_remove_edge(self, post_context.clone()))?;
|
|
494
|
+
.try_for_each(|(_, plugin)| plugin.post_remove_edge(self, post_context.clone()))?;
|
|
451
495
|
|
|
452
496
|
Ok(attributes)
|
|
453
497
|
}
|
|
@@ -461,7 +505,7 @@ impl PluginGraphRecord {
|
|
|
461
505
|
let pre_context = PreAddEdgesContext { edges };
|
|
462
506
|
let pre_context = plugins
|
|
463
507
|
.iter()
|
|
464
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
508
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
465
509
|
plugin.pre_add_edges(self, pre_context)
|
|
466
510
|
})?;
|
|
467
511
|
|
|
@@ -473,7 +517,7 @@ impl PluginGraphRecord {
|
|
|
473
517
|
|
|
474
518
|
plugins
|
|
475
519
|
.iter()
|
|
476
|
-
.try_for_each(|plugin| plugin.post_add_edges(self, post_context.clone()))?;
|
|
520
|
+
.try_for_each(|(_, plugin)| plugin.post_add_edges(self, post_context.clone()))?;
|
|
477
521
|
|
|
478
522
|
Ok(edge_indices)
|
|
479
523
|
}
|
|
@@ -491,7 +535,7 @@ impl PluginGraphRecord {
|
|
|
491
535
|
};
|
|
492
536
|
let pre_context = plugins
|
|
493
537
|
.iter()
|
|
494
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
538
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
495
539
|
plugin.pre_add_edges_with_group(self, pre_context)
|
|
496
540
|
})?;
|
|
497
541
|
|
|
@@ -503,9 +547,9 @@ impl PluginGraphRecord {
|
|
|
503
547
|
edge_indices: edge_indices.clone(),
|
|
504
548
|
};
|
|
505
549
|
|
|
506
|
-
plugins
|
|
507
|
-
.
|
|
508
|
-
|
|
550
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
551
|
+
plugin.post_add_edges_with_group(self, post_context.clone())
|
|
552
|
+
})?;
|
|
509
553
|
|
|
510
554
|
Ok(edge_indices)
|
|
511
555
|
}
|
|
@@ -521,7 +565,7 @@ impl PluginGraphRecord {
|
|
|
521
565
|
};
|
|
522
566
|
let pre_context = plugins
|
|
523
567
|
.iter()
|
|
524
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
568
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
525
569
|
plugin.pre_add_edges_dataframes(self, pre_context)
|
|
526
570
|
})?;
|
|
527
571
|
|
|
@@ -533,9 +577,9 @@ impl PluginGraphRecord {
|
|
|
533
577
|
edges_dataframes: pre_context.edges_dataframes,
|
|
534
578
|
};
|
|
535
579
|
|
|
536
|
-
plugins
|
|
537
|
-
.
|
|
538
|
-
|
|
580
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
581
|
+
plugin.post_add_edges_dataframes(self, post_context.clone())
|
|
582
|
+
})?;
|
|
539
583
|
|
|
540
584
|
Ok(edge_indices)
|
|
541
585
|
}
|
|
@@ -553,7 +597,7 @@ impl PluginGraphRecord {
|
|
|
553
597
|
};
|
|
554
598
|
let pre_context = plugins
|
|
555
599
|
.iter()
|
|
556
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
600
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
557
601
|
plugin.pre_add_edges_dataframes_with_group(self, pre_context)
|
|
558
602
|
})?;
|
|
559
603
|
|
|
@@ -567,7 +611,7 @@ impl PluginGraphRecord {
|
|
|
567
611
|
group: pre_context.group,
|
|
568
612
|
};
|
|
569
613
|
|
|
570
|
-
plugins.iter().try_for_each(|plugin| {
|
|
614
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
571
615
|
plugin.post_add_edges_dataframes_with_group(self, post_context.clone())
|
|
572
616
|
})?;
|
|
573
617
|
|
|
@@ -589,7 +633,7 @@ impl PluginGraphRecord {
|
|
|
589
633
|
};
|
|
590
634
|
let pre_context = plugins
|
|
591
635
|
.iter()
|
|
592
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
636
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
593
637
|
plugin.pre_add_group(self, pre_context)
|
|
594
638
|
})?;
|
|
595
639
|
|
|
@@ -607,7 +651,7 @@ impl PluginGraphRecord {
|
|
|
607
651
|
|
|
608
652
|
plugins
|
|
609
653
|
.iter()
|
|
610
|
-
.try_for_each(|plugin| plugin.post_add_group(self, post_context.clone()))?;
|
|
654
|
+
.try_for_each(|(_, plugin)| plugin.post_add_group(self, post_context.clone()))?;
|
|
611
655
|
|
|
612
656
|
Ok(())
|
|
613
657
|
}
|
|
@@ -620,7 +664,7 @@ impl PluginGraphRecord {
|
|
|
620
664
|
};
|
|
621
665
|
let pre_context = plugins
|
|
622
666
|
.iter()
|
|
623
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
667
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
624
668
|
plugin.pre_remove_group(self, pre_context)
|
|
625
669
|
})?;
|
|
626
670
|
|
|
@@ -632,7 +676,7 @@ impl PluginGraphRecord {
|
|
|
632
676
|
|
|
633
677
|
plugins
|
|
634
678
|
.iter()
|
|
635
|
-
.try_for_each(|plugin| plugin.post_remove_group(self, post_context.clone()))?;
|
|
679
|
+
.try_for_each(|(_, plugin)| plugin.post_remove_group(self, post_context.clone()))?;
|
|
636
680
|
|
|
637
681
|
Ok(())
|
|
638
682
|
}
|
|
@@ -647,7 +691,7 @@ impl PluginGraphRecord {
|
|
|
647
691
|
let pre_context = PreAddNodeToGroupContext { group, node_index };
|
|
648
692
|
let pre_context = plugins
|
|
649
693
|
.iter()
|
|
650
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
694
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
651
695
|
plugin.pre_add_node_to_group(self, pre_context)
|
|
652
696
|
})?;
|
|
653
697
|
|
|
@@ -659,9 +703,9 @@ impl PluginGraphRecord {
|
|
|
659
703
|
node_index: pre_context.node_index,
|
|
660
704
|
};
|
|
661
705
|
|
|
662
|
-
plugins
|
|
663
|
-
.
|
|
664
|
-
|
|
706
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
707
|
+
plugin.post_add_node_to_group(self, post_context.clone())
|
|
708
|
+
})?;
|
|
665
709
|
|
|
666
710
|
Ok(())
|
|
667
711
|
}
|
|
@@ -676,7 +720,7 @@ impl PluginGraphRecord {
|
|
|
676
720
|
let pre_context = PreAddEdgeToGroupContext { group, edge_index };
|
|
677
721
|
let pre_context = plugins
|
|
678
722
|
.iter()
|
|
679
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
723
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
680
724
|
plugin.pre_add_edge_to_group(self, pre_context)
|
|
681
725
|
})?;
|
|
682
726
|
|
|
@@ -688,9 +732,9 @@ impl PluginGraphRecord {
|
|
|
688
732
|
edge_index: pre_context.edge_index,
|
|
689
733
|
};
|
|
690
734
|
|
|
691
|
-
plugins
|
|
692
|
-
.
|
|
693
|
-
|
|
735
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
736
|
+
plugin.post_add_edge_to_group(self, post_context.clone())
|
|
737
|
+
})?;
|
|
694
738
|
|
|
695
739
|
Ok(())
|
|
696
740
|
}
|
|
@@ -708,7 +752,7 @@ impl PluginGraphRecord {
|
|
|
708
752
|
};
|
|
709
753
|
let pre_context = plugins
|
|
710
754
|
.iter()
|
|
711
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
755
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
712
756
|
plugin.pre_remove_node_from_group(self, pre_context)
|
|
713
757
|
})?;
|
|
714
758
|
|
|
@@ -720,7 +764,7 @@ impl PluginGraphRecord {
|
|
|
720
764
|
node_index: pre_context.node_index,
|
|
721
765
|
};
|
|
722
766
|
|
|
723
|
-
plugins.iter().try_for_each(|plugin| {
|
|
767
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
724
768
|
plugin.post_remove_node_from_group(self, post_context.clone())
|
|
725
769
|
})?;
|
|
726
770
|
|
|
@@ -740,7 +784,7 @@ impl PluginGraphRecord {
|
|
|
740
784
|
};
|
|
741
785
|
let pre_context = plugins
|
|
742
786
|
.iter()
|
|
743
|
-
.try_fold(pre_context, |pre_context, plugin| {
|
|
787
|
+
.try_fold(pre_context, |pre_context, (_, plugin)| {
|
|
744
788
|
plugin.pre_remove_edge_from_group(self, pre_context)
|
|
745
789
|
})?;
|
|
746
790
|
|
|
@@ -752,7 +796,7 @@ impl PluginGraphRecord {
|
|
|
752
796
|
edge_index: pre_context.edge_index,
|
|
753
797
|
};
|
|
754
798
|
|
|
755
|
-
plugins.iter().try_for_each(|plugin| {
|
|
799
|
+
plugins.iter().try_for_each(|(_, plugin)| {
|
|
756
800
|
plugin.post_remove_edge_from_group(self, post_context.clone())
|
|
757
801
|
})?;
|
|
758
802
|
|
|
@@ -762,13 +806,13 @@ impl PluginGraphRecord {
|
|
|
762
806
|
pub fn clear(&mut self) -> GraphRecordResult<()> {
|
|
763
807
|
let plugins = self.plugins.clone();
|
|
764
808
|
|
|
765
|
-
for plugin in plugins.iter() {
|
|
809
|
+
for (_, plugin) in plugins.iter() {
|
|
766
810
|
plugin.pre_clear(self)?;
|
|
767
811
|
}
|
|
768
812
|
|
|
769
813
|
self.graphrecord.clear();
|
|
770
814
|
|
|
771
|
-
for plugin in plugins.iter() {
|
|
815
|
+
for (_, plugin) in plugins.iter() {
|
|
772
816
|
plugin.post_clear(self)?;
|
|
773
817
|
}
|
|
774
818
|
|
{graphrecords-0.2.0 → graphrecords-0.3.0}/crates/graphrecords-core/src/graphrecord/plugins/mod.rs
RENAMED
|
@@ -5,7 +5,7 @@ use crate::{
|
|
|
5
5
|
graphrecord::{EdgeDataFrameInput, NodeDataFrameInput},
|
|
6
6
|
prelude::{Attributes, EdgeIndex, Group, NodeIndex, Schema},
|
|
7
7
|
};
|
|
8
|
-
pub use graphrecord::PluginGraphRecord;
|
|
8
|
+
pub use graphrecord::{PluginGraphRecord, PluginName};
|
|
9
9
|
use std::fmt::Debug;
|
|
10
10
|
|
|
11
11
|
#[derive(Debug, Clone)]
|
|
@@ -244,11 +244,15 @@ pub struct PostRemoveEdgeFromGroupContext {
|
|
|
244
244
|
#[cfg_attr(feature = "serde", typetag::serde(tag = "type"))]
|
|
245
245
|
#[allow(unused_variables)]
|
|
246
246
|
pub trait Plugin: Debug + Send + Sync {
|
|
247
|
+
fn clone_box(&self) -> Box<dyn Plugin>;
|
|
248
|
+
|
|
247
249
|
fn initialize(&self, graphrecord: &mut PluginGraphRecord) -> GraphRecordResult<()> {
|
|
248
250
|
Ok(())
|
|
249
251
|
}
|
|
250
252
|
|
|
251
|
-
fn
|
|
253
|
+
fn finalize(&self, graphrecord: &mut PluginGraphRecord) -> GraphRecordResult<()> {
|
|
254
|
+
Ok(())
|
|
255
|
+
}
|
|
252
256
|
|
|
253
257
|
fn pre_set_schema(
|
|
254
258
|
&self,
|