@@ -26,6 +26,7 @@ use std::time::Duration;
26
26
use std:: { fmt, io} ;
27
27
28
28
use crate :: blockchain:: Block ;
29
+ use crate :: components:: store:: write:: EntityModification ;
29
30
use crate :: data:: store:: scalar:: Bytes ;
30
31
use crate :: data:: store:: * ;
31
32
use crate :: data:: value:: Word ;
@@ -723,7 +724,7 @@ impl StoreEvent {
723
724
let changes: Vec < _ > = mods
724
725
. into_iter ( )
725
726
. map ( |op| {
726
- use self :: EntityModification :: * ;
727
+ use EntityModification :: * ;
727
728
match op {
728
729
Insert { key, .. } | Overwrite { key, .. } | Remove { key, .. } => {
729
730
EntityChange :: for_data ( subgraph_id. clone ( ) , key. clone ( ) )
@@ -1002,75 +1003,6 @@ impl Display for DeploymentLocator {
1002
1003
// connection checkouts
1003
1004
pub type PoolWaitStats = Arc < RwLock < MovingStats > > ;
1004
1005
1005
- /// An entity operation that can be transacted into the store; as opposed to
1006
- /// `EntityOperation`, we already know whether a `Set` should be an `Insert`
1007
- /// or `Update`
1008
- #[ derive( Clone , Debug , PartialEq , Eq ) ]
1009
- pub enum EntityModification {
1010
- /// Insert the entity
1011
- Insert {
1012
- key : EntityKey ,
1013
- data : Entity ,
1014
- block : BlockNumber ,
1015
- end : Option < BlockNumber > ,
1016
- } ,
1017
- /// Update the entity by overwriting it
1018
- Overwrite {
1019
- key : EntityKey ,
1020
- data : Entity ,
1021
- block : BlockNumber ,
1022
- end : Option < BlockNumber > ,
1023
- } ,
1024
- /// Remove the entity
1025
- Remove { key : EntityKey , block : BlockNumber } ,
1026
- }
1027
-
1028
- impl EntityModification {
1029
- pub fn insert ( key : EntityKey , data : Entity , block : BlockNumber ) -> Self {
1030
- EntityModification :: Insert {
1031
- key,
1032
- data,
1033
- block,
1034
- end : None ,
1035
- }
1036
- }
1037
-
1038
- pub fn overwrite ( key : EntityKey , data : Entity , block : BlockNumber ) -> Self {
1039
- EntityModification :: Overwrite {
1040
- key,
1041
- data,
1042
- block,
1043
- end : None ,
1044
- }
1045
- }
1046
-
1047
- pub fn remove ( key : EntityKey , block : BlockNumber ) -> Self {
1048
- EntityModification :: Remove { key, block }
1049
- }
1050
-
1051
- pub fn entity_ref ( & self ) -> & EntityKey {
1052
- use EntityModification :: * ;
1053
- match self {
1054
- Insert { key, .. } | Overwrite { key, .. } | Remove { key, .. } => key,
1055
- }
1056
- }
1057
-
1058
- pub fn entity ( & self ) -> Option < & Entity > {
1059
- match self {
1060
- EntityModification :: Insert { data, .. }
1061
- | EntityModification :: Overwrite { data, .. } => Some ( data) ,
1062
- EntityModification :: Remove { .. } => None ,
1063
- }
1064
- }
1065
-
1066
- pub fn is_remove ( & self ) -> bool {
1067
- match self {
1068
- EntityModification :: Remove { .. } => true ,
1069
- _ => false ,
1070
- }
1071
- }
1072
- }
1073
-
1074
1006
/// A representation of entity operations that can be accumulated.
1075
1007
#[ derive( Debug , Clone ) ]
1076
1008
enum EntityOp {
0 commit comments