Right now, I was brainstorming on how to make my selfhosted setup more mobile device friendly. I have syncthing syncing files between all my computers (and my phone) and it does a stellar job.
But on mobile, syncthing is not optimal. I have my notes synced using syncthing and I use a single markdown editor app to edit them. In theory, the app would somehow “notify” syncthing about changes and syncthing would only rescan my dir then and sync them making this process much more battery efficient.
I’m working on a file manager app (webapp in go) that I use to access syncthing files with the browser and I was wondering if a REST api for mobile apps to sync would be a useful feature (long term). Basically this tracks file changes, maintains a database and allows mobile apps to sync. But having two sync solutions on a single set of files makes me nervous.
So my question is how does syncthing write new files to the FS while syncing? Assume the sender(A) has changes to a file(F) and the receiver(B) does not. Now A sends the delta that is written to a tmp file and the tmp file is renamed into F. How does syncthing ensure that the F has not changed on B by the time it does the rename tmp -> F? Does it do this atomically?