Commit Graph

8 Commits

Author SHA1 Message Date
Zeke Foppa 4921983024 C#/Unity SDK - Add some developer docs (#3140)
# Description of Changes

Migrating
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/pull/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 <jameshgilles@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-08-11 16:52:20 +00:00
Zeke Foppa ccc4d06ddb Update GitHub files for C#/Unity SDK (#2952)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-21 14:44:47 +00:00
Ingvar Stepanyan cefc727b76 Rewrite C# codegen to the new Lang infra + fixes (#220)
## Description of Changes

This is the companion PR for
https://github.com/clockworklabs/SpacetimeDB/pull/2184, please see the
other PR for full description.

On the client side main changes are:

- Regenerate .NET and Unity test client bindings and test snapshot.
- Remove `IDatabaseRow` since V9 multi-tables splits data types from
actual table definitions, so those "table data types" are no longer
special. Just using `IStructuralReadWrite` in its place now.
- Add base index classes as mentioned in the other PR.
- As a sub-improvement, the non-unique index class actually does
indexing instead of iterating over the entire table like we did before.
- Remove internal-but-not-really `InternalInvokeValueDeleted` and
`InternalInvokeValueInserted` methods in favour of private events.

## API

 - [x] This is an API breaking change to the SDK

Removes some technically-visible but internal APIs.

## Requires SpacetimeDB PRs
https://github.com/clockworklabs/SpacetimeDB/pull/2184

## 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: ingvar/csharp-new-codegen

## Testing
*Write instructions for a test that you performed for this PR*

- [x] Manually tested Blackholio

---------

Co-authored-by: James Gilles <jameshgilles@gmail.com>
2025-02-05 16:48:15 -05:00
SteveGibson 589d40480f Logging API (#132)
## Description of Changes
*Describe what has been changed, any new features or bug fixes*

Changed logging based on [this
proposal](https://github.com/clockworklabs/SpacetimeDBPrivate/pull/981)

## API

 - [x] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*

Logging interface is different now. `Logger` has been renamed to `Log`,
and its methods have been renamed as well (ex. `Logger.LogError` is now
`Log.Error`)


## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Jeremie Pelletier <jeremiep@gmail.com>
Co-authored-by: Steve Boytsun <steve@clockwokrlabs.io>
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2024-09-23 13:52:50 -04:00
Jeremie Pelletier 5670db6fe6 Update DEVELOP.md to reflect new codegen (#119)
Also ran it again, committing a few generation changes too :)
2024-08-29 09:32:11 -07:00
Zeke Foppa e28849e22c Revert master to a stable state (#123)
## Description of Changes
Revert `master` to the original state of this PR:
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/issues/53.

We should prevent merging into `master` from now on, since the
repositories are now merged.

## 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*

## Testing
I loaded a bitcraft world and ran around.

I used the versions listed here:
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk-archive/pull/57

---------

Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-29 12:21:48 -04:00
Jeremie Pelletier 2efa162ce9 Update DEVELOP.md to reflect new codegen (#119)
Also ran it again, committing a few generation changes too :)
2024-08-07 13:39:13 -04:00
Phoebe Goldman 75dc6b59b0 Remove the rowPk from the client API (#72)
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.
2024-02-28 13:56:38 -05:00