sapling/eden/fs/prjfs/PrjfsChannel.h
Xavier Deguillard 1fef8cbc1a prjfs: remove FsChannel.h
Summary: This is not needed, we can use the PrjfsChannel class directly where needed.

Reviewed By: chadaustin

Differential Revision: D23946259

fbshipit-source-id: eafcd38c0927fa282d62ada0986a7ef8b612174b
2020-09-28 18:14:30 -07:00

88 lines
2.0 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 "folly/portability/Windows.h"
#include <ProjectedFSLib.h> // @manual
#include "eden/fs/utils/Guid.h"
#include "eden/fs/utils/PathFuncs.h"
#include "eden/fs/utils/ProcessAccessLog.h"
#include "folly/futures/Future.h"
namespace facebook {
namespace eden {
class EdenMount;
class Dispatcher;
class PrjfsChannel {
public:
PrjfsChannel(const PrjfsChannel&) = delete;
PrjfsChannel& operator=(const PrjfsChannel&) = delete;
explicit PrjfsChannel() = delete;
PrjfsChannel(
AbsolutePathPiece mountPath,
Dispatcher* const dispatcher,
std::shared_ptr<ProcessNameCache> processNameCache);
~PrjfsChannel();
void start(bool readOnly, bool useNegativePathCaching);
void stop();
struct StopData {};
folly::SemiFuture<StopData> getStopFuture();
/**
* Remove files from the Projected FS cache. removeCachedFile() doesn't care
* about the file state and will remove file in any state.
*/
void removeCachedFile(RelativePathPiece path);
void addDirectoryPlaceholder(RelativePathPiece path);
void flushNegativePathCache();
Dispatcher* getDispatcher() {
return dispatcher_;
}
ProcessAccessLog& getProcessAccessLog() {
return processAccessLog_;
}
PRJ_NAMESPACE_VIRTUALIZATION_CONTEXT getMountChannelContext() const {
return mountChannel_;
}
void sendSuccess(
int32_t commandId,
PRJ_COMPLETE_COMMAND_EXTENDED_PARAMETERS* FOLLY_NULLABLE extra);
void sendError(int32_t commandId, HRESULT error);
private:
//
// Channel to talk to projectedFS.
//
PRJ_NAMESPACE_VIRTUALIZATION_CONTEXT mountChannel_{nullptr};
const AbsolutePath mountPath_;
Dispatcher* const dispatcher_{nullptr};
Guid mountId_;
bool isRunning_{false};
bool useNegativePathCaching_{true};
folly::Promise<StopData> stopPromise_;
ProcessAccessLog processAccessLog_;
};
} // namespace eden
} // namespace facebook