Add option to report diagnostic events #159
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds an option to pass in
powersync_control('start', ...)that will make the sync client emit diagnostic events as instructions to the client SDK.This is a step towards #155: As we deprecate non-Rust clients from our SDKs, it makes sense to move diagnostic reporting into the core extension instead of requiring SDKs to parse and handle sync lines for that.
Currently, the diagnostic module patches the sync client to:
This PR adds steps 1 and 2 into the core extension. If diagnostics are enabled when starting a sync iteration, we emit a
HandleDiagnosticsinstruction when:Map<string, BucketState>that they would patch for partial updates). A complete update is emitted when we start tracking checkpoints.Map<string, Map<string, ColumnType>>map to update in response to those events. The JS diagnostic module can also keep storing that in local storage, this just replaces the notification part so that we no longer have to parse oplog lines in JS.To expose the size of downloaded data per bucket, I believe it makes sense to alter
ps_bucketsinstead. I'll open another PR for that.