1+ use crate :: mutation:: {
2+ addition_ops:: { EdgeWriteLock , InternalAdditionOps , SessionAdditionOps } ,
3+ MutationError ,
4+ } ;
15use db4_graph:: { TemporalGraph , TransactionManager , WriteLockedGraph } ;
26use raphtory_api:: core:: {
37 entities:: properties:: {
@@ -15,18 +19,14 @@ use raphtory_core::{
1519 storage:: timeindex:: TimeIndexEntry ,
1620} ;
1721use storage:: {
22+ api:: { edges:: EdgeSegmentOps , nodes:: NodeSegmentOps } ,
1823 pages:: { node_page:: writer:: node_info_as_props, session:: WriteSession } ,
1924 persist:: strategy:: PersistentStrategy ,
2025 properties:: props_meta_writer:: PropsMetaWriter ,
2126 resolver:: GIDResolverOps ,
2227 Extension , WalImpl , ES , NS ,
2328} ;
2429
25- use crate :: mutation:: {
26- addition_ops:: { EdgeWriteLock , InternalAdditionOps , SessionAdditionOps } ,
27- MutationError ,
28- } ;
29-
3030pub struct WriteS < ' a , EXT : PersistentStrategy < NS = NS < EXT > , ES = ES < EXT > > > {
3131 static_session : WriteSession < ' a , NS < EXT > , ES < EXT > , EXT > ,
3232}
@@ -223,6 +223,16 @@ impl InternalAdditionOps for TemporalGraph {
223223 if id > MAX_LAYER {
224224 Err ( TooManyLayers ) ?;
225225 }
226+ let edge_segment = self . storage ( ) . edges ( ) . get_or_create_segment ( 0 ) ;
227+ let mut edge_segment_head = edge_segment. head_mut ( ) ;
228+ edge_segment_head. get_or_create_layer ( id) ;
229+ edge_segment. notify_write ( edge_segment_head) ?;
230+
231+ let node_segment = self . storage ( ) . nodes ( ) . get_or_create_segment ( 0 ) ;
232+
233+ let mut node_segment_head = node_segment. head_mut ( ) ;
234+ node_segment_head. get_or_create_layer ( id) ;
235+ node_segment. notify_write ( node_segment_head) ?;
226236 }
227237 Ok ( id)
228238 }
0 commit comments