This adds a common way to catch stop exceptions and handles them so error resilient logic does not continue when a stop exception is thrown.
Previously, the logic would only check for `ThreadAbortException` which was used to signal a stop prior to .NET8.
If there are index files with no references, they will now be deleted by the repair process.
Such files are likely leftovers from an earlier version that would leave such files if various errors happened.
This commit changes the way the new restore flow loads the extra database connections so these will also apply the temporary folder settings and custom pragmas.
This also changes the logic around the SQLite temporary folder. Previously, this folder would unconditionally be set to the general temporary folder, allowing only an override with a custom pragma.
No the setup checks if the system has the environment variable `SQLITE_TMPDIR` set already. If this variable is already set, it will NOT be overwritten.
Actual effects of this change depends on how SQLite internally resolves the temporary folder.
The code was using a two-way reference linking the database to the results and the results to the database.
However, this was not really used so it ended up just cluttering the code. With this commit, the results and databases are no longer keeping track of each other, and the only interaction is when the results are written to the database at the end of the operation.
To ensure result data is always written, this code has been moved into the controller, which will now flush the results for all operations. Prior to this, only some operations would write result data to the log.
The controller now also handles logic for cleaning old log data and invoking the vacuum command.
Fixed a bug due to using System.Text.Json where some attributes from NewtonSoft.Json were being applied and not picked up.
This PR adds a unified way of supplying timeouts to each of the backends.
It also adds an opt-in way of adding commonly used options, so parsing and usage can be standardized across multiple backends.
Rewrote all operation handlers to be async.
This moves the async/sync threshold out into the controller.
Fixed all the uses of cancellation token in the handlers to use the provided cancellation token.
Introduced a new ReusableTransaction that can be passed around, avoiding a ref parameter passing of the transaction instance.
If the user selects the blocksize to be the same as the remote volume size, this will cause each block to be in a separate volume and will trigger repeated compact calls.
This commit adds a check that ensures the volume size is large enough to hold at least two blocks.
Also fixed an issue where the compact could create volumes larger than the set limit (at most one block larger).
Backup will auto-repair, and user otherwise need to call "repair" to recover the state, before invoking compact/delete/purge.
This is done to prevent cases where the remote state contiains partial data and the automatic cleanup process would remove remote files.
This effectively caused the retention time to be ignored when reading from the database.
Also moved some code related to finding an unfinished fileset into the common database class.