@@ -2,20 +2,46 @@ use raphtory_core::entities::properties::graph_meta::GraphMeta;
22use std:: path:: Path ;
33use std:: sync:: Arc ;
44use std:: sync:: atomic:: AtomicUsize ;
5- use crate :: api:: graph_props:: GraphPropSegmentOps ;
5+ use crate :: api:: graph_props:: { GraphPropSegmentOps , GraphPropOps } ;
66use crate :: error:: StorageError ;
77use parking_lot:: RwLock ;
8+ use raphtory_core:: entities:: properties:: props:: MetadataError ;
9+ use raphtory_core:: storage:: locked_view:: LockedView ;
10+ use raphtory_core:: entities:: properties:: tprop:: { TProp , IllegalPropType } ;
11+ use raphtory_core:: storage:: timeindex:: TimeIndexEntry ;
12+ use raphtory_api:: core:: entities:: properties:: prop:: Prop ;
13+ use crate :: properties:: Properties ;
814
15+ /// In-memory segment that contains graph temporal properties and graph metadata.
16+ #[ derive( Debug ) ]
17+ pub struct MemGraphPropSegment {
18+ properties : Properties ,
19+ }
20+
21+ impl MemGraphPropSegment {
22+ pub fn new ( ) -> Self {
23+ Self {
24+ properties : Properties :: default ( ) ,
25+ }
26+ }
27+ }
28+
29+ /// `GraphPropSegmentView` manages graph temporal properties and graph metadata
30+ /// (constant properties). Reads / writes are always served from the in-memory segment.
931#[ derive( Debug ) ]
1032pub struct GraphPropSegmentView {
11- head : Arc < RwLock < GraphMeta > > ,
33+ /// In-memory segment that contains the latest graph properties
34+ /// and graph metadata writes.
35+ head : Arc < RwLock < MemGraphPropSegment > > ,
36+
37+ /// Estimated size of the segment in bytes.
1238 est_size : AtomicUsize ,
1339}
1440
1541impl GraphPropSegmentOps for GraphPropSegmentView {
1642 fn new ( ) -> Self {
1743 Self {
18- head : Arc :: new ( RwLock :: new ( GraphMeta :: new ( ) ) ) ,
44+ head : Arc :: new ( RwLock :: new ( MemGraphPropSegment :: new ( ) ) ) ,
1945 est_size : AtomicUsize :: new ( 0 ) ,
2046 }
2147 }
@@ -24,3 +50,25 @@ impl GraphPropSegmentOps for GraphPropSegmentView {
2450 todo ! ( )
2551 }
2652}
53+
54+ impl GraphPropOps for GraphPropSegmentView {
55+ fn get_temporal_prop ( & self , prop_id : usize ) -> Option < LockedView < ' _ , TProp > > {
56+ todo ! ( )
57+ }
58+
59+ fn add_prop ( & self , t : TimeIndexEntry , prop_id : usize , prop : Prop ) -> Result < ( ) , IllegalPropType > {
60+ todo ! ( )
61+ }
62+
63+ fn get_metadata ( & self , id : usize ) -> Option < Prop > {
64+ todo ! ( )
65+ }
66+
67+ fn add_metadata ( & self , prop_id : usize , prop : Prop ) -> Result < ( ) , MetadataError > {
68+ todo ! ( )
69+ }
70+
71+ fn update_metadata ( & self , prop_id : usize , prop : Prop ) {
72+ todo ! ( )
73+ }
74+ }
0 commit comments