refactor: add CompactorHandlerImpl::new_with_compactor
This will allow us to refactor the code a level up to create a `Compactor` directly.pull/24376/head
parent
463a13b814
commit
cc061b6ce9
|
@ -75,16 +75,21 @@ impl CompactorHandlerImpl {
|
||||||
registry: Arc<metric::Registry>,
|
registry: Arc<metric::Registry>,
|
||||||
config: CompactorConfig,
|
config: CompactorConfig,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let compactor_data = Arc::new(Compactor::new(
|
Self::new_with_compactor(Compactor::new(
|
||||||
sequencers,
|
sequencers,
|
||||||
catalog,
|
catalog,
|
||||||
store,
|
store,
|
||||||
Arc::clone(&exec),
|
exec,
|
||||||
time_provider,
|
time_provider,
|
||||||
BackoffConfig::default(),
|
BackoffConfig::default(),
|
||||||
config,
|
config,
|
||||||
registry,
|
registry,
|
||||||
));
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initialize the Compactor
|
||||||
|
pub fn new_with_compactor(compactor: Compactor) -> Self {
|
||||||
|
let compactor_data = Arc::new(compactor);
|
||||||
|
|
||||||
let shutdown = CancellationToken::new();
|
let shutdown = CancellationToken::new();
|
||||||
let runner_handle = tokio::task::spawn(run_compactor(
|
let runner_handle = tokio::task::spawn(run_compactor(
|
||||||
|
@ -92,7 +97,9 @@ impl CompactorHandlerImpl {
|
||||||
shutdown.child_token(),
|
shutdown.child_token(),
|
||||||
));
|
));
|
||||||
let runner_handle = shared_handle(runner_handle);
|
let runner_handle = shared_handle(runner_handle);
|
||||||
info!("compactor started with config {:?}", config);
|
info!("compactor started with config {:?}", compactor_data.config);
|
||||||
|
|
||||||
|
let exec = Arc::clone(&compactor_data.exec);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
compactor_data,
|
compactor_data,
|
||||||
|
|
Loading…
Reference in New Issue