51 void bind(std::string
path, std::string
kind =
"auto");
53 void unbind(std::string
path);
56 bool tryReload(std::string
path);
68 int watchTree(std::string
root =
".");
74 bool watchNewDirectory(std::string
path);
85 bool startRemoteSync(std::string url,
int pollMs = 1000);
89 void stopRemoteSync();
97 void setRemoteHotDir(std::string
dir);
101 bool isRemoteSyncing()
const;
105 std::string remoteSyncStatus()
const;
112 std::string pollRemoteChange();
115 static std::string normalizePath(std::string
path);
127 std::string ensureHotDir();
133 bool fetchManifest(std::vector<RemoteFile> &
out);
136 bool downloadFile(
const std::string &relPath);
139 void applyManifest(
const std::vector<RemoteFile> &manifest);
142 std::map<std::string, std::pair<int64_t, int64_t>> loadRecord()
const;
143 void saveRecord(
const std::map<std::string, std::pair<int64_t, int64_t>> &
record)
const;
145 void syncLoop(
int pollMs);
147 void queueChange(std::string
path);
149 std::unordered_map<std::string, std::string> bindings_;
152 mutable std::mutex syncMu_;
153 std::thread syncThread_;
154 std::condition_variable syncCv_;
155 std::atomic<bool> syncRunning_{
false};
156 bool syncStarted_ =
false;
157 bool hotDirMounted_ =
false;
158 std::string syncUrl_;
159 mutable std::string syncStatus_ =
"idle";
160 mutable std::deque<std::string> changedQueue_;