mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-14 11:48:28 -04:00
2d8b980a52
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.
21 lines
570 B
XML
21 lines
570 B
XML
<Project Sdk="Microsoft.NET.Sdk">
|
|
|
|
<PropertyGroup>
|
|
<OutputType>Exe</OutputType>
|
|
<TargetFramework>net7.0</TargetFramework>
|
|
<ImplicitUsings>enable</ImplicitUsings>
|
|
<Nullable>enable</Nullable>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<PackageReference Include="Google.Protobuf" Version="3.23.4" />
|
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
<ProjectReference Include="../../../SpacetimeDB.ClientSDK.csproj" />
|
|
</ItemGroup>
|
|
|
|
<ItemGroup>
|
|
<Folder Include="module_bindings\" />
|
|
</ItemGroup>
|
|
|
|
</Project>
|