sapling/eden/fs/takeover/TakeoverHandler.h
Adam Simpkins 0c3d6232e3 initial code to listen for graceful takeover attempts
Summary:
This adds a new class which listens on a Unix domain socket for clients that
wish to gracefully take over Eden's FUSE mount points.  The goal is to
eventually enable graceful restart functionality for eden.

It would be nice if we could use the existing thrift server socket for this,
but thrift doesn't provide low-enough level APIs so that we can send
credentials and file descriptors over the socket using SCM_CREDENTIALS and
SCM_RIGHTS.  Using our own separate socket is the easiest way to accomplish
this instead.

For now eden just listens on this socket and logs a message when a client
connects; this diff does not yet contain logic for performing mount point
takeover.

Reviewed By: bolinfest

Differential Revision: D5827752

fbshipit-source-id: 928e541efa2546cb612da2699ff0bd822bafaad5
2017-11-19 15:47:20 -08:00

47 lines
1.2 KiB
C++

/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#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;
};
} // namespace eden
} // namespace facebook