2018-04-06 15:59:54 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <future>
|
|
|
|
#include <mutex>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "distributed/rpc_worker_clients.hpp"
|
|
|
|
#include "storage/gid.hpp"
|
|
|
|
#include "transactions/type.hpp"
|
|
|
|
|
|
|
|
namespace distributed {
|
|
|
|
|
|
|
|
/// Provides an ability to trigger snapshooting on other workers.
|
|
|
|
class DurabilityRpcClients {
|
|
|
|
public:
|
|
|
|
DurabilityRpcClients(RpcWorkerClients &clients) : clients_(clients) {}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
private:
|
|
|
|
RpcWorkerClients &clients_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace distributed
|