Debian Codegraph @

node/@parcel/watcher/src/watchman/WatchmanBackend.hh

raw
1 #ifndef WATCHMAN_H
2 #define WATCHMAN_H
3
4 #include "../Backend.hh"
5 #include "./BSER.hh"
6 #include "../Signal.hh"
7 #include "./IPC.hh"
8
9 class WatchmanBackend : public Backend {
10 public:
11 static bool checkAvailable();
12 void start() override;
13 WatchmanBackend() : mStopped(false) {};
14 ~WatchmanBackend();
15 void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) override;
16 void getEventsSince(WatcherRef watcher, std::string *snapshotPath) override;
17 void subscribe(WatcherRef watcher) override;
18 void unsubscribe(WatcherRef watcher) override;
19 private:
20 std::unique_ptr<IPC> mIPC;
21 Signal mRequestSignal;
22 Signal mResponseSignal;
23 BSER::Object mResponse;
24 std::string mError;
25 std::unordered_map<std::string, WatcherRef> mSubscriptions;
26 bool mStopped;
27 Signal mEndedSignal;
28
29 std::string clock(WatcherRef watcher);
30 void watchmanWatch(std::string dir);
31 BSER::Object watchmanRequest(BSER cmd);
32 void handleSubscription(BSER::Object obj);
33 };
34
35 #endif