-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `address: Address` to `ReducerContext` Initial support for identifying connections via an `Address`, passed as the caller address in `ReducerContext`. Notable design choices: - The same type `Address` is used for clients and dbs, as opposed to having distinct `DbAddress` and `ClientAddress` types. - For automatic reducers (init, scheduled, &c), the passed `Address` is the database's address, not the address of the client which called `publish`. - Clients may specify an `Address` as a query parameter to the `subscribe` and `call` endpoints. If they do not, an `Address` will be randomly generated for them. Still to do: - Send the client's `Address` alongside their `Identity` and token upon WebSocket init in `IdentityToken`, so the client can save its `Address` for re-connection. - SDK support. - C# module support. - Documentation. - Refuse new connections if an existing connection with the same `(Identity, Address)` pair exists. - Ensure we can store `Address` in tables, so modules can track connected clients, and ser/de `Address`, so those tables can be synced to clients. * Use `None` in `ReducerContext` for HTTP calls without client address * Fix typo in trait argument name * `Address` representation amenable to SDK usage Similar to `Identity`, make `Address` a product type with a double-underscored field name. This will allow SDKs to distinguish `Address` from `Vec<u8>`, but does necessitate some ugly `AddressForUrl` hackery to get ser/de working correctly in different contexts. This commit does not yet include SDK support for `Address`, only the server-side machinery necessary for it. * Add client_address parameter to /publish; pass to init and update reducers Per discussion with Kim, it's useful for SpacetimeDB-cloud for the client_address passed to the init reducer to be that of the caller of /database/publish, rather than the database's address. This commit implements that behavior. Now: - `init` and `update` take the client_address passed to publish, if any, or `None` if no client_address was supplied. - Scheduled reducers never receive a client_address. - Reducers invoked by HTTP /call take the client_address passed to /call, if any, or `None` if no client_address was supplied. - Reducers invoked by WebSocket always receive the address of the WebSocket connection. * `Address` support in Rust client SDK * Add test that addresses are stable within a client process * Run rustfmt against merge changes * Not sure why my local `cargo fmt` didn't get this... * Add caller_address argument to reducer arguments in Rust SDK * rustfmt again... * Add caller address to `EventJson` message * Python codegen for client addresses * C# module support for client addresses * Fix scoping error * Add `Address`-related stuff to C# codegen - Emit `SpacetimeDB.Address` for address types - Add `callerAddress` field to `ReducerEvent` * TypeScript codegen changes * Fix merge conflict with new test * Run rustfmt --------- Co-authored-by: Ingvar Stepanyan <[email protected]>
- Loading branch information
Showing
59 changed files
with
1,112 additions
and
267 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
59159db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark for 59159db
Click to view benchmark