mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
11169bcf95
Summary: This revision introduces two complementary changes: * `eden daemon` no longer runs in the foreground. * There is now an `eden shutdown` command to kill the daemon. When `shutdown` is called, it tells the Thrift server to shutdown. In turn, this causes `EdenServer::runThriftServer()` to exit, which causes `EdenServer::run()` to exit. Reviewed By: simpkins Differential Revision: D3402347 fbshipit-source-id: 80032ba53eb69b3f69bef9d7cd169f93500c833c
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) 2016, 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
|
|
|
|
#include "common/fb303/cpp/FacebookBase2.h"
|
|
#include "eden/fs/service/gen-cpp2/EdenService.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class EdenServer;
|
|
|
|
/*
|
|
* Handler for the EdenService thrift interface
|
|
*/
|
|
class EdenServiceHandler : virtual public EdenServiceSvIf,
|
|
public facebook::fb303::FacebookBase2 {
|
|
public:
|
|
explicit EdenServiceHandler(EdenServer* server);
|
|
|
|
facebook::fb303::cpp2::fb_status getStatus() override;
|
|
|
|
void mount(std::unique_ptr<MountInfo> info) override;
|
|
|
|
void unmount(std::unique_ptr<std::string> mountPoint) override;
|
|
|
|
void listMounts(std::vector<MountInfo>& results) override;
|
|
|
|
void checkOutRevision(
|
|
std::unique_ptr<std::string> mountPoint,
|
|
std::unique_ptr<std::string> hash) override;
|
|
|
|
void getSHA1(
|
|
std::string& hashInBytes,
|
|
std::unique_ptr<std::string> mountPoint,
|
|
std::unique_ptr<std::string> path) override;
|
|
|
|
/**
|
|
* When this Thrift handler is notified to shutdown, it notifies the
|
|
* EdenServer to shut down, as well.
|
|
*/
|
|
void shutdown() override;
|
|
|
|
private:
|
|
// Forbidden copy constructor and assignment operator
|
|
EdenServiceHandler(EdenServiceHandler const&) = delete;
|
|
EdenServiceHandler& operator=(EdenServiceHandler const&) = delete;
|
|
|
|
void mountImpl(const MountInfo& info);
|
|
|
|
EdenServer* const server_;
|
|
};
|
|
}
|
|
} // facebook::eden
|