-
Notifications
You must be signed in to change notification settings - Fork 22
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
SQLite backing store #206
SQLite backing store #206
Conversation
Needs some improvement to error handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! People shouldn't be accessing the DB "manually", so I don't think there's any need to make that easier. JSON is fine, but storing the data with msgpack would be A-OK too :)
(The reason being, the relationship between the tasks table and the operations table is rather precise, and Bad Things will happen if those get out of sync)
rusqlite seems like a good map to the needs of this app, particularly with its Transaction type.
I've implemented the last of the methods and this seems to be functioning Still to do:
I'm also pretty tempted to store the UUID's as strings - for debugging purposes, from the sqlite3 interface it's pretty awkward with the current stored-as-blob approach:
Then on to the sync-server storage |
Yeah, that is pretty gross. I don't think there's any real downside to storing strings. Performance isn't a huge issue here. |
Also implement ToSql/FromSql for Operation/TaskMap so errors are handled properly
@djmitche The SQLite can be fully threadsafe but rusqlite isn't - discussed here, and also here, neither has too satisfying an outcome. Any thoughts on the best way to implement this? |
Ah, this has been a problem with Python as well. Perhaps the storage should run in a dedicated thread, and the operations be performed via mpsc channels? It might be easiest to just shuttle query text over the channel to the sqlite thread, with responses returned to the caller on dedicated channels. The callers would then send the query text and |
Yep sounds like a good plan! |
# Conflicts: # Cargo.lock # taskchampion/Cargo.toml
Also note about why StorageTxn isn't implemented
I think this is good to merge? 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for taking so long to review this!
This looks good -- feel free to take or reject the suggestions below.
Co-authored-by: Dustin J. Mitchell <[email protected]>
As per Dustin's code-review comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sheep It!
Moo-erged in main branch, added changelog entry, shall merge when CI is appeased |
once this merges I think we're done with 0.4.0? |
I was just creating a new issue (#283) about making 0.4.0 release! Yep I think this is the last issue left in that milestone 🥳 |
Very WIP - still to implement the methods regarding the working set, operations, and base version
For first pass I'm just using SQLite table as dumb key-value store:
uuid
anddata
data
is aserde_json
dump of the task dataReason for using
serde_json
is mostly that it was already there, and JSON is reasonably simple/fast. Most probably not as fast asMsgpack
which was used with LMDB, but quite possibly adequate?There's no reason this couldn't be stored in a more SQL'y manner, with:
task_id
,key
andvalue
However this feels like it might be a little excessive, and may end up being slower since the task-data table would end up being much larger
Other misc thoughts:
Uuid::to_string
), but not sure this is really a concern.Transaction
type which made the implementation simpler. Thesqlite
project does not. Both have been around for >5 years and still 0.x 😢