SpacetimeDB.Runtime
0.10.0
dotnet add package SpacetimeDB.Runtime --version 0.10.0
NuGet\Install-Package SpacetimeDB.Runtime -Version 0.10.0
<PackageReference Include="SpacetimeDB.Runtime" Version="0.10.0" />
paket add SpacetimeDB.Runtime --version 0.10.0
#r "nuget: SpacetimeDB.Runtime, 0.10.0"
// Install SpacetimeDB.Runtime as a Cake Addin
#addin nuget:?package=SpacetimeDB.Runtime&version=0.10.0
// Install SpacetimeDB.Runtime as a Cake Tool
#tool nuget:?package=SpacetimeDB.Runtime&version=0.10.0
SpacetimeDB.Runtime
This project contains the core SpacetimeDB SATS typesystem, attributes for the codegen as well as runtime bindings for SpacetimeDB WebAssembly modules.
The runtime bindings are currently implementing via Wasi.Sdk
package, which is a .NET implementation of the WASI standard. This is likely to change in the future.
While not really documented, it allows to build raw WebAssembly modules with custom bindings as well, which is what we're using here. The process is somewhat complicated, but here are the steps:
bindings.c
declares raw C bindings to the SpacetimeDB FFI imports and marks them with attributes like__attribute__((import_module("spacetime"), import_name("_insert")))
that make them WebAssembly imports. (unfortunately, function name duplication is currently unavoidable)bindings.c
implements a bunch of Mono-compatible wrappers that convert between Mono types and raw types expected by the SpacetimeDB FFI and invoke corresponding raw bindings.Runtime.cs
declares corresponding functions with compatible signatures for Mono-compatible wrappers to attach to. It marks them all with[MethodImpl(MethodImplOptions.InternalCall)]
.bindings.c
attaches all those Mono-compatible wrappers to their C# declarations in amono_stdb_attach_bindings
function.bindings.c
adds FFI-compatible exports that search for a method by assembly name, namespace, class name and a method name in the Mono runtime and invoke it. Those exports are marked with attributes like__attribute__((export_name("__call_reducer__")))
so that they're exported from Wasm by the linker.- Finally,
bindings.c
implements no-op shims for all the WASI APIs so that they're linked internally and not attempted to be imported from the runtime itself.
The result is a WebAssembly module FFI-compatible with SpacetimeDB and with no WASI imports, which is what we need.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Linq.Expression.Optimizer (>= 1.0.15)
- SpacetimeDB.BSATN.Runtime (>= 0.10.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.10.0 | 77 | 6/13/2024 |
0.9.2 | 85 | 5/28/2024 |
0.9.0 | 88 | 5/22/2024 |
0.8.2 | 340 | 12/11/2023 |
0.8.2-naot-experimental | 77 | 1/10/2024 |
0.8.1 | 127 | 12/7/2023 |
0.8.0 | 105 | 11/30/2023 |
0.7.2 | 167 | 10/11/2023 |
0.7.1 | 116 | 10/3/2023 |
0.7.0 | 248 | 9/12/2023 |
0.6.4 | 195 | 8/14/2023 |
0.6.3 | 149 | 8/8/2023 |
0.6.2 | 141 | 8/7/2023 |
0.6.1 | 180 | 8/2/2023 |
0.6.0 | 152 | 8/2/2023 |