typesense/include/housekeeper.h
Kishore Nallan b1805978b6 Do explicit compaction instead of automatic periodic compaction.
This is required until RocksDB fixes the behavior of periodic compaction seconds: https://github.com/facebook/rocksdb/issues/12165
2023-12-27 17:26:30 +05:30

36 lines
609 B
C++

#pragma once
#include <mutex>
#include <atomic>
#include <condition_variable>
class HouseKeeper {
private:
mutable std::mutex mutex;
std::condition_variable cv;
std::atomic<bool> quit = false;
std::atomic<uint32_t> hnsw_repair_interval_s = 1800;
HouseKeeper() {}
~HouseKeeper() {}
public:
static HouseKeeper &get_instance() {
static HouseKeeper instance;
return instance;
}
HouseKeeper(HouseKeeper const &) = delete;
void operator=(HouseKeeper const &) = delete;
void init(uint32_t interval_seconds);
void run();
void stop();
};