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 clear
spacetime build --skip_clippy
/-S
is now more explicitly--skip-println-checks
spacetime logs database 10
is nowspacetime logs database -n 10
spacetime publish
andspacetime generate
now accept a--build-options
param, e.g.spacetime publish --build-options="--debug --skip-println-checks"
Small clarity changes:
- All
--anon-identity
parameters have been renamed to--anonymous
spacetime energy status
is nowspacetime energy balance
for clarityspacetime publish --clear-database
has been renamed tospacetime publish --delete-data
for clarityspacetime subscribe -n
now has a longform option--num-updates
spacetime 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
update
reducer 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 ofBuiltinType
by @Centril in #1559 - Updating the change date in anticipation of the anniversary by @cloutiertyler in #1574
- Update README.md by @cloutiertyler in #1575
- Make
schema
crate publishable by @bfops in #1569 Typespace::is_nominal_normal_form
by @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
I256
andU256
by @Centril in #1477 - core: Use
Program
instead 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
CollectAllErrors
to be more composable by @kazimuth in #1586 - Preliminary Identifier validation by @kazimuth in #1584
- Allow empty
ColList
by @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
ColId
fromu32
tou16
by @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_read
by @Centril in #1609 - Placate some clippy errors in
snapshot
by @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
ScheduleAt
special +Typespace::is_valid_for_client_code_generation
by @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_write
by @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_close
by @Centril in #1622 - WASM ABI:
get_table_id
->table_id_from_name
by @Centril in #1634 - WASM ABI: add
datastore_table_row_count
by @Centril in #1636 - [WASM ABI 1.0] Fix
bytes_source_read
by @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_bsatn
by @Centril in #1637 - WASM ABI:
delete_by_rel
->datastore_delete_all_by_eq_bsatn
by @Centril in #1638 - Add edition to .rustfmt.toml by @gefjon in #1663
- bindings-csharp: pass
address_1
by @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_name
by @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 tests
check 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_bsatn
by @Centril in #1704 - Fixes showing server errors on
cli sql
calls 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
energy
subcommands by @bfops in #1695 - CLI - Print out config path when saving by @bfops in #1673
- CLI - Fix helptext for
spacetime sql
by @bfops in #1667 - Remove reserved identifiers by @kazimuth in #1724
- cli: Remove dbg! by @kim in #1722
- CLI - Remove unused
tracelog.rs
by @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/
--force
logic by @bfops in #1740 - feat: Type check DML by @joshua-spacetime in #1727
- snapshot: More
Snapshot
accessors 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
local
by @bfops in #1745 - CLI -
publish
andgenerate
take a--build-options
param by @bfops in #1742 - CLI -
local clear
->server clear
by @bfops in #1759 - CLI -
--anon-identity
->--anonymous
by @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
/-y
by @bfops in #1752 - Remove the
expand
option on thedescribe
route 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_REQUEST
intoNOT_FOUND
by @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 generate
always 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_range
by @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