2016-05-12 23:43:17 +03:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2016-05-28 03:40:10 +03:00
|
|
|
void unmount(std::unique_ptr<std::string> mountPoint) override;
|
|
|
|
|
2016-05-12 23:43:17 +03:00
|
|
|
void listMounts(std::vector<MountInfo>& results) override;
|
|
|
|
|
|
|
|
void checkOutRevision(
|
|
|
|
std::unique_ptr<std::string> mountPoint,
|
|
|
|
std::unique_ptr<std::string> hash) override;
|
|
|
|
|
2016-05-28 04:16:27 +03:00
|
|
|
void getSHA1(
|
2016-08-18 17:21:36 +03:00
|
|
|
std::vector<SHA1Result>& out,
|
2016-05-28 04:16:27 +03:00
|
|
|
std::unique_ptr<std::string> mountPoint,
|
2016-08-18 17:21:36 +03:00
|
|
|
std::unique_ptr<std::vector<std::string>> paths) override;
|
2016-05-28 04:16:27 +03:00
|
|
|
|
2016-06-11 00:15:26 +03:00
|
|
|
/**
|
|
|
|
* When this Thrift handler is notified to shutdown, it notifies the
|
|
|
|
* EdenServer to shut down, as well.
|
|
|
|
*/
|
|
|
|
void shutdown() override;
|
|
|
|
|
2016-05-12 23:43:17 +03:00
|
|
|
private:
|
|
|
|
// Forbidden copy constructor and assignment operator
|
|
|
|
EdenServiceHandler(EdenServiceHandler const&) = delete;
|
|
|
|
EdenServiceHandler& operator=(EdenServiceHandler const&) = delete;
|
|
|
|
|
2016-08-18 17:21:36 +03:00
|
|
|
SHA1Result getSHA1ForPath(
|
|
|
|
const std::string& mountPoint,
|
|
|
|
const std::string& path);
|
|
|
|
|
|
|
|
SHA1Result getSHA1ForPathDefensively(
|
|
|
|
const std::string& mountPoint,
|
|
|
|
const std::string& path);
|
|
|
|
|
2016-05-12 23:43:17 +03:00
|
|
|
void mountImpl(const MountInfo& info);
|
|
|
|
|
|
|
|
EdenServer* const server_;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
} // facebook::eden
|