Skip to content

plan for fixing #380 #388

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/rs/core/src/db_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ pub fn next_db_version(
if let Some(merging_version) = merging_version {
if ret < merging_version {
ret = merging_version;
} else if ret > merging_version {
// if merging_version has never been seen before
// in this current transaction against `crsql_changes`
// we need to bump ret
// We can accomplish this by:
// 1. Installing a `xBegin` callback on `crsql_changes` which indicates we are writing there
// 2. Install `xCommit` and `xRollback` callbacks on `crsql_changes` indicating we are done writing there
// 3. Adding a Vec of `db_versions` to extData
// 4. Binary search this vec for the current merging_version
// 5. If not there, add it and bump ret.
// 6. If there, do nothing.
}
}
unsafe {
Expand Down