-
Notifications
You must be signed in to change notification settings - Fork 28
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
refactor: improve note state handling in SqliteStore
#489
Comments
This could be done alongside #376 |
One of the things that I think would be awesome to do is to map out all states an input note can be in and see if the way we capture these state in the table makes sense. For example, we have Similarly, There are probably a dozen (or maybe more) different variations of these and I think it has become difficult to make sense of different combinations. So, I think if we can come up with a structure which forces some of the state constraints (i.e., where we can't end up with with a wrong combination of properties), it will simplify our life in the future. One potential way (and not sure it is a good one) to think about different states is to try to describe them as a Rust enum. This way, we'd have one enum variant per possible state. |
Along with the changes discussed here we can improve the way we deal with query filters, we should have a way to combine them. This stems from this comment. |
I think one potential way that we may want to query the notes is something like: "get all notes that may have been affected by a sync response". Once we get such notes form the store, we could apply state transitions to them as discussed in #487 and then save the ones that have changed back to the store. This may be a bit tricky to do in a single query because we basically want to get something like:
Not sure if there is a good way to combine this into a single request to the store though. |
With the increasing complexity of possible note states we should refactor the
SqliteStore
struct and SQL tables to better handle them.Some examples of current values that determine the state of a note:
Based on the post by @bobbinth in #485 (comment)
The text was updated successfully, but these errors were encountered: