Hey guys, is there a way to assign a sync hook to a file or a folder or a set of extensions? I’d like to be able to sync .sqlite3 databases cleanly …
Not that I’m aware of. Could you elaborate more on what the goal is? Are you trying to mirror a SQLite database so that it can be used by an application on other device in near real time?
Yes, that’s the goal but not in real time. Just want to sync cleanly so that I can be reasonably confident that the latest version (since versions overwrite) is readable.
(Sorry for the late response…)
I do not know if I understood correctly. Sorry my english.
But I think if you only want to sync certain files in a folder, I would play with the Ignore Patterns option, to remove the rest of the files in the sync.
- … relies on the OS to handle lock requests.
- … does per-transaction commits.
- … allows a database file to be accessed concurrently, using locks to temporarily block readers while a write is in progress. The inverse also happens when a reader is actively reading a writer is prevented from updating the database (there’s also a mechanism to keep a write from waiting forever when there are a larger number of readers).
So generally speaking, a SQLite database file can be copied while it’s in use without data corruption.
One wrinkle is that OSes cache files from mass storage into RAM to speed up access. How the OS handles flushing changes from RAM to storage media and how the underlying filesystem behaves will impact what “version” Syncthing ends up copying.
Another wrinkle is if the OS is Windows because there are restrictions on reading files that are open for writing.