@@ -12,16 +12,11 @@ use libsql_wal::storage::backend::s3::S3Backend;
12
12
use libsql_wal:: storage:: backend:: Backend ;
13
13
use libsql_wal:: storage:: compaction:: strategy:: identity:: IdentityStrategy ;
14
14
use 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 ;
16
17
use libsql_wal:: storage:: compaction:: Compactor ;
17
18
use rusqlite:: OpenFlags ;
18
19
19
- #[ derive( Clone , Debug , clap:: ValueEnum , Copy ) ]
20
- pub enum CompactStrategy {
21
- Logarithmic ,
22
- CompactAll ,
23
- }
24
-
25
20
#[ derive( Debug , clap:: Subcommand ) ]
26
21
pub enum WalToolkitCommand {
27
22
Monitor ( MonitorCommand ) ,
@@ -119,6 +114,13 @@ impl SyncCommand {
119
114
}
120
115
}
121
116
117
+ #[ derive( Clone , Debug , clap:: ValueEnum , Copy ) ]
118
+ pub enum CompactStrategy {
119
+ Logarithmic ,
120
+ CompactAll ,
121
+ Tiered ,
122
+ }
123
+
122
124
#[ derive( Debug , clap:: Args ) ]
123
125
/// Compact segments into bigger segments
124
126
pub struct CompactCommand {
@@ -168,10 +170,12 @@ impl CompactCommand {
168
170
namespace : & NamespaceName ,
169
171
) -> anyhow:: Result < ( ) > {
170
172
let analysis = compactor. analyze ( & namespace) ?;
171
- let strat: Box < dyn PartitionStrategy > = match self . strategy {
173
+ let strat: Box < dyn CompactionStrategy > = match self . strategy {
172
174
CompactStrategy :: Logarithmic => Box :: new ( LogReductionStrategy ) ,
173
175
CompactStrategy :: CompactAll => Box :: new ( IdentityStrategy ) ,
176
+ CompactStrategy :: Tiered => Box :: new ( LevelsStrategy :: new ( self . threshold ) ) ,
174
177
} ;
178
+
175
179
let set = analysis. shortest_restore_path ( ) ;
176
180
if set. len ( ) <= self . threshold {
177
181
println ! (
0 commit comments