1- use std:: collections:: { BTreeSet , HashMap } ;
2- use std:: fs:: File ;
1+ #![ allow( dead_code) ] // REMOVE THIS LINE after fully implementing this functionality
2+
3+ use std:: collections:: HashMap ;
34use std:: ops:: Bound ;
45use std:: path:: { Path , PathBuf } ;
56use std:: sync:: atomic:: AtomicUsize ;
67use std:: sync:: Arc ;
78
8- use anyhow:: { Context , Result } ;
9+ use anyhow:: Result ;
910use bytes:: Bytes ;
1011use parking_lot:: { Mutex , RwLock } ;
1112
1213use crate :: block:: Block ;
1314use crate :: compact:: {
14- CompactionController , CompactionOptions , LeveledCompactionController , LeveledCompactionOptions ,
15- SimpleLeveledCompactionController , SimpleLeveledCompactionOptions , TieredCompactionController ,
15+ CompactionController , CompactionOptions , LeveledCompactionOptions ,
16+ SimpleLeveledCompactionOptions ,
1617} ;
17- use crate :: iterators:: merge_iterator:: MergeIterator ;
18- use crate :: iterators:: two_merge_iterator:: TwoMergeIterator ;
19- use crate :: iterators:: StorageIterator ;
2018use crate :: lsm_iterator:: { FusedIterator , LsmIterator } ;
21- use crate :: manifest:: { Manifest , ManifestRecord } ;
22- use crate :: mem_table:: { map_bound , MemTable } ;
23- use crate :: table:: { FileObject , SsTable , SsTableBuilder , SsTableIterator } ;
19+ use crate :: manifest:: Manifest ;
20+ use crate :: mem_table:: MemTable ;
21+ use crate :: table:: SsTable ;
2422
2523pub type BlockCache = moka:: sync:: Cache < ( usize , usize ) , Arc < Block > > ;
2624
@@ -108,7 +106,7 @@ impl MiniLsm {
108106 unimplemented ! ( )
109107 }
110108
111- pub fn open ( path : impl AsRef < Path > , options : LsmStorageOptions ) -> Result < Arc < Self > > {
109+ pub fn open ( _path : impl AsRef < Path > , _options : LsmStorageOptions ) -> Result < Arc < Self > > {
112110 unimplemented ! ( )
113111 }
114112
@@ -136,6 +134,10 @@ impl MiniLsm {
136134 self . inner . force_freeze_memtable ( ) ?;
137135 self . inner . force_flush_next_imm_memtable ( )
138136 }
137+
138+ pub fn force_full_compaction ( & self ) -> Result < ( ) > {
139+ self . inner . force_full_compaction ( )
140+ }
139141}
140142
141143impl LsmStorageInner {
@@ -144,22 +146,22 @@ impl LsmStorageInner {
144146 . fetch_add ( 1 , std:: sync:: atomic:: Ordering :: SeqCst )
145147 }
146148
147- pub ( crate ) fn open ( path : impl AsRef < Path > , options : LsmStorageOptions ) -> Result < Self > {
149+ pub ( crate ) fn open ( _path : impl AsRef < Path > , _options : LsmStorageOptions ) -> Result < Self > {
148150 unimplemented ! ( )
149151 }
150152
151153 /// Get a key from the storage. In day 7, this can be further optimized by using a bloom filter.
152- pub fn get ( & self , key : & [ u8 ] ) -> Result < Option < Bytes > > {
154+ pub fn get ( & self , _key : & [ u8 ] ) -> Result < Option < Bytes > > {
153155 unimplemented ! ( )
154156 }
155157
156158 /// Put a key-value pair into the storage by writing into the current memtable.
157- pub fn put ( & self , key : & [ u8 ] , value : & [ u8 ] ) -> Result < ( ) > {
159+ pub fn put ( & self , _key : & [ u8 ] , _value : & [ u8 ] ) -> Result < ( ) > {
158160 unimplemented ! ( )
159161 }
160162
161163 /// Remove a key from the storage by writing an empty value.
162- pub fn delete ( & self , key : & [ u8 ] ) -> Result < ( ) > {
164+ pub fn delete ( & self , _key : & [ u8 ] ) -> Result < ( ) > {
163165 unimplemented ! ( )
164166 }
165167
@@ -196,8 +198,8 @@ impl LsmStorageInner {
196198 /// Create an iterator over a range of keys.
197199 pub fn scan (
198200 & self ,
199- lower : Bound < & [ u8 ] > ,
200- upper : Bound < & [ u8 ] > ,
201+ _lower : Bound < & [ u8 ] > ,
202+ _upper : Bound < & [ u8 ] > ,
201203 ) -> Result < FusedIterator < LsmIterator > > {
202204 unimplemented ! ( )
203205 }
0 commit comments