2.6.0 adds Primary Key support for Views in Rust, TypeScript, and C#, improves event table automigrations, includes CLI binary distribution improvements, and brings various performance enhancements and bug fixes.
Features
Primary Key support for Views (Rust, TypeScript, and C#)
Procedural views now support primary keys in Rust, TypeScript, and C#
Note: C++ support for primary keys in views will be added in a future release.
-
Rust: Declare primary keys in the
#[view]macro:#[spacetimedb::view(accessor = my_players, public, primary_key = id)] pub fn my_players(ctx: &spacetimedb::ViewContext) -> Vec<Player> { ctx.db.players().owner().filter(ctx.sender()).collect() }
(#5111)
-
TypeScript: Declare primary keys at the column/row level:
const Player = t.row('Player', { id: t.u64().primaryKey(), owner: t.identity().index('btree'), name: t.string(), }); export const my_players = spacetimedb.view( { public: true }, t.array(players.rowType), ctx => Array.from(ctx.db.players.owner.filter(ctx.sender)) );
(#5111)
-
C#: Following Rust and TypeScript support in previous releases, C# modules can now declare primary keys on procedural views:
[SpacetimeDB.View(primaryKey: nameof(Player.Id))] public static List<Player> MyPlayers(ViewContext ctx) => ...
(#5246)
Performance & Correctness
- Commitlog configuration knobs: Added
max_segment_size,write_buffer_size, andpreallocate_segmentsconfiguration options toconfig.tomlfor the commitlog. The defaultwrite_buffer_sizehas been increased from8KiBto128KiBto optimize high-throughput workloads.
(#5074)
Bug Fixes
- Timestamp primary keys in C#: Timestamps can now be used as primary keys in C# modules, making C# consistent with the other module languages.
(#5262)
What's Changed
- Cross compile CLI binaries for ARM by @bfops in #5176
- Client binaries from DigitalOcean -> AWS by @bfops in #5077
- Add commitlog knobs to server config by @joshua-spacetime in #5074
- Add primary key support for procedural views to rust and ts modules by @joshua-spacetime in #5111
- Timestamps can be primary keys in C# by @joshua-spacetime in #5262
- Add primary keys to procedural views in C# by @joshua-spacetime in #5246
- Allow layout-altering automigrations of event tables by @gefjon in #5269
- Simplify CLA gate workflow by @clockwork-labs-bot in #5316
- docs: clarify deterministic reducer randomness by @clockwork-labs-bot in #5322
Full Changelog: v2.5.0...v2.6.0