v0.12.0-beta
π It's happening! π
We've got a big one for you today! We've been burning the midnight oil to bring you the cream of the SpacetimeDB crop. We are updating and improving our APIs and interfaces across the board in an effort to stabilize and polish them up for a final release!
SpacetimeDB is getting closer and closer to a final 1.0 release and this is a huge milestone on that journey. These new APIs will allow us to implement some amazing new features and vastly improve the user experience of using SpacetimeDB across multiple languages and clients.
Module API
The module API has had it's most major overhaul since the announcement of SpacetimeDB. We're reducing the amount of globals and enforcing accessing the database via a ReducerContext.
Rust
#[reducer]
pub fn add(ctx: &ReducerContext, name: String) {
println!("Inserting {}", name);
ctx.db.person().insert(Person { name });
}CHECK IT OUT! The
#[spacetimedb(reducer)]macro has been simplified to just#[reducer]!
C#
[SpacetimeDB.Reducer]
public static void Add(ReducerContext ctx, string name)
{
Log.Info($"Inserting {name}");
ctx.Db.Person.Insert(new Person { Name = name });
}SDK API
The SDKs now share almost exactly the same API as you use to access your data inside your module.
let ctx = DbConnection.builder()
.with_url("https://testnet.spacetimedb.com")
.with_module_name("bitcraft")
.build();
...
for person in ctx.db.person().iter() {
println!("Hey, {}", person.name);
}C#
var conn = DbConnection.Builder()
.WithUri("https://testnet.spacetimedb.com")
.WithModuleName("bitcraft")
.Build();
...
foreach (var person in ctx.Db.Person.Iter())
{
Log.Info($"Hello, {person.Name}!");
}Now you can write your client code with the same patterns as your server code!
Migration Guide
Check out our full migration guide to update your code for v0.12 available in the docs section of our website.
CLI updates ποΈ
We've updated a lot of the args to the CLI to be more clear and consistent. If something gives you an errors, check --help to see if it's changed.
Some of the important changes:
spacetime local clear(to delete all local server data) is now calledspacetime server clearspacetime build --skip_clippy/-Sis now more explicitly--skip-println-checksspacetime logs database 10is nowspacetime logs database -n 10spacetime publishandspacetime generatenow accept a--build-optionsparam, e.g.spacetime publish --build-options="--debug --skip-println-checks"
Small clarity changes:
- All
--anon-identityparameters have been renamed to--anonymous spacetime energy statusis nowspacetime energy balancefor clarityspacetime publish --clear-databasehas been renamed tospacetime publish --delete-datafor clarityspacetime subscribe -nnow has a longform option--num-updatesspacetime publish|generate --wasm-file->spacetime publish|generate --bin-path
What's Changed (It's... uhh a lot)
- Fix flaky subscription smoketests by @bfops in #1536
- core: Start system table ids at 1 by @kim in #1544
- Remove support for the
updatereducer by @kim in #1557 - Get rid of python SDK by @Centril in #1561
- client-api: Remove publisher address by @kim in #1564
- Minor NFC improvements to C# Roslyn codegen by @RReverser in #1562
- SATS: Flatten
AlgebraicType, getting rid ofBuiltinTypeby @Centril in #1559 - Updating the change date in anticipation of the anniversary by @cloutiertyler in #1574
- Update README.md by @cloutiertyler in #1575
- Make
schemacrate publishable by @bfops in #1569 Typespace::is_nominal_normal_formby @kazimuth in #1549- Add lib::db::{column_ordering, raw_def::v9} by @kazimuth in #1542
- Change ResolveRefs to return a Result rather than an Option by @kazimuth in #1565
- Add support for
I256andU256by @Centril in #1477 - core: Use
Programinstead of(Hash, Box<[u8]>)by @kim in #1558 - Bump version to 0.12.0 by @bfops in #1578
- Fix iu BSATN implementations in C# by @RReverser in #1582
- C#: disable verbose test output in console by @RReverser in #1570
- Add helpers and change
CollectAllErrorsto be more composable by @kazimuth in #1586 - Preliminary Identifier validation by @kazimuth in #1584
- Allow empty
ColListby @Centril in #1588 - [CI] Do not use branch names when publishing container images by @kurtismullins in #1583
- Verify Unity compatibility in the shared C# codegen by @RReverser in #1576
- Fix builds for MacOS amd64 platform by @kurtismullins in #1598
- [WASM ABI 1.0] Change
ColIdfromu32tou16by @Centril in #1597 - [WASM ABI 1.0]
__call_reducer__receives Identity & Address by value by @Centril in #1607 - [WASM ABI 1.0] impl
__call_reducer__usingbytes_source_readby @Centril in #1609 - Placate some clippy errors in
snapshotby @kazimuth in #1611 - fix: Always remember to release a read only tx by @joshua-spacetime in #1613
- NFC: enforce style for C# locally and on CI by @RReverser in #1567
- Make
ScheduleAtspecial +Typespace::is_valid_for_client_code_generationby @kazimuth in #1590 - Dedup schedueler queue by @Shubham8287 in #1587
- Updated docker internal port to 3000 by @jdetter in #1626
- Add volatile_nonatomic_schedule_immediate by @coolreader18 in #1612
- NFC: use record for BigInt equality and hash by @RReverser in #1633
- smoketests: Test unauthorized publish without -c by @kim in #1632
- [WASM ABI 1.0] impl
__call_reducer__&__describe_module__usingbytes_sink_writeby @Centril in #1615 - ABI v9 validation code by @kazimuth in #1572
- Fix ptr mutability of some new C# FFIs by @RReverser in #1645
- WASM ABI: implement
row_iter_bsatn_advance&row_iter_bsatn_closeby @Centril in #1622 - WASM ABI:
get_table_id->table_id_from_nameby @Centril in #1634 - WASM ABI: add
datastore_table_row_countby @Centril in #1636 - [WASM ABI 1.0] Fix
bytes_source_readby @kim in #1646 - Add backwards-compatible validation for RawModuleDefV8. by @kazimuth in #1606
- Allow converting new ModuleDef to old TableSchema by @kazimuth in #1630
- Fix flaky smoketest due to race condition in subscribe by @coolreader18 in #1656
- Update SQL AST in accordance with the SQL spec by @mamcx in #1623
- WASM ABI:
iter_start->datastore_table_scan_bsatnby @Centril in #1637 - WASM ABI:
delete_by_rel->datastore_delete_all_by_eq_bsatnby @Centril in #1638 - Add edition to .rustfmt.toml by @gefjon in #1663
- bindings-csharp: pass
address_1by @Centril in #1621 - C#: split table codegen logic from type codegen logic by @RReverser in #1573
- WASM ABI:
insert->datastore_insert_bsatn& impl new semantics by @Centril in #1639 - WASM ABI: implement console ABIs by @Centril in #1664
- C# module benchmarks by @RReverser in #1679
- Auto-generate C# ModuleDef bindings from Rust by @RReverser in #1680
- Impl macro rework by @coolreader18 in #1314
- commitlog: Make commit module public, and allow access to header fields by @kim in #1685
- C#: hide ReadGenFields from the public API by @RReverser in #1690
- Fix table codegen wrt table names by @coolreader18 in #1689
- Switched table names to singular by @cloutiertyler in #1684
- Add spacetimedb_primitives::col_list::ColSet by @kazimuth in #1691
- Add schema::type_for_generate, update validation to use it by @kazimuth in #1661
- Automatic migration planning by @kazimuth in #1658
- Bump bytemuck by @kim in #1686
- WASM ABI: add
datastore_btree_scan_bsatn&index_id_from_nameby @Centril in #1699 - Fix heisenbug by using petgraph by @kazimuth in #1712
- NFC: enforce more C# code style + enable it in Visual Studio by @RReverser in #1687
- snapshot: pub access to snapshot file + object repo by @kim in #1709
- CI - Discord PR merge notification includes status of
Internal testscheck by @bfops in #1713 - feat: sql type checking and logical plan by @joshua-spacetime in #1708
- Switch Rust codegen to use new ModuleDef by @coolreader18 in #1675
- Stopwatch and reducer rng by @SteveBoytsun in #1681
- WASM ABI: add
datastore_delete_by_btree_scan_bsatnby @Centril in #1704 - Fixes showing server errors on
cli sqlcalls by @mamcx in #1720 - CI - Discord post will ping a particular role if CI check was not successful by @bfops in #1715
- CLI - Remove admin
energysubcommands by @bfops in #1695 - CLI - Print out config path when saving by @bfops in #1673
- CLI - Fix helptext for
spacetime sqlby @bfops in #1667 - Remove reserved identifiers by @kazimuth in #1724
- cli: Remove dbg! by @kim in #1722
- CLI - Remove unused
tracelog.rsby @bfops in #1693 - [C#] [NFC] Reuse attribute classes from runtime by @RReverser in #1718
- Logging API by @SteveBoytsun in #1714
- Fix C# CI by @RReverser in #1734
- perf: Use type ids for type checking by @joshua-spacetime in #1725
- Commitlog offset index by @Shubham8287 in #1671
- CLI - Remove project-specific config files by @bfops in #1665
- smoketests: Allow to skip tests requiring dotnet by @kim in #1726
- CLI - Exit when config is malformed by @bfops in #1669
- CLI - Unify copies of the confirmation/
--forcelogic by @bfops in #1740 - feat: Type check DML by @joshua-spacetime in #1727
- snapshot: More
Snapshotaccessors by @kim in #1721 - Downlevel some info messages by @Shubham8287 in #1739
- Update TableSchema & system tables to resemble ABI V9 by @kazimuth in #1697
- Fix btree_scan by @coolreader18 in #1748
- Name the iterator type returned from btree_scan by @coolreader18 in #1749
- Jeremie/cs module by @lcodes in #1719
- WASM ABI: Strip leading underscore from syscall names by @Centril in #1705
- Minor attribute cleanups for C# module by @RReverser in #1753
- Add C# diagnostics support by @RReverser in #1688
- Make our sats<->serde translation compatible with RON by @coolreader18 in #1738
- client-api: Fix publish error reporting by @kim in #1750
- Rust module API rework by @coolreader18 in #1660
- Tighten package sources in C# smoketests by @RReverser in #1735
- CLI - Change default server back to
localby @bfops in #1745 - CLI -
publishandgeneratetake a--build-optionsparam by @bfops in #1742 - CLI -
local clear->server clearby @bfops in #1759 - CLI -
--anon-identity->--anonymousby @bfops in #1751 - Fix C# visibility check
by @RReverser in #1765 - Rework Rust SDK for new API by @gefjon in #1692
- [C#] Fix table view names and duplicate table registration by @RReverser in #1757
- CLI -
--force->--yes/-yby @bfops in #1752 - Remove the
expandoption on thedescriberoute by @bfops in #1755 - Rename unstable_abi to unstable by @coolreader18 in #1767
- refactor: Intern names in relation expressions by @joshua-spacetime in #1754
- CLI stabilization by @bfops in #1741
- [C#] Remove .Query support by @RReverser in #1772
- feat: Integrate type checking into current query code by @joshua-spacetime in #1756
client-api: make someBAD_REQUESTintoNOT_FOUNDby @Centril in #1768- [C#] Mark experimental API by @RReverser in #1769
- Generic and optimized WebSocket API by @Centril in #1761
- Replace iter_by_col_eq in UniqueColumn impl by @coolreader18 in #1771
- CLI -
spacetime generatealways deletes stale files by @bfops in #1774 - [C#] Migrate bench-cs to the new API by @RReverser in #1758
- Filter out deps that only is added to keccack on arm that broke local testing by @mamcx in #1711
- Ensure C# autogen bindings are up-to-date by @RReverser in #1780
- [C#] [Reducers] Implement new context fields, enum-based kinds, validation by @RReverser in #1729
- Remove abi functions that are no longer needed by @coolreader18 in #1777
- [bindings-csharp] Upgrade WASI SDK & enable for ARM64 by @RReverser in #1775
- commitlog: Return commit info by @kim in #1778
- More obsolete cleanup by @RReverser in #1782
- Fix
RowSizeHint::index_to_rangeby @Centril in #1785 - CLI - Fix identity removal helptext by @bfops in #1784
- Implemented TypeScript SDK proposal codegen by @cloutiertyler in #1776
- Fix a rustfmt issue that occurs during rust client code generation by @jdetter in #1793
- [C#] [NFC] Some tweaks to the diagnostic tests by @RReverser in #1792
- CLI - Remove the always-save-config behavior by @bfops in #1799
- Small fixes to TypeScript codegen by @cloutiertyler in #1800
- c# client generate by @lcodes in #1707
Full Changelog: v0.11.1-beta...v0.12.0-beta