44 lines
848 B
C++
44 lines
848 B
C++
//
|
|
// Created by Kirill Zhukov on 20.04.2025.
|
|
//
|
|
|
|
#ifndef COMPACTOR_H
|
|
#define COMPACTOR_H
|
|
|
|
#include <atomic>
|
|
#include <vector>
|
|
#include <string>
|
|
#include "utils/datastructures/LFSkipList.h"
|
|
#include "utils/io/SSTableIO.h"
|
|
#include "utils/hash/Hash128.h"
|
|
|
|
namespace usub::utils
|
|
{
|
|
class Compactor
|
|
{
|
|
public:
|
|
explicit Compactor(VersionManager& vm);
|
|
|
|
void add_sstable_l0(const std::string& filename);
|
|
|
|
|
|
void run();
|
|
|
|
private:
|
|
void compact_level0();
|
|
|
|
void compact_level1();
|
|
|
|
private:
|
|
std::vector<std::string> level0_files;
|
|
std::vector<std::string> level1_files;
|
|
std::vector<std::string> level2_files;
|
|
std::atomic<bool> running{true};
|
|
std::thread background_thread;
|
|
VersionManager& version_manager;
|
|
}; // utils
|
|
} // usub
|
|
|
|
|
|
#endif //COMPACTOR_H
|