Skip to content

Release v2.6.0

Latest

Choose a tag to compare

@rekhoff rekhoff released this 16 Jun 22:07
· 11 commits to master since this release
31fd1c8

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, and preallocate_segments configuration options to config.toml for the commitlog. The default write_buffer_size has been increased from 8KiB to 128KiB to 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

Full Changelog: v2.5.0...v2.6.0