## Description of Changes
This releases a cherrypick of #127, so that `master` has the correct
version number.
## API
No breaking changes.
## Requires SpacetimeDB PRs
None
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
This creates a frankenstein monster of a repo that is compatible with
both .NET / MSBuild as well as can be consumed as a Unity package.
- `.meta` files, Unity manifests and Unity README were copied over from
the Unity repo.
- `examples` and `tests` folders were renamed to `examples~` and
`tests~` correspondingly, as the `~` suffix is the only way to get
entire folders ignored by Unity.
- MSBuild was configured to change `bin` and `obj` to `bin~` and `obj~`
for the same reasons. This doesn't matter for the Git repo, but helpful
for local development where you don't want Unity to try and load local
DLL artifacts.
- NuGet was configured to restore Unity-compatible NuGet DLLs (and
delete others) in a local folder and committed to the repo - so, from
now on, we can easily update them by modifying `.csproj` and via
standard `dotnet restore` / `dotnet build`.
After this change, this repo should be compatible with both .NET CLI
(e.g. `dotnet test`) as well as consumable from Unity, but due to amount
of metadata changes, it needs further testing before we merge repos
properly.
Fixes#114.
## 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*
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Single-line change so that `dotnet pack` stops complaining that nothing
was generated.
Per @RReverser this brings this package more in line with our other C#
packages.
## API
Nah nothing breaking.
## Requires SpacetimeDB PRs
Nope
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Minor simplifications using BSATN helpers for Protobufectomy code.
Also removed unnecessary usings and a pattern.
## 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*
## Description of Changes
Currently, a push to a PR triggers our `dotnet` workflows twice: once
for the `push` event, and once for the `pull_request` event.
This PR brings the CI behavior in line with how SpacetimeDB does it.
(Someday we should reduce the number of `pull_request` events that
trigger this, but today is not that day).
---------
Co-authored-by: Zeke Foppa <github.com/bfops>
## Description of Changes
- Roslyn codegen won't need to be added as a separate dependency
anymore.
- ByteArrayComparer, Identity, and Address will now live in
BSATN.Runtime so that they're reused between the client and module SDKs.
## API
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
- [x] https://github.com/clockworklabs/SpacetimeDB/pull/1440
- [ ] https://github.com/clockworklabs/SpacetimeDB/pull/1455
---------
Co-authored-by: Zeke Foppa <github.com/bfops>
## Description of Changes
Our CI now uses the packages from SpacetimeDB's `master` branch when
applicable.
## Testing
- [x] CI passes in test PR merging in the 0.11 upgrades:
https://github.com/clockworklabs/spacetimedb-csharp-sdk/pull/109
---------
Co-authored-by: Zeke Foppa <github.com/bfops>
## 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*
## Description of Changes
- Removed JSON support (similar to changes being made on the TypeScript
side)
- Removed all references to protobuf
- Swapped the protobuf codegen for the output of our own C# codegen in
rust
- Refactored the connection class to reflect the API changes from
protobuf to bsatn
- Updated the example to reflect these changes
## API
- [ ] This is an API breaking change to the SDK
Changes the SDK types passed into event handlers.
## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
## Description of Changes
See https://github.com/clockworklabs/SpacetimeDB/pull/1312 for the main
description and API breakages.
In the process extracted and simplified various common bits from
generated code into the SDK itself to make generated code more concise.
- Closes#67.
- Closes#68.
- Closes#73.
- Closes#76.
## API
- [x] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
https://github.com/clockworklabs/SpacetimeDB/pull/1312
## Description of Changes
Just bumps the version number. Since 0.9.1 has been released, we are now
on 0.9.2+!
## 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*
Co-authored-by: Zeke Foppa <github.com/bfops>
## Description of Changes
As a result of the consistent filtering rules proposal
(clockworklabs/SpacetimeDB#1256), all equatable types are now natively
equatable in C# as well.
This allows us to compare objects directly, without holding and
comparing AlgebraicValue in the entries map as well, which has a bit of
a domino effect and allows to optimise, simplify or even remove some
parts of the SDK.
## API
- [x] This is an API breaking change to the SDK
New filtering rules limit types on which filtering can be done, as well
as change the return type of `FilterBy` functions to always be iterable.
## Requires SpacetimeDB PRs
https://github.com/clockworklabs/SpacetimeDB/pull/1277
## Description of Changes
Ignore duplicate inserts in the same subscription update
## 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*
## Description of Changes
Bumped the version number to 0.9.0 as this was forgotten in the previous
release. Includes all changes to date.
## API
- [X] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
Not sure but its going out with the latest release. The previous package
was 5 months ago.
## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
## Description of Changes
Instead of a separate TableOp enum, and 4 fields to handle insert/delete
metadata in DbOp, use a nullable struct that contains non-nullable
object + bytes pair internally:
- if `insert` is present (non-nullable) and `delete` is nullable, that
naturally indicates insert operation
- if `insert` is nullable and `delete` is not, that's a delete
- if both are non-nullable, it's an update
- if both are null, it's an internal "no change" state
This simplifies and shortens update handling as well as reduces risk of
state getting out of sync - e.g. TableOp saying that the operation is
insert should exist but field containing inserted value being null. Now
nullable struct itself communicates whether there is an insert or not,
without a separate enum.
## 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*
## Description of Changes
Initially just fixed the nullability issues / warnings, but in the
process did a few more minor drive-by refactorings.
## 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*
## Description of Changes
There is only one place where we use Channels, and it's to create and await a channel with one element - which is functionally the same as a more precise and low-weight TaskCompletionSource.
Switching also makes the SDK compatible with the widely supported .NET Standard 2.1 subset, which is supported natively in Unity and allows to remove a custom System.Threading.Channels package from Unity SDK dependencies.
## 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*
## Description of Changes
Instead of using custom class hierarchy of messages, we can just use
native C# lambdas stored as Actions.
OnConnectError case can be further simplified by merging two branches
for different exception types into one.
## 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*
Minor refactoring that extracts common part of subscription and transaction update handling into a separate function, so that the main logic in `OnMessageProcessComplete` is a bit more straightforward and handles all event types with a sinlge `switch` instead of 3 separate `switch`es.
This is a small no-op step that makes further refactoring and optimisation of said common logic a bit easier.
* Merge ByteArrayComparers
Merge various mismatched implementation of byte array comparison/hashing into a single utils class (choosing the most efficient implementation already present).
* Forward hex conversion too
* Use const for Identity & Address sizes
This allows to:
1. Have a preset logger that is already correctly matching the environment (console vs Unity).
2. Removes the need for explicit `SpacetimeDBClient.CreateInstance(...)` which is particularly awkward to use and easy to forget with singleton as it doesn't return a result as a factory method name could suggest. Instead, `SpacetimeDBClient.instance` is available on first use.
3. Slightly simplifies dependencies between classes, e.g. `ClientCache` doesn't need a circular dependency on `SpacetimeDBClient`, making future maintenance and changes a bit easier.
This is the last C# version supported by Unity.
While this PR doesn't require almost any C# code changes, I found that limiting the version is helpful for ensuring that I don't accidentally introduce Unity-incompatible code in larger PRs.
Re: https://github.com/clockworklabs/SpacetimeDB/pull/840
This commit updates the C# SDK to no longer use the `row_pk` field
of the Protobuf client API,
as that field has been removed. (Will have been removed, as of merging.)
Where a table cache was previously keyed on `byte[] rowPk`,
it is now keyed on `byte[] rowBytes`,
where `rowBytes` is the BSATN-encoded bytes of the row.
This means we effectively store two copies of each row in the client cache:
the BSATN serialized format, and the decoded domain type.
An alternate implementation would be to make the table caches be sets of domain types,
discarding the BSATN bytes.
We find this undesirable for several reasons:
- Hashing and equality-comparing `byte[]` is almost certainly more efficient
than doing the same for domain types.
- Even if hashing and equality-comparing domain types were efficient,
we would still have to update codegen to emit hashing and equality methods
for all types in the module_bindings.
This implementation requires no changes to the module_bindings.
- We already have the BSATN bytes sitting around,
as they're necessarily part of the message we recieve from the server.
This change does no additional serialization or deserialization.
In essence, we're trading memory for time and simplicity.
Keeping the BSATN bytes live approximately doubles the table cache's memory usage,
but simplifies the implementation greatly,
and (we suspect) speeds up table cache insertions, deletions and lookups.