mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
9944a5dff5
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
47 lines
1.1 KiB
C++
47 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
|
|
|
|
namespace folly {
|
|
template <typename T>
|
|
class Future;
|
|
}
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class TakeoverData;
|
|
|
|
/**
|
|
* TakeoverHandler is a pure virtual interface for classes that want to
|
|
* implement graceful takeover functionality.
|
|
*
|
|
* This is primarily implemented by the EdenServer class. However, there are
|
|
* also alternative implementations used for unit testing.
|
|
*/
|
|
class TakeoverHandler {
|
|
public:
|
|
virtual ~TakeoverHandler() {}
|
|
|
|
/**
|
|
* startTakeoverShutdown() will be called when a graceful shutdown has been
|
|
* requested, with a remote process attempting to take over the currently
|
|
* running mount points.
|
|
*
|
|
* This should return a Future that will produce the TakeoverData to send to
|
|
* the remote edenfs process once this edenfs process is ready to transfer
|
|
* its mounts.
|
|
*/
|
|
virtual folly::Future<TakeoverData> startTakeoverShutdown() = 0;
|
|
|
|
virtual void closeStorage() = 0;
|
|
};
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|