Skip to content
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

Websocket API: Light transaction updates & NoSuccessNotify #1812

Merged
merged 15 commits into from
Nov 4, 2024

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Oct 9, 2024

Description of Changes

Does two things:

  1. Adds TransactionUpdateLight that consists only of the request_id and the DatabaseUpdate<F>. This is emitted when the query param &light=true is set (unless the update is sent to the caller in which case a full update is sent).
  2. Adds flags: enum CallReducerFlags { FullUpdate, NoSuccessNotify } to ClientMessage. When NoSuccessNotify is set, the host will not send back an empty update to the caller on success without the caller having subscribed to any affected queries. This is exposed in the SDK via ctx.set_reducer_flags.my_reducer(CallReducerFlags::NoSuccessNotify). When the default FullUpdate is used, full updates are sent, whether the caller was subscribed to the relevant queries or not.

TODO:

API and ABI breaking changes

This breaks the websocket API/protocol.

@Centril Centril force-pushed the centril/websocket-light branch from 96c58b8 to ff2e1d8 Compare October 9, 2024 16:22
@Centril Centril force-pushed the centril/websocket-gzip branch from 7402785 to 266d6fa Compare October 9, 2024 16:26
@Centril Centril requested a review from gefjon as a code owner October 9, 2024 16:26
Base automatically changed from centril/websocket-gzip to master October 9, 2024 17:28
@Centril Centril force-pushed the centril/websocket-light branch from ff2e1d8 to 32e1a6c Compare October 9, 2024 17:30
@Centril Centril force-pushed the centril/websocket-light branch from c7729ee to 2a9424e Compare October 14, 2024 14:44
@Centril Centril force-pushed the centril/websocket-light branch from a8e222e to b51292b Compare October 14, 2024 15:27
@bfops
Copy link
Collaborator

bfops commented Oct 15, 2024

Looks like the tests are failing?

@Centril Centril force-pushed the centril/websocket-light branch 5 times, most recently from da45a60 to e39d51e Compare October 15, 2024 22:13
@Centril Centril force-pushed the centril/websocket-light branch 2 times, most recently from e2fabc9 to 0cb3389 Compare October 17, 2024 14:29
@bfops
Copy link
Collaborator

bfops commented Oct 18, 2024

@Centril I'm happy to review the CLI changes - Do you have recommendations on how to test this? Should I just regenerate bindings for an example client for each language?

@Centril Centril force-pushed the centril/websocket-light branch from 0cb3389 to 22de99e Compare October 22, 2024 17:54
Copy link
Contributor

@gefjon gefjon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I would like to see tests added to the Rust SDK test suite which exercise this new functionality. If time is a concern, these could be added in a follow-up. I am happy to assist in writing the tests, but I don't think I have a strong enough grasp of the intended semantics to actually write them myself.

I would very much like clarification on the ReducerContext.sender passed to reducers whose callers requested no-notify.

I've also left many suggestions which are all: don't document the WS protocol on user-facing parts of the SDK. The WS protocol should be abstracted away to users of the SDK.

Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(codeowner review) the crates/cli/src/subcommands/subscribe.rs changes look benign to me 👍

@Centril Centril force-pushed the centril/websocket-light branch from c659ca4 to 7e91c80 Compare October 22, 2024 20:17
Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle, this looks good and correct to me. I just want to be cautious about merging, particularly if we have not yet tested this. Maybe we hold off on doing a basic CircleGame test tomorrow before merging.

@Centril Centril force-pushed the centril/websocket-light branch 2 times, most recently from b6689e9 to 33e815c Compare October 23, 2024 07:16
@Centril Centril force-pushed the centril/websocket-light branch from eafc64b to 9c85842 Compare October 23, 2024 15:04
@Centril Centril force-pushed the centril/websocket-light branch from 9c85842 to 01d3cd9 Compare October 30, 2024 12:50
@Centril Centril added this pull request to the merge queue Nov 4, 2024
Merged via the queue into master with commit ac0053c Nov 4, 2024
7 of 8 checks passed
Centril added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Nov 4, 2024
## Description of Changes

Adds C# sdk support for
clockworklabs/SpacetimeDB#1812.

## Requires SpacetimeDB PRs

- clockworklabs/SpacetimeDB#1812

## Testsuite

SpacetimeDB branch name: centril/websocket-light

---------

Co-authored-by: Tyler Cloutier <[email protected]>
Co-authored-by: John Detter <[email protected]>
@Centril Centril deleted the centril/websocket-light branch November 4, 2024 17:19
@bfops bfops added the api-break A PR that makes an API breaking change label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-break A PR that makes an API breaking change release-rc1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants