50 void bind(std::string
path, std::string
kind =
"auto");
52 void unbind(std::string
path);
55 bool tryReload(std::string
path);
67 int watchTree(std::string
root =
".");
73 bool watchNewDirectory(std::string
path);
84 bool startRemoteSync(std::string url,
int pollMs = 1000);
88 void stopRemoteSync();
96 void setRemoteHotDir(std::string
dir);
100 bool isRemoteSyncing()
const;
104 std::string remoteSyncStatus()
const;
111 std::string pollRemoteChange();
114 static std::string normalizePath(std::string
path);
126 std::string ensureHotDir();
132 bool fetchManifest(std::vector<RemoteFile> &out);
135 bool downloadFile(
const std::string &relPath);
138 void applyManifest(
const std::vector<RemoteFile> &manifest);
141 std::map<std::string, std::pair<int64_t, int64_t>> loadRecord()
const;
142 void saveRecord(
const std::map<std::string, std::pair<int64_t, int64_t>> &record)
const;
144 void syncLoop(
int pollMs);
146 void queueChange(std::string
path);
148 std::unordered_map<std::string, std::string> bindings_;
151 mutable std::mutex syncMu_;
152 std::thread syncThread_;
153 std::condition_variable syncCv_;
154 std::atomic<bool> syncRunning_{
false};
155 bool syncStarted_ =
false;
156 bool hotDirMounted_ =
false;
157 std::string syncUrl_;
158 mutable std::string syncStatus_ =
"idle";
159 mutable std::deque<std::string> changedQueue_;