2018-04-06 15:59:54 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <future>
|
|
|
|
#include <mutex>
|
|
|
|
#include <utility>
|
|
|
|
|
2018-09-27 21:07:46 +08:00
|
|
|
#include "distributed/coordination.hpp"
|
2018-10-04 21:23:07 +08:00
|
|
|
#include "durability/distributed/recovery.hpp"
|
|
|
|
#include "storage/distributed/gid.hpp"
|
2018-04-06 15:59:54 +08:00
|
|
|
#include "transactions/type.hpp"
|
|
|
|
|
|
|
|
namespace distributed {
|
|
|
|
|
|
|
|
/// Provides an ability to trigger snapshooting on other workers.
|
2018-07-17 17:03:03 +08:00
|
|
|
class DurabilityRpcMaster {
|
2018-04-06 15:59:54 +08:00
|
|
|
public:
|
2018-09-27 21:07:46 +08:00
|
|
|
explicit DurabilityRpcMaster(Coordination *coordination)
|
|
|
|
: coordination_(coordination) {}
|
2018-04-06 15:59:54 +08:00
|
|
|
|
|
|
|
// Sends a snapshot request to workers and returns a future which becomes true
|
|
|
|
// if all workers sucesfully completed their snapshot creation, false
|
|
|
|
// otherwise
|
|
|
|
// @param tx - transaction from which to take db snapshot
|
2018-04-19 21:32:41 +08:00
|
|
|
utils::Future<bool> MakeSnapshot(tx::TransactionId tx);
|
2018-04-06 15:59:54 +08:00
|
|
|
|
2018-07-17 17:03:03 +08:00
|
|
|
utils::Future<bool> RecoverWalAndIndexes(
|
|
|
|
durability::RecoveryData *recovery_data);
|
|
|
|
|
2018-04-06 15:59:54 +08:00
|
|
|
private:
|
2018-09-27 21:07:46 +08:00
|
|
|
Coordination *coordination_;
|
2018-04-06 15:59:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace distributed
|