sapling/eden/fs/service/EdenMain.h
Genevieve Helsel 9944a5dff5 add EdenServer recovery step and recover after failed takeover data send handshake
Summary:
* This adds a `EdenServer::recover()` method to start back up on unsuccessful takeover data send.
    * On an unsuccessful ping, filfill the `shutdownPromise` with a `TakeoverSendError` continaing the constructed `TakeoverData`. After this `recover` function is called, `takeoverPromise_` is reset, `takeoverShutdown` is set to `false`, and the `runningState_` is set to `RUNNING`.
With taking over from the returned `TakeoverData`, the user will not encounter `Transport not connected` errors on recovery.

* This adds a `EdenServer::closeStorage()` method to defer closing the `backingStore_` and `localStore_` until after our ready handshake is successful.
* This defers the shutdown of the `PrivHelper` until a successful ready handshake.

I also update the takeover documentation here with the new logic (and fix some formatting issues)

Reviewed By: simpkins

Differential Revision: D20433433

fbshipit-source-id: f59e660922674d281957e80aee5049735b901a2c
2020-04-07 09:52:21 -07:00

48 lines
1.1 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <string>
namespace facebook {
namespace eden {
class EdenConfig;
class EdenServer;
/**
* Hooks to customize the flavor of the edenfs daemon build.
*/
class EdenMain {
public:
virtual ~EdenMain() = default;
virtual std::string getEdenfsBuildName() = 0;
virtual std::string getEdenfsVersion() = 0;
virtual std::string getLocalHostname() = 0;
virtual void prepare(const EdenServer& server) = 0;
virtual void runServer(const EdenServer& server) = 0;
};
/**
* A default, open-source implementation of EdenMain.
*/
class DefaultEdenMain : public EdenMain {
public:
virtual std::string getEdenfsBuildName() override;
virtual std::string getEdenfsVersion() override;
virtual std::string getLocalHostname() override;
virtual void prepare(const EdenServer& server) override;
virtual void runServer(const EdenServer& server) override;
};
int runEdenMain(EdenMain&& main, int argc, char** argv);
} // namespace eden
} // namespace facebook