@@ -12,16 +12,11 @@ use libsql_wal::storage::backend::s3::S3Backend;
1212use libsql_wal:: storage:: backend:: Backend ;
1313use libsql_wal:: storage:: compaction:: strategy:: identity:: IdentityStrategy ;
1414use libsql_wal:: storage:: compaction:: strategy:: log_strategy:: LogReductionStrategy ;
15- use libsql_wal:: storage:: compaction:: strategy:: PartitionStrategy ;
15+ use libsql_wal:: storage:: compaction:: strategy:: tiered:: LevelsStrategy ;
16+ use libsql_wal:: storage:: compaction:: strategy:: CompactionStrategy ;
1617use libsql_wal:: storage:: compaction:: Compactor ;
1718use rusqlite:: OpenFlags ;
1819
19- #[ derive( Clone , Debug , clap:: ValueEnum , Copy ) ]
20- pub enum CompactStrategy {
21- Logarithmic ,
22- CompactAll ,
23- }
24-
2520#[ derive( Debug , clap:: Subcommand ) ]
2621pub enum WalToolkitCommand {
2722 Monitor ( MonitorCommand ) ,
@@ -119,6 +114,13 @@ impl SyncCommand {
119114 }
120115}
121116
117+ #[ derive( Clone , Debug , clap:: ValueEnum , Copy ) ]
118+ pub enum CompactStrategy {
119+ Logarithmic ,
120+ CompactAll ,
121+ Tiered ,
122+ }
123+
122124#[ derive( Debug , clap:: Args ) ]
123125/// Compact segments into bigger segments
124126pub struct CompactCommand {
@@ -168,10 +170,12 @@ impl CompactCommand {
168170 namespace : & NamespaceName ,
169171 ) -> anyhow:: Result < ( ) > {
170172 let analysis = compactor. analyze ( & namespace) ?;
171- let strat: Box < dyn PartitionStrategy > = match self . strategy {
173+ let strat: Box < dyn CompactionStrategy > = match self . strategy {
172174 CompactStrategy :: Logarithmic => Box :: new ( LogReductionStrategy ) ,
173175 CompactStrategy :: CompactAll => Box :: new ( IdentityStrategy ) ,
176+ CompactStrategy :: Tiered => Box :: new ( LevelsStrategy :: new ( self . threshold ) ) ,
174177 } ;
178+
175179 let set = analysis. shortest_restore_path ( ) ;
176180 if set. len ( ) <= self . threshold {
177181 println ! (
0 commit comments