@@ -7,6 +7,8 @@ use crate::segments::graph::entry::MemGraphEntry;
77use crate :: segments:: { HasRow , SegmentContainer } ;
88use parking_lot:: RwLock ;
99use raphtory_api:: core:: entities:: properties:: meta:: Meta ;
10+ use raphtory_core:: storage:: timeindex:: TimeIndexEntry ;
11+ use raphtory_api:: core:: entities:: properties:: prop:: Prop ;
1012
1113/// In-memory segment that contains graph temporal properties and graph metadata.
1214#[ derive( Debug ) ]
@@ -32,6 +34,12 @@ impl HasRow for GraphSegmentEntry {
3234}
3335
3436impl MemGraphSegment {
37+ /// Graph segments only have a single row.
38+ pub const ROW : usize = 0 ;
39+
40+ /// Graph segments are currently only written to a single layer.
41+ pub const LAYER : usize = 0 ;
42+
3543 pub fn new ( ) -> Self {
3644 // Technically, these aren't used since there is always only one graph segment.
3745 let segment_id = 0 ;
@@ -46,4 +54,22 @@ impl MemGraphSegment {
4654 pub fn layers ( & self ) -> & [ SegmentContainer < GraphSegmentEntry > ] {
4755 & self . layers
4856 }
57+
58+ pub fn add_properties ( & mut self , t : TimeIndexEntry , props : impl IntoIterator < Item = ( usize , Prop ) > ) {
59+ let layer = & mut self . layers [ Self :: LAYER ] ;
60+
61+ layer. properties_mut ( ) . get_mut_entry ( Self :: ROW ) . append_t_props ( t, props) ;
62+ }
63+
64+ pub fn add_metadata ( & mut self , props : impl IntoIterator < Item = ( usize , Prop ) > ) {
65+ let layer = & mut self . layers [ Self :: LAYER ] ;
66+
67+ layer. properties_mut ( ) . get_mut_entry ( Self :: ROW ) . append_const_props ( props) ;
68+ }
69+
70+ pub fn update_metadata ( & mut self , props : impl IntoIterator < Item = ( usize , Prop ) > ) {
71+ let layer = & mut self . layers [ Self :: LAYER ] ;
72+
73+ layer. properties_mut ( ) . get_mut_entry ( Self :: ROW ) . append_const_props ( props) ;
74+ }
4975}
0 commit comments