2019-05-12 11:18:59 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
|
|
#include "index.h"
|
|
|
|
|
|
|
|
|
|
namespace firesse {
|
|
|
|
|
|
|
|
|
|
class KeepAlive {
|
|
|
|
|
public:
|
|
|
|
|
KeepAlive(const std::chrono::nanoseconds& max_stale, Index* index);
|
2019-05-12 13:49:23 -07:00
|
|
|
~KeepAlive();
|
|
|
|
|
|
2019-05-12 11:18:59 -07:00
|
|
|
void Start();
|
|
|
|
|
void Stop();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const std::chrono::nanoseconds max_stale_;
|
|
|
|
|
Index* index_;
|
|
|
|
|
int shutdown_;
|
|
|
|
|
|
|
|
|
|
std::thread thread_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace firesse
|