@@ -18,7 +18,7 @@ mod writer;
1818#[ derive( Clone , Debug ) ]
1919pub struct LsmConfig {
2020 pub flush_threshold : usize ,
21- pub sstable_path : String ,
21+ pub sstable_path : path :: PathBuf ,
2222}
2323
2424#[ derive( Clone ) ]
@@ -99,7 +99,7 @@ impl Lsm {
9999 let offset = dense_index. get ( & key. to_string ( ) ) . unwrap ( ) ;
100100 Ok ( sstable:: Segment :: read_with_offset (
101101 offset. to_string ( ) ,
102- self . lsm_config . sstable_path . to_string ( ) ,
102+ & self . lsm_config . sstable_path ,
103103 ) )
104104 }
105105 }
@@ -164,8 +164,7 @@ impl Lsm {
164164
165165 let mut dense_index = self . dense_index . lock ( ) . unwrap ( ) ;
166166
167- let segments =
168- sstable:: Segment :: from_tree ( & memtable, self . lsm_config . sstable_path . as_str ( ) ) ;
167+ let segments = sstable:: Segment :: from_tree ( & memtable, & self . lsm_config . sstable_path ) ;
169168
170169 for token in segments. 1 {
171170 dense_index. insert ( token. 0 , token. 1 ) ;
@@ -230,9 +229,9 @@ impl Lsm {
230229 }
231230
232231 pub fn load_snapshot ( path : path:: PathBuf , snapshot : Snapshot ) {
233- sstable:: Segment :: from_tree ( snapshot. get_memtable ( ) , & path. display ( ) . to_string ( ) ) ;
234- index:: write_index ( & path. display ( ) . to_string ( ) , snapshot. get_dense_index ( ) ) ;
235- filter:: write_filter ( & path. display ( ) . to_string ( ) , snapshot. get_bloom_filter ( ) ) ;
232+ sstable:: Segment :: from_tree ( snapshot. get_memtable ( ) , & path) ;
233+ index:: write_index ( & path, snapshot. get_dense_index ( ) ) ;
234+ filter:: write_filter ( & path, snapshot. get_bloom_filter ( ) ) ;
236235 }
237236}
238237
@@ -245,8 +244,7 @@ impl Drop for Lsm {
245244 return ;
246245 }
247246
248- let segments =
249- sstable:: Segment :: from_tree ( memtable. deref ( ) , self . lsm_config . sstable_path . as_str ( ) ) ;
247+ let segments = sstable:: Segment :: from_tree ( memtable. deref ( ) , & self . lsm_config . sstable_path ) ;
250248
251249 for token in segments. 1 {
252250 dense_index. insert ( token. 0 , token. 1 ) ;
0 commit comments