-
Notifications
You must be signed in to change notification settings - Fork 16
Add some developer docs #349
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
Conversation
Some API updates
More API updates
…w updates and reducer events
API callback improvements
Add sslEnabled option to Connect function
* Fix compilation issue with master * Initial push for SATS (still WIP) * Small build fix * Small update * Updates from meeting with Tyler * Fixed issues with LayoutExplicit and added some missing functions * AlgebraicValue cleanup * Copied changes from BitCraftMini * Removed TypeDef --------- Co-authored-by: Clockwork Labs <[email protected]> Co-authored-by: Tyler Cloutier <[email protected]> Co-authored-by: John Detter <[email protected]>
* Upload script to help deploying to our partners * You have to specify hosts individually * Small fix * Another small fix - tested + working --------- Co-authored-by: John Detter <[email protected]>
* Serialize byte arrays as hex * Fix namespace * Small fix --------- Co-authored-by: John Detter <[email protected]>
* First pass * Committing meta file * Removed option type - unneeded * Implementing new some converter * Some converter updates * Tons of fixes here * Cleaned up the some/enum serialization implementation --------- Co-authored-by: John Detter <[email protected]>
Co-authored-by: John <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: John Detter <[email protected]>
* Several updates to the way ClientCache + processing updates works * Client cache changes working * Removed log statements --------- Co-authored-by: John Detter <[email protected]>
* Copied changes from BitCraft * Applied state diff changes * State diffs complete * Compilation fix * Fix build issues --------- Co-authored-by: John Detter <[email protected]>
* Pulled SpacetimeUnitySDK from the BitCraft project * Removed unused logs * Removed primary key functionality * Fix compilation issues with older version of C# * Primary key client implementation * Another row update fix --------- Co-authored-by: John <[email protected]>
* Pulled SpacetimeUnitySDK from the BitCraft project * Removed unused logs * Removed primary key functionality * Fix compilation issues with older version of C# --------- Co-authored-by: John <[email protected]>
* Adding event parameter to table callbacks * Reverted a namespace change --------- Co-authored-by: Steve <[email protected]> Co-authored-by: John Detter <[email protected]>
Co-authored-by: Derek Brinkmann <[email protected]>
* Add onSubscriptionUpdate callback * Remove unnecesary onTransactionComplete --------- Co-authored-by: Derek Brinkmann <[email protected]>
…ed from callbacks (#20) Co-authored-by: Steve <[email protected]>
* Deserializing reducer args before table updates so they can be accessed from callbacks * Reducer arguments in table events * Removed redundant onSubscriptionUpdate --------- Co-authored-by: Steve <[email protected]> Co-authored-by: John Detter <[email protected]> Co-authored-by: John Detter <[email protected]>
Co-authored-by: Steve <[email protected]>
Co-authored-by: John Detter <[email protected]>
* Deserializing reducer args before table updates so they can be accessed from callbacks * Reducer arguments in table events * Adding OnBeforeDelete event to tables * Renaming ReducerCallInfo to ReducerEvent * Removed extra onSubscriptionUpdate --------- Co-authored-by: Steve <[email protected]> Co-authored-by: John Detter <[email protected]>
* Deserializing reducer args before table updates so they can be accessed from callbacks * Reducer arguments in table events * Adding OnBeforeDelete event to tables --------- Co-authored-by: Steve <[email protected]> Co-authored-by: John Detter <[email protected]>
## Description of Changes Update DLLs to the 1.1.2 versions that have been pushed to NuGet. The SpacetimeDB tag that they were built from is `v1.1.2-csharp-release`. ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs None, because we're updating the DLLs to essentially include SpacetimeDB PRs. ## Testsuite SpacetimeDB branch name: master ## Testing CI I guess? Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes Bump versions to 1.2.0, as well as update the DLLs from SpacetimeDB (commit `fc8f7dcc8`). They don't have any changes, but the versions needed bumping. ## API This itself is not a breaking changes. ## Requires SpacetimeDB PRs clockworklabs/SpacetimeDB#2837 ## Testsuite SpacetimeDB branch name: release/v1.2.0 ## Testing CI only --------- Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes *Describe what has been changed, any new features or bug fixes* ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs *List any PRs here that are required for this SDK change to work* ## Testsuite *If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* SpacetimeDB branch name: master ## Testing *Write instructions for a test that you performed for this PR* - [ ] Describe a test for this PR that you have completed --------- Co-authored-by: Alessandro Asoni <[email protected]> Co-authored-by: James Gilles <[email protected]>
## Description of Changes `NetworkRequestTracker` previously was keeping all historical reducer request data, and searching through this every frame to get statistics. I've modified it to throw out much more data -- it's much faster now, but only updates every few seconds. ## API Not an API break, but deprecates an argument of one of NetworkRequestTracker's methods to no longer do anything. Adds new APIs. ## Requires SpacetimeDB PRs N/A ## Testsuite SpacetimeDB branch name: master ## Testing - [x] Tested Bitcraft. **Their F9 debug menu will require an update, since we now only keep one time window of request data, rather than being able to give information about multiple windows.** But it works. - [x] Blackholio CI
## Description of Changes Addresses clockworklabs/SpacetimeDBPrivate#1786 and #329. Marks messages as parsed from the background parsing thread, and then marks them as applied using a separate tracker once they are applied. ## API - [ ] This is an API breaking change to the SDK *If the API is breaking, please state below what will break* ## Requires SpacetimeDB PRs ## Testsuite SpacetimeDB branch name: master ## Testing - [x] Testing against Bitcraft
## Description of Changes Updates the DLLs for clockworklabs/SpacetimeDB#2762, and bumps our version numbers as well. ## API - [ ] This is an API breaking change to the SDK Not a breaking change ## Requires SpacetimeDB PRs None afaik ## Testsuite SpacetimeDB branch name: master ## Testing *Write instructions for a test that you performed for this PR* - [x] Ran through Bitcraft tutorial - [x] Blackholio on CI --------- Co-authored-by: James Gilles <[email protected]> Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes These version bumps were supposed to happen in #332, but apparently I messed something up while I was switching branches. ## API - [ ] This is an API breaking change to the SDK No breaking changes ## Requires SpacetimeDB PRs None. ## Testsuite SpacetimeDB branch name: master ## Testing CI only Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes Missed in #333. We should update the 1.2.1 tag and the `release/latest` branch after this. ## API - [ ] This is an API breaking change to the SDK Nope ## Requires SpacetimeDB PRs None ## Testsuite SpacetimeDB branch name: master ## Testing CI only Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes I'm tired of messing up version updates. I "vibecoded" a script to do it. ## API - [ ] This is an API breaking change to the SDK No. No changes to runtime code. ## Requires SpacetimeDB PRs None ## Testsuite SpacetimeDB branch name: master ## Testing ``` $ python3 tools~/update-version.py 1.1.1 Updated: ./SpacetimeDB.ClientSDK.csproj Updated: ./tests~/tests.csproj Updated: ./examples~/regression-tests/server/StdbModule.csproj Updated: ./examples~/regression-tests/client/client.csproj Updated: ./examples~/quickstart-chat/server/StdbModule.csproj Updated: ./examples~/quickstart-chat/client/client.csproj Updated version in package.json to 1.1.1 $ git diff -U1 diff --git a/SpacetimeDB.ClientSDK.csproj b/SpacetimeDB.ClientSDK.csproj index 5248df6..b3ca7e8 100644 --- a/SpacetimeDB.ClientSDK.csproj +++ b/SpacetimeDB.ClientSDK.csproj @@ -18,4 +18,4 @@ <RepositoryUrl>https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk</RepositoryUrl> - <AssemblyVersion>1.2.1</AssemblyVersion> - <Version>1.2.1</Version> + <AssemblyVersion>1.1.1</AssemblyVersion> + <Version>1.1.1</Version> <DefaultItemExcludes>$(DefaultItemExcludes);*~/**</DefaultItemExcludes> @@ -27,3 +27,3 @@ <ItemGroup> - <PackageReference Include="SpacetimeDB.BSATN.Runtime" Version="1.2.*" /> + <PackageReference Include="SpacetimeDB.BSATN.Runtime" Version="1.1.*" /> diff --git a/examples~/quickstart-chat/server/StdbModule.csproj b/examples~/quickstart-chat/server/StdbModule.csproj index 0513a81..f290d22 100644 --- a/examples~/quickstart-chat/server/StdbModule.csproj +++ b/examples~/quickstart-chat/server/StdbModule.csproj @@ -16,3 +16,3 @@ <ItemGroup> - <PackageReference Include="SpacetimeDB.Runtime" Version="1.2.*" /> + <PackageReference Include="SpacetimeDB.Runtime" Version="1.1.*" /> </ItemGroup> diff --git a/examples~/regression-tests/server/StdbModule.csproj b/examples~/regression-tests/server/StdbModule.csproj index c6b1cba..3284863 100644 --- a/examples~/regression-tests/server/StdbModule.csproj +++ b/examples~/regression-tests/server/StdbModule.csproj @@ -10,3 +10,3 @@ <ItemGroup> - <PackageReference Include="SpacetimeDB.Runtime" Version="1.2.*" /> + <PackageReference Include="SpacetimeDB.Runtime" Version="1.1.*" /> </ItemGroup> diff --git a/package.json b/package.json index 7839151..a627246 100644 --- a/package.json +++ b/package.json @@ -3,3 +3,3 @@ "displayName": "SpacetimeDB SDK", - "version": "1.2.1", + "version": "1.1.1", "description": "The SpacetimeDB Client SDK is a software development kit (SDK) designed to interact with and manipulate SpacetimeDB modules..", ``` --------- Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes This is a fix for community bug #340 that was the result of changes to SpacetimeDBClient code that missed changes to the WebGL build. ## API - [ ] This is an API breaking change to the SDK ## Requires SpacetimeDB PRs - None ## Testsuite SpacetimeDB branch name: master ## Testing - [X] Tested changes against Blackholio running under a Unity WebGL build
See also clockworklabs/SpacetimeDB#2938 |
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.
One suggestion and two responses that don't require action. Thanks for writing this, it's gonna be really helpful!
|
||
`DbConnection` in the generated code inherits from `DbConnectionBase<...>` in the SDK code, which lives in [`src/SpacetimeDBClient.cs`](./src/SpacetimeDBClient.cs). This is a general pattern. Similar inheritance patterns are used for tables and indexes: the generated code defines a class that inherits most of its behavior from a class in the SDK. | ||
|
||
We require that **a DbConnection is only accessed from a single thread**, which should call the `DbConnection.FrameTick()` method frequently. See [threading model](#threading-model), below. |
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.
We do? Ew...
|
||
The C# SDK, unlike the [Rust SDK](https://github.com/clockworklabs/SpacetimeDB/tree/master/crates/sdk), **assumes a DbConnection is only accessed from a single thread**. This thread is referred to as the "main thread". The "main thread" is: | ||
- Whichever thread is repeatedly calling `DbConnection.FrameTick()` in a loop. | ||
It is **only safe to call `FrameTick()` from a single thread**. It is **only safe to access the DbConnection from this thread**. |
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.
Is this solvable/fixable with a lock?
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.
Would require locking on all accesses of conn.Db
. I don't think there's a nice way to do this without an API break. The type system is just much less expressive RE: sharing.
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.
Even if you, say, require conn.Db
to be accessed from a callback that has a lock on the database, the user can still just store the Db you passed outside the callback. In the end I think the only way to do it would be to have the user manage the lock.
We could think about doing something MVCC-y, where each conn.Db
you see is actually immutable, and you're just getting new copies of the Db on changes, but I would be worried about the perf implications there.
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.
That might allow more work to be done in the background threads, but it would naively involve a lot more allocations since you'd be creating a new copy of the indices each frame. It might work to just have pools of Dictionary<...>
lying around that we reuse. Alternatively, we find some sort of haskelly immutable dictionary that can share state between copies.
Thanks Phoebe Co-authored-by: Phoebe Goldman <[email protected]>
Migrated to clockworklabs/SpacetimeDB#3140, as we are merging this repo into that one. |
# Description of Changes Migrating clockworklabs/com.clockworklabs.spacetimedbsdk#349 since we are merging that repo into this one. > Add some developer docs. # API and ABI breaking changes None # Expected complexity level and risk 1 # Testing None. Docs only. --------- Co-authored-by: James Gilles <[email protected]> Co-authored-by: Phoebe Goldman <[email protected]> Co-authored-by: Zeke Foppa <[email protected]>
# Description of Changes Migrating clockworklabs/com.clockworklabs.spacetimedbsdk#349 since we are merging that repo into this one. > Add some developer docs. # API and ABI breaking changes None # Expected complexity level and risk 1 # Testing None. Docs only. --------- Co-authored-by: James Gilles <[email protected]> Co-authored-by: Phoebe Goldman <[email protected]> Co-authored-by: Zeke Foppa <[email protected]>
Description of Changes
Add some developer docs.
API
Requires SpacetimeDB PRs
Testsuite
SpacetimeDB branch name: master
Testing
N/A