memgraph/include/dbms/cleaner.hpp

29 lines
606 B
C++
Raw Normal View History

#pragma once
#include "database/db.hpp"
2016-09-08 20:25:52 +08:00
#include "threading/thread.hpp"
class Thread;
class Cleaning
{
public:
2016-09-08 20:25:52 +08:00
// How much sec is a cleaning_cycle in which cleaner will clean at most
// once. Starts cleaner thread.
2016-09-08 20:25:52 +08:00
Cleaning(ConcurrentMap<std::string, Db> &dbs, size_t cleaning_cycle);
// Destroys this object after this thread joins cleaning thread.
~Cleaning();
private:
ConcurrentMap<std::string, Db> &dbms;
2016-09-08 20:25:52 +08:00
const size_t cleaning_cycle;
std::vector<std::unique_ptr<Thread>> cleaners;
// Should i continue cleaning.
std::atomic<bool> cleaning = {true};
};