-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access to secondary databases #570
Comments
It seems to me that you underestimate sqlite3's capabilities for handling concurrent requests from multiple processes and overestimate the risk associated with accessing hamster.db directly, by-passing the hamster-service D-Bus interface (eg. here). From a bit of reading, for example
in my assessment, considering the small size our hamster.db files, the processing speed of even oldish laptops/desktops and the low likelihood of concurrent write requests, the "risk" associated with accessing hamster.db without using the D-Bus interface is extremely low. |
Thanks for the links ! Lots of food for thought. |
The links were spot-on, Next step is to check that the hamster/src/hamster/storage/db.py Line 665 in 6fa4c20
Not saying there is an issue, just that it deserves to be checked twice. The first point is almost done (PR #573). |
I actually wonder if a
I think the point of this issue is option 2. As for option 1, this would probably require invasive changes, which would be better suited to include in the rewrite rather than the current codebase, I believe. Also, if this would be supported usecase, I think it should actually access both databases through dbus (maybe even present them as a single db somehow), rather than bypassing dbus for this usecase. As for option 2., I wonder if this is not something that can be implemented already? I would think you can create a script that creates two instances of |
Yes, the point of this issue is option 2, with the proviso that "one-off" could include frequent (say daily) synchronization of databases (say work PC and home PC). An external script (something like htool) is okay for the one-off case, but seriously risks obscurity and abandonment. Integrating that functionality into hamster-cli.py would be better. All that is needed is something like
A lot of flexibility is gained if the whole CLI can use hamster.storage.db.Storage directly instead of the dbus interface, thereby avoiding having to be careful about stopping dbus services tied to a specific database file. This would also very convenient for mock databases for development and testing, so you don't have to continuously be worried about corrupting your precious "real" hamster.db. |
Ah, good point. I was thinking about an "importing data from an old machine" kind of setup, but tracking on multiple machines indeed makes sense. And indeed, just using separate export and load commands seems like an elegant way to support this usecase, while also allowing the user to do some preprocessing before import if needed. Of course, you can still do a slightly less flexible version of this without
which would import the contents of the given db into the main db (accessed through dbus). This could be implemented by creating a secondary However, I like the elegancy and flexibility of importing using a Thanks for adding some examples :-) |
There is a need to access other hamster databases as well, not only the main
hamster.db
,e.g. for merging a foreign database into the main one (#340).
As recently discussed, this is not possible using the
org.gnome.Hamster
D-Bus service,which is tied to the main database.
One possibility:
--no-dbus
?) to hamster-cli to bypass D-Bus and use db.Storage directly.--db-file=<filename>
) to hamster-cli.as correctly indicated by @GeraldJansen below.
Of course this access is risky
(there is no central server to avoid simultaneous write access in this case),
so if the server is running, it should be forbidden to access the server database.
(that one will remain hard-coded)
Still thinking, open to discussion.
The text was updated successfully, but these errors were encountered: