Avoiding staging movesSeptember 27, 2019 at 2:22pm (Edited 10 months ago)
I'd just like to confirm that it's not configurable to not use a stager to write files, instead writing to files directly on change. Is that right?
A project I use on the remote host to watch for changes to files ignores file added and moved_to events; only file modifications trigger the desired behavior (which never happens with Mutagen). Mutegen's staging strategy is a good and correct one. I'm just looking into the possibility of a quick workaround.
September 27, 2019 at 2:23pm
September 28, 2019 at 2:20am
That's correct, only
rename-based file placement is supported at the moment. There was an issue opened recently requesting support for in-place modifications, which I think does make sense (especially for very large files), but I don't have a precise timeline or plan for implementing it. Unfortunately it has more complex failure modes that need to be handled when tracking content changes and there's a risk of file corruption. Regarding this specific issue, one thing Mutagen could potentially do (on an opt-in basis) is update the modification time of a file after swapping it into place. Can you check (with something like
touch <filename>) if Guard's watcher picks up on modification time changes?
One additional follow-up thought: since Guard is probably using
inotify-based watches on files, the modification time hack might not cause changes to be picked up. Or maybe the modification time would need to be triggered on the parent directory where the watch would remain stable. I'm not sure exactly... it depends on how Guard's watching is implemented. It could be more accurately tested with a
mv <mock-staged-path> <destination-path> && touch <destination-path>
October 11, 2019 at 5:00am
Sorry for the delay! I confirmed that moving a file into place does not trigger guard, but touching the file immediately afterward does.
I attempted a spike (https://github.com/mutagen-io/mutagen/pull/158) to see if I could get your idea working, but I was unsuccessful. Let me know if you have ideas on what might be wrong.