Skip to content

chore: adaptations to the internals API following migration to SQLite - #20

Merged
calmh merged 4 commits into
calmh:jb/sqlitefrom
pixelspark:jb/sqlite
Mar 16, 2025
Merged

calmh merged 4 commits into
calmh:jb/sqlitefrom
pixelspark:jb/sqlite

Conversation

@pixelspark

Copy link
Copy Markdown

Hi @calmh, great work on the SQLite backend!

I spent the morning getting the Synctrain iOS app to build with this branch as well, and as expected there were some minor things to fix. This PR contains all the fixes currently needed:

  • Due to the removal of internals.DBSnapshot() (which is a good move I think), I added two new functions to obtain the required statistics (LocalSize and NeedSize). Due to the Counts type now being moved to internals I have added a proxy type here so the internal db.Counts can be left unexposed.
  • Due to the removal of internals.DBSnapshot(), it cannot be used anymore to iterate over the global list of files. Therefore I added a function AllGlobalFiles to expose the equally named function from Model to iterate over files.
  • To be able to call syncthing.New from the iOS side, I need a way to instantiate the new sdb and of course would like a way to trigger the migration as well. I therefore created a function utils.OpenDatabase that does this (before my change the code for migrating and upgrading was a bit intermingled - I don't need to/can't do auto-upgrading so I left this unexposed).

Everything seems to work fine, but I need to do further testing obviously.

I think it would be great if you could already in this early stage incorporate these changes. This would allow me to track the progress on the SQLite migration and ensure the iOS app is ready as well whenever v2.0.0 is.

@pixelspark

Copy link
Copy Markdown
Author

For context, the changes I am making on the iOS side: pixelspark/sushitrain@main...chore/sqlite

Comment thread lib/syncthing/internals.go Resolved
Comment thread lib/syncthing/utils.go Resolved
@calmh
calmh merged commit 280bc37 into calmh:jb/sqlite Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants