From 47837065f73fbddfba3b681f1c13a72a10922cd5 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 21 Oct 2024 10:14:16 +0200 Subject: [PATCH 01/11] websocket: send/receive reducer & table ids instead of names --- Cargo.lock | 1 + crates/cli/src/subcommands/generate/mod.rs | 13 +- crates/cli/src/subcommands/generate/rust.rs | 177 +++++------ .../src/subcommands/generate/typescript.rs | 4 +- crates/cli/src/subcommands/generate/util.rs | 19 +- crates/cli/src/subcommands/subscribe.rs | 2 +- crates/client-api-messages/src/websocket.rs | 107 +++++-- crates/client-api/src/routes/subscribe.rs | 43 ++- crates/core/src/client/message_handlers.rs | 30 +- crates/core/src/client/messages.rs | 22 +- .../locking_tx_datastore/committed_state.rs | 6 +- .../locking_tx_datastore/datastore.rs | 1 - .../datastore/locking_tx_datastore/mut_tx.rs | 2 +- crates/core/src/db/datastore/system_tables.rs | 3 +- crates/core/src/db/datastore/traits.rs | 18 +- crates/core/src/db/relational_db.rs | 1 + crates/core/src/error.rs | 8 +- crates/core/src/host/host_controller.rs | 2 +- crates/core/src/host/mod.rs | 23 -- crates/core/src/host/module_host.rs | 137 +++++--- crates/core/src/host/scheduler.rs | 4 +- .../src/host/wasm_common/module_host_actor.rs | 9 +- crates/core/src/sql/ast.rs | 4 +- crates/core/src/sql/execute.rs | 4 +- .../core/src/subscription/execution_unit.rs | 7 +- .../module_subscription_manager.rs | 8 +- crates/core/src/subscription/subscription.rs | 23 +- crates/core/src/vm.rs | 2 +- crates/lib/src/db/error.rs | 11 +- crates/lib/src/relation.rs | 4 +- crates/primitives/src/ids.rs | 5 + crates/primitives/src/lib.rs | 2 +- crates/sats/src/de/impls.rs | 2 + crates/sats/src/primitives.rs | 3 +- crates/sats/src/ser/impls.rs | 1 + crates/sats/src/typespace.rs | 1 + crates/schema/src/schema.rs | 9 +- crates/sdk/Cargo.toml | 1 + .../identity_connected_reducer.rs | 9 +- .../identity_disconnected_reducer.rs | 10 +- .../module_bindings/init_reducer.rs | 14 +- .../module_bindings/message_table.rs | 2 +- .../quickstart-chat/module_bindings/mod.rs | 102 +++--- .../module_bindings/send_message_reducer.rs | 8 +- .../module_bindings/set_name_reducer.rs | 8 +- .../module_bindings/user_table.rs | 2 +- crates/sdk/src/callbacks.rs | 37 ++- crates/sdk/src/client_cache.rs | 24 +- crates/sdk/src/db_connection.rs | 300 ++++++++++++------ crates/sdk/src/event.rs | 21 +- crates/sdk/src/spacetime_module.rs | 30 +- crates/table/src/table.rs | 2 +- crates/testing/src/modules.rs | 16 +- crates/vm/src/expr.rs | 8 +- 54 files changed, 783 insertions(+), 529 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 689fa2e2f73..45256cfd17f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5342,6 +5342,7 @@ dependencies = [ "spacetimedb-client-api-messages", "spacetimedb-data-structures", "spacetimedb-lib", + "spacetimedb-primitives", "spacetimedb-sats", "spacetimedb-testing", "tokio", diff --git a/crates/cli/src/subcommands/generate/mod.rs b/crates/cli/src/subcommands/generate/mod.rs index f5d6d232526..911b3d78fdd 100644 --- a/crates/cli/src/subcommands/generate/mod.rs +++ b/crates/cli/src/subcommands/generate/mod.rs @@ -21,6 +21,7 @@ use spacetimedb_schema::schema::{Schema, TableSchema}; use std::fs; use std::ops::Deref; use std::path::{Path, PathBuf}; +use util::{iter_reducers, iter_tables}; use wasmtime::{Caller, StoreContextMut}; use crate::util::y_or_n; @@ -284,10 +285,10 @@ pub fn generate(module: RawModuleDef, lang: Language, namespace: &str) -> anyhow fn generate_lang(module: &ModuleDef, lang: impl Lang, namespace: &str) -> Vec<(String, String)> { itertools::chain!( - module.tables().map(|tbl| { + iter_tables(module).enumerate().map(|(idx, tbl)| { ( lang.table_filename(module, tbl), - lang.generate_table(module, namespace, tbl), + lang.generate_table(idx as u32, module, namespace, tbl), ) }), module.types().map(|typ| { @@ -296,10 +297,10 @@ fn generate_lang(module: &ModuleDef, lang: impl Lang, namespace: &str) -> Vec<(S lang.generate_type(module, namespace, typ), ) }), - module.reducers().map(|reducer| { + iter_reducers(module).enumerate().map(|(idx, reducer)| { ( lang.reducer_filename(&reducer.name), - lang.generate_reducer(module, namespace, reducer), + lang.generate_reducer(idx as u32, module, namespace, reducer), ) }), lang.generate_globals(module, namespace), @@ -312,9 +313,9 @@ trait Lang { fn type_filename(&self, type_name: &ScopedTypeName) -> String; fn reducer_filename(&self, reducer_name: &Identifier) -> String; - fn generate_table(&self, module: &ModuleDef, namespace: &str, tbl: &TableDef) -> String; + fn generate_table(&self, idx: u32, module: &ModuleDef, namespace: &str, tbl: &TableDef) -> String; fn generate_type(&self, module: &ModuleDef, namespace: &str, typ: &TypeDef) -> String; - fn generate_reducer(&self, module: &ModuleDef, namespace: &str, reducer: &ReducerDef) -> String; + fn generate_reducer(&self, idx: u32, module: &ModuleDef, namespace: &str, reducer: &ReducerDef) -> String; fn generate_globals(&self, module: &ModuleDef, namespace: &str) -> Vec<(String, String)>; } diff --git a/crates/cli/src/subcommands/generate/rust.rs b/crates/cli/src/subcommands/generate/rust.rs index b44c9dd47b8..496a142522c 100644 --- a/crates/cli/src/subcommands/generate/rust.rs +++ b/crates/cli/src/subcommands/generate/rust.rs @@ -1,5 +1,5 @@ use super::code_indenter::{CodeIndenter, Indenter}; -use super::util::{collect_case, print_lines, type_ref_name}; +use super::util::{collect_case, iter_reducers, iter_tables, print_lines, type_ref_name}; use super::Lang; use crate::generate::util::{namespace_is_empty_or_default, print_auto_generated_file_comment}; use convert_case::{Case, Casing}; @@ -89,7 +89,7 @@ impl __sdk::spacetime_module::InModule for {type_name} {{ output.into_inner() } - fn generate_table(&self, module: &ModuleDef, namespace: &str, table: &TableDef) -> String { + fn generate_table(&self, table_idx: u32, module: &ModuleDef, namespace: &str, table: &TableDef) -> String { assert!( namespace_is_empty_or_default(namespace), "Rust codegen does not support namespaces, as Rust equates namespaces with `mod`s. @@ -162,7 +162,7 @@ pub trait {accessor_trait} {{ impl {accessor_trait} for super::RemoteTables {{ fn {accessor_method}(&self) -> {table_handle}<'_> {{ {table_handle} {{ - imp: self.imp.get_table::<{row_type}>({table_name:?}), + imp: self.imp.get_table::<{row_type}>({table_idx}), ctx: std::marker::PhantomData, }} }} @@ -312,7 +312,7 @@ pub(super) fn parse_table_update( output.into_inner() } - fn generate_reducer(&self, module: &ModuleDef, namespace: &str, reducer: &ReducerDef) -> String { + fn generate_reducer(&self, reducer_idx: u32, module: &ModuleDef, namespace: &str, reducer: &ReducerDef) -> String { assert!( namespace_is_empty_or_default(namespace), "Rust codegen does not support namespaces, as Rust equates namespaces with `mod`s. @@ -417,19 +417,19 @@ pub trait {func_name} {{ impl {func_name} for super::RemoteReducers {{ fn {func_name}(&self, {arglist}) -> __anyhow::Result<()> {{ - self.imp.call_reducer({reducer_name:?}, {args_type} {{ {arg_names_list} }}) + self.imp.call_reducer({reducer_idx}, {args_type} {{ {arg_names_list} }}) }} fn on_{func_name}( &self, mut callback: impl FnMut(&super::EventContext, {arg_types_ref_list}) + Send + 'static, ) -> {callback_id} {{ {callback_id}(self.imp.on_reducer::<{args_type}>( - {reducer_name:?}, + {reducer_idx}, Box::new(move |ctx: &super::EventContext, args: &{args_type}| callback(ctx, {unboxed_arg_refs})), )) }} fn remove_on_{func_name}(&self, callback: {callback_id}) {{ - self.imp.remove_on_reducer::<{args_type}>({reducer_name:?}, callback.0) + self.imp.remove_on_reducer::<{args_type}>({reducer_idx}, callback.0) }} }} @@ -449,7 +449,7 @@ pub trait {set_reducer_flags_trait} {{ impl {set_reducer_flags_trait} for super::SetReducerFlags {{ fn {func_name}(&self, flags: __ws::CallReducerFlags) {{ - self.imp.set_call_reducer_flags({reducer_name:?}, flags); + self.imp.set_call_reducer_flags({reducer_idx}, flags); }} }} " @@ -763,20 +763,6 @@ fn print_module_reexports(module: &ModuleDef, out: &mut Indenter) { } } -/// Iterate over all the [`ReducerDef`]s defined by the module, in alphabetical order by name. -/// -/// Sorting is necessary to have deterministic reproducable codegen. -fn iter_reducers(module: &ModuleDef) -> impl Iterator { - module.reducers().sorted_by_key(|reducer| &reducer.name) -} - -/// Iterate over all the [`TableDef`]s defined by the module, in alphabetical order by name. -/// -/// Sorting is necessary to have deterministic reproducable codegen. -fn iter_tables(module: &ModuleDef) -> impl Iterator { - module.tables().sorted_by_key(|table| &table.name) -} - fn print_reducer_enum_defn(module: &ModuleDef, out: &mut Indenter) { print_enum_derives(out); writeln!( @@ -817,18 +803,13 @@ impl __sdk::spacetime_module::InModule for Reducer {{ "impl __sdk::spacetime_module::Reducer for Reducer {", |out| { out.delimited_block( - "fn reducer_name(&self) -> &'static str {", + "fn reducer_index(&self) -> u32 {", |out| { out.delimited_block( "match self {", |out| { - for reducer in iter_reducers(module) { - writeln!( - out, - "Reducer::{}(_) => {:?},", - reducer_variant_name(&reducer.name), - reducer.name.deref(), - ); + for (idx, reducer) in iter_reducers(module).enumerate() { + writeln!(out, "Reducer::{}(_) => {idx},", reducer_variant_name(&reducer.name),); } }, "}\n", @@ -851,42 +832,45 @@ impl __sdk::spacetime_module::InModule for Reducer {{ }, "}\n", ); - }, - "}\n", - ); - - out.delimited_block( - "impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer {", - |out| { - writeln!(out, "type Error = __anyhow::Error;"); out.delimited_block( - "fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result {", - |out| { - out.delimited_block( - "match &value.reducer_name[..] {", - |out| { - for reducer in iter_reducers(module) { - writeln!( - out, - "{:?} => Ok(Reducer::{}(__sdk::spacetime_module::parse_reducer_args({:?}, &value.args)?)),", - reducer.name.deref(), - reducer_variant_name(&reducer.name), - reducer.name.deref(), - ); - } + "fn parse_call_info( + reducer_id_to_idx: &impl Fn(__ws::ReducerId) -> anyhow::Result, + raw: __ws::ReducerCallInfo<__ws::BsatnFormat>, + ) -> anyhow::Result {", + |out| { + out.delimited_block( + "use __sdk::spacetime_module::parse_reducer_args; + let reducer_idx = reducer_id_to_idx(raw.reducer_id)?; + let name = Self::reducer_names()[reducer_idx as usize]; + match reducer_id_to_idx(raw.reducer_id)? {", + |out| { + for (idx, reducer) in iter_reducers(module).enumerate() { writeln!( out, - "_ => Err(__anyhow::anyhow!(\"Unknown reducer {{:?}}\", value.reducer_name)),", + "{idx} => Ok(Reducer::{}(parse_reducer_args(name, &raw.args)?)),", + reducer_variant_name(&reducer.name), ); - }, - "}\n", - ) - }, + } + writeln!(out, "_ => unreachable!(),"); + }, + " + }\n", + ) + }, "}\n", ); + out.delimited_block( + "fn reducer_names() -> &'static [&'static str] {&[", + |out| { + for reducer in iter_reducers(module) { + writeln!(out, "{:?},", &reducer.name); + } + }, + "]}\n", + ); }, "}\n", - ) + ); } fn print_db_update_defn(module: &ModuleDef, out: &mut Indenter) { @@ -910,37 +894,6 @@ fn print_db_update_defn(module: &ModuleDef, out: &mut Indenter) { out.newline(); - out.delimited_block( - " -impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { - type Error = __anyhow::Error; - fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { - let mut db_update = DbUpdate::default(); - for table_update in raw.tables { - match &table_update.table_name[..] { -", - |out| { - for table in iter_tables(module) { - writeln!( - out, - "{:?} => db_update.{} = {}::parse_table_update(table_update)?,", - table.name.deref(), - table_method_name(&table.name), - table_module_name(&table.name), - ); - } - }, - " - unknown => __anyhow::bail!(\"Unknown table {unknown:?} in DatabaseUpdate\"), - } - } - Ok(db_update) - } -}", - ); - - out.newline(); - writeln!( out, " @@ -956,12 +909,11 @@ impl __sdk::spacetime_module::InModule for DbUpdate {{ out.delimited_block( "fn apply_to_client_cache(&self, cache: &mut __sdk::client_cache::ClientCache) {", |out| { - for table in iter_tables(module) { + for (idx, table) in iter_tables(module).enumerate() { writeln!( out, - "cache.apply_diff_to_table::<{}>({:?}, &self.{});", + "cache.apply_diff_to_table::<{}>({idx}, &self.{});", type_ref_name(module, table.product_type_ref), - table.name.deref(), table_method_name(&table.name), ); } @@ -972,18 +924,53 @@ impl __sdk::spacetime_module::InModule for DbUpdate {{ out.delimited_block( "fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::callbacks::DbCallbacks) {", |out| { - for table in iter_tables(module) { + for (idx, table) in iter_tables(module).enumerate() { writeln!( out, - "callbacks.invoke_table_row_callbacks::<{}>({:?}, &self.{}, event);", + "callbacks.invoke_table_row_callbacks::<{}>({idx}, &self.{}, event);", type_ref_name(module, table.product_type_ref), - table.name.deref(), table_method_name(&table.name), ); } }, "}\n", ); + + out.delimited_block( + "fn parse_update( + table_id_to_idx: &impl Fn(__ws::TableId) -> anyhow::Result, + raw: __ws::DatabaseUpdate<__ws::BsatnFormat>, + ) -> anyhow::Result { + let mut db_update = DbUpdate::default(); + for table_update in raw.tables { + match table_id_to_idx(table_update.table_id)? {", + |out| { + for (idx, table) in iter_tables(module).enumerate() { + writeln!( + out, + "{idx} => db_update.{} = {}::parse_table_update(table_update)?,", + table_method_name(&table.name), + table_module_name(&table.name), + ); + } + }, + " + _ => unreachable!(), + } + } + Ok(db_update) + }\n", + ); + + out.delimited_block( + "fn table_names() -> &'static [&'static str] {&[", + |out| { + for table in iter_tables(module) { + writeln!(out, "{:?},", &table.name); + } + }, + "]}\n" + ); }, "}\n", ); diff --git a/crates/cli/src/subcommands/generate/typescript.rs b/crates/cli/src/subcommands/generate/typescript.rs index 6cbbf63584b..f048553fe76 100644 --- a/crates/cli/src/subcommands/generate/typescript.rs +++ b/crates/cli/src/subcommands/generate/typescript.rs @@ -82,7 +82,7 @@ Requested namespace: {namespace}", output.into_inner() } - fn generate_table(&self, module: &ModuleDef, namespace: &str, table: &TableDef) -> String { + fn generate_table(&self, _idx: u32, module: &ModuleDef, namespace: &str, table: &TableDef) -> String { assert!( namespace_is_empty_or_default(namespace), "TypeScript codegen does not support namespaces, as TypeScript equates namespaces with files. @@ -260,7 +260,7 @@ removeOnUpdate = (cb: (ctx: EventContext, onRow: {row_type}, newRow: {row_type}) output.into_inner() } - fn generate_reducer(&self, module: &ModuleDef, namespace: &str, reducer: &ReducerDef) -> String { + fn generate_reducer(&self, _idx: u32, module: &ModuleDef, namespace: &str, reducer: &ReducerDef) -> String { assert!( namespace_is_empty_or_default(namespace), "TypeScript codegen does not support namespaces, as TypeScript equates namespaces with files. diff --git a/crates/cli/src/subcommands/generate/util.rs b/crates/cli/src/subcommands/generate/util.rs index e21ffc3e12f..38895293e16 100644 --- a/crates/cli/src/subcommands/generate/util.rs +++ b/crates/cli/src/subcommands/generate/util.rs @@ -8,7 +8,10 @@ use std::{ use convert_case::{Case, Casing}; use itertools::Itertools; use spacetimedb_lib::sats::AlgebraicTypeRef; -use spacetimedb_schema::{def::ModuleDef, identifier::Identifier}; +use spacetimedb_schema::{ + def::{ModuleDef, ReducerDef, TableDef}, + identifier::Identifier, +}; use super::code_indenter::Indenter; @@ -57,3 +60,17 @@ pub(super) fn type_ref_name(module: &ModuleDef, typeref: AlgebraicTypeRef) -> St let (name, _def) = module.type_def_from_ref(typeref).unwrap(); collect_case(Case::Pascal, name.name_segments()) } + +/// Iterate over all the [`TableDef`]s defined by the module, in alphabetical order by name. +/// +/// Sorting is necessary to have deterministic reproducable codegen. +pub(super) fn iter_tables(module: &ModuleDef) -> impl Iterator { + module.tables().sorted_by_key(|table| &table.name) +} + +/// Iterate over all the [`ReducerDef`]s defined by the module, in alphabetical order by name. +/// +/// Sorting is necessary to have deterministic reproducable codegen. +pub(super) fn iter_reducers(module: &ModuleDef) -> impl Iterator { + module.reducers().sorted_by_key(|reducer| &reducer.name) +} diff --git a/crates/cli/src/subcommands/subscribe.rs b/crates/cli/src/subcommands/subscribe.rs index ca67d8d0e62..98f8e7d0fd4 100644 --- a/crates/cli/src/subcommands/subscribe.rs +++ b/crates/cli/src/subcommands/subscribe.rs @@ -85,7 +85,7 @@ fn reformat_update<'a>( let table_schema = schema .tables .iter() - .find(|tbl| tbl.name == upd.table_name) + .find(|tbl| *tbl.name == *upd.table_name) .context("table not found in schema")?; let table_ty = schema.typespace.resolve(table_schema.product_type_ref); diff --git a/crates/client-api-messages/src/websocket.rs b/crates/client-api-messages/src/websocket.rs index dcd87313543..f6e28657586 100644 --- a/crates/client-api-messages/src/websocket.rs +++ b/crates/client-api-messages/src/websocket.rs @@ -25,7 +25,6 @@ use core::{ use enum_as_inner::EnumAsInner; use smallvec::SmallVec; use spacetimedb_lib::{Address, Identity}; -use spacetimedb_primitives::TableId; use spacetimedb_sats::{ bsatn::{self, ToBsatn}, de::{Deserialize, Error}, @@ -38,6 +37,8 @@ use std::{ sync::Arc, }; +pub use spacetimedb_primitives::{ReducerId, TableId}; + pub trait RowListLen { /// Returns the length of the list. fn len(&self) -> usize; @@ -76,6 +77,10 @@ pub trait WebsocketFormat: Sized { /// Convert a `QueryUpdate` into `Self::QueryUpdate`. /// This allows some formats to e.g., compress the update. fn into_query_update(qu: QueryUpdate, compression: Compression) -> Self::QueryUpdate; + + type OptionalName: SpacetimeType + for<'de> Deserialize<'de> + Serialize + Debug + Clone + Send; + + fn into_optional_name(name: &Arc) -> Self::OptionalName; } /// Messages sent from the client to the server. @@ -96,12 +101,12 @@ impl ClientMessage { pub fn map_args(self, f: impl FnOnce(Args) -> Args2) -> ClientMessage { match self { ClientMessage::CallReducer(CallReducer { - reducer, + reducer_id, args, request_id, flags, }) => ClientMessage::CallReducer(CallReducer { - reducer, + reducer_id, args: f(args), request_id, flags, @@ -118,8 +123,11 @@ impl ClientMessage { #[derive(SpacetimeType)] #[sats(crate = spacetimedb_lib)] pub struct CallReducer { - /// The name of the reducer to call. - pub reducer: Box, + /// The id of the reducer to call. + /// + /// The ID was previously sent to the client in [`IdsToNames`]. + /// This id is valid for the websocket session and cannot be assumed valid beyond that. + pub reducer_id: ReducerId, /// The arguments to the reducer. /// /// In the wire format, this will be a [`Bytes`], BSATN or JSON encoded according to the reducer's argument schema @@ -180,6 +188,8 @@ impl_deserialize!([] CallReducerFlags, de => match de.deserialize_u8()? { #[sats(crate = spacetimedb_lib)] pub struct Subscribe { /// A sequence of SQL queries. + // TODO(centril, perf, 2.0): consider making this a BSATN encoding + // of a SQL-like structure which uses ids directly rather than names. pub query_strings: Box<[Box]>, pub request_id: u32, } @@ -219,7 +229,7 @@ pub enum ServerMessage { /// Upon reducer run, but limited to just the table updates. TransactionUpdateLight(TransactionUpdateLight), /// After connecting, to inform client of its identity. - IdentityToken(IdentityToken), + AfterConnecting(AfterConnecting), /// Return results to a one off SQL query. OneOffQueryResponse(OneOffQueryResponse), } @@ -237,7 +247,39 @@ pub struct InitialSubscription { pub total_host_execution_duration_micros: u64, } -/// Received by database from client to inform of user's identity, token and client address. +/// The first reply the client sends immediately after establishing the websocket connection. +/// This should be used to establish identity and credentials, +/// as well as establishing id-to-name mappings to understand the ids the host will send later on. +#[derive(SpacetimeType, Debug)] +#[sats(crate = spacetimedb_lib)] +pub struct AfterConnecting { + pub identity_token: IdentityToken, + pub ids_to_names: IdsToNames, +} + +/// The id <-> name mappings for reducers and tables. +/// +/// This will contain all mappings in the module that the client is authorized to see, +#[derive(SpacetimeType, Debug)] +#[sats(crate = spacetimedb_lib)] +pub struct IdsToNames { + /// A list of ids of all the reducers defined in the module. + /// Each entry in the list corresponds to one, for the same index, in `self.reducer_names`. + pub reducer_ids: Box<[ReducerId]>, + /// A list of names of all the reducers defined in the module. + /// Each entry in the list corresponds to one, for the same index, in `self.reducer_ids`. + /// This list is always lexicographically sorted. + pub reducer_names: Box<[Arc]>, + /// A list of ids of all the tables defined in the module. + /// Each entry in the list corresponds to one, for the same index, in `self.table_names`. + pub table_ids: Box<[TableId]>, + /// A list of names of all the tables defined in the module. + /// Each entry in the list corresponds to one, for the same index, in `self.table_ids`. + /// This list is always lexicographically sorted. + pub table_names: Box<[Arc]>, +} + +/// Received by client from the host to inform of user's identity, token and client address. /// /// The database will always send an `IdentityToken` message /// as the first message for a new WebSocket connection. @@ -308,16 +350,13 @@ pub struct TransactionUpdateLight { #[derive(SpacetimeType, Debug)] #[sats(crate = spacetimedb_lib)] pub struct ReducerCallInfo { - /// The name of the reducer that was called. - /// - /// NOTE(centril, 1.0): For bandwidth resource constrained clients - /// this can encourage them to have poor naming of reducers like `a`. - /// We should consider not sending this at all and instead - /// having a startup message where the name <-> id bindings - /// are established between the host and the client. - pub reducer_name: Box, /// The numerical id of the reducer that was called. - pub reducer_id: u32, + /// + /// The ID was previously sent to the client in [`IdsToNames`]. + /// This id is valid for the websocket session and cannot be assumed valid beyond that. + pub reducer_id: ReducerId, + /// The name of the reducer, optionally available for the format. + pub reducer_name: F::OptionalName, /// The arguments to the reducer, encoded as BSATN or JSON according to the reducer's argument schema /// and the client's requested protocol. pub args: F::Single, @@ -372,15 +411,14 @@ impl FromIterator> for DatabaseUpdate { /// We might want to consider `v1.spacetimedb.bsatn.lightweight` #[derive(SpacetimeType, Debug, Clone)] #[sats(crate = spacetimedb_lib)] -pub struct TableUpdate { - /// The id of the table. Clients should prefer `table_name`, as it is a stable part of a module's API, - /// whereas `table_id` may change between runs. - pub table_id: TableId, - /// The name of the table. +pub struct TableUpdate { + /// The id of the table. /// - /// NOTE(centril, 1.0): we might want to remove this and instead - /// tell clients about changes to table_name <-> table_id mappings. - pub table_name: Box, + /// The ID was previously sent to the client in [`IdsToNames`]. + /// This id is valid for the websocket session and cannot be assumed valid beyond that. + pub table_id: TableId, + /// The name of the table, optionally available for the format. + pub table_name: F::OptionalName, /// The sum total of rows in `self.updates`, pub num_rows: u64, /// The actual insert and delete updates for this table. @@ -388,10 +426,10 @@ pub struct TableUpdate { } impl TableUpdate { - pub fn new(table_id: TableId, table_name: Box, (update, num_rows): (F::QueryUpdate, u64)) -> Self { + pub fn new(table_id: TableId, table_name: &Arc, (update, num_rows): (F::QueryUpdate, u64)) -> Self { Self { table_id, - table_name, + table_name: F::into_optional_name(table_name), num_rows, updates: [update].into(), } @@ -472,8 +510,11 @@ pub struct OneOffQueryResponse { #[derive(SpacetimeType, Debug)] #[sats(crate = spacetimedb_lib)] pub struct OneOffTable { - /// The name of the table. - pub table_name: Box, + /// The id of the table. + /// + /// The ID was previously sent to the client in [`IdsToNames`]. + /// This id is valid for the websocket session and cannot be assumed valid beyond that. + pub table_id: TableId, /// The set of rows which matched the query, encoded as BSATN or JSON according to the table's schema /// and the client's requested protocol. /// @@ -522,6 +563,12 @@ impl WebsocketFormat for JsonFormat { fn into_query_update(qu: QueryUpdate, _: Compression) -> Self::QueryUpdate { qu } + + type OptionalName = Arc; + + fn into_optional_name(name: &Arc) -> Self::OptionalName { + name.clone() + } } #[derive(Clone, Copy, Default, Debug, SpacetimeType)] @@ -581,6 +628,10 @@ impl WebsocketFormat for BsatnFormat { } } } + + type OptionalName = (); + + fn into_optional_name(_: &Arc) -> Self::OptionalName {} } /// A specification of either a desired or decided compression algorithm. diff --git a/crates/client-api/src/routes/subscribe.rs b/crates/client-api/src/routes/subscribe.rs index 4368e49d291..8ea8d073394 100644 --- a/crates/client-api/src/routes/subscribe.rs +++ b/crates/client-api/src/routes/subscribe.rs @@ -12,12 +12,12 @@ use futures::{Future, FutureExt, SinkExt, StreamExt}; use http::{HeaderValue, StatusCode}; use scopeguard::ScopeGuard; use serde::Deserialize; -use spacetimedb::client::messages::{serialize, IdentityTokenMessage, SerializableMessage}; +use spacetimedb::client::messages::{serialize, SerializableMessage}; use spacetimedb::client::{ClientActorId, ClientConfig, ClientConnection, DataMessage, MessageHandleError, Protocol}; use spacetimedb::host::NoSuchModule; use spacetimedb::util::also_poll; use spacetimedb::worker_metrics::WORKER_METRICS; -use spacetimedb_client_api_messages::websocket::Compression; +use spacetimedb_client_api_messages::websocket::{AfterConnecting, Compression, IdentityToken}; use spacetimedb_lib::address::AddressForUrl; use spacetimedb_lib::Address; use std::time::Instant; @@ -155,24 +155,37 @@ where } }; - // Send the client their identity token message as the first message - // NOTE: We're adding this to the protocol because some client libraries are - // unable to access the http response headers. - // Clients that receive the token from the response headers should ignore this - // message. - let message = IdentityTokenMessage { - identity: auth.identity, - token: identity_token, - address: client_address, - }; - if let Err(e) = client.send_message(message) { - log::warn!("{e}, before identity token was sent") - } + send_after_connecting_message(auth, identity_token, client_address, client); }); Ok(res) } +/// Send the client a first message after connecting. +/// This will include: +/// +/// 1. their identity token. +/// NOTE: We're adding this to the protocol because some client libraries are +/// unable to access the http response headers. +/// Clients that receive the token from the response headers should ignore this value. +/// +/// 2. mappings from/to ids and names for reducers and tables. +/// Clients must use these mappings +/// if they do not wish to rely on the ids but rather rely on names instead. +fn send_after_connecting_message(auth: SpacetimeAuth, token: Box, address: Address, client: ClientConnection) { + let message = AfterConnecting { + ids_to_names: client.module.ids_to_names(auth.identity), + identity_token: IdentityToken { + identity: auth.identity, + token, + address, + }, + }; + if let Err(e) = client.send_message(message) { + log::warn!("{e}, before identity token was sent") + } +} + const LIVELINESS_TIMEOUT: Duration = Duration::from_secs(60); async fn ws_client_actor(client: ClientConnection, ws: WebSocketStream, sendrx: mpsc::Receiver) { diff --git a/crates/core/src/client/message_handlers.rs b/crates/core/src/client/message_handlers.rs index af59b101602..af52a9f3a1e 100644 --- a/crates/core/src/client/message_handlers.rs +++ b/crates/core/src/client/message_handlers.rs @@ -3,7 +3,7 @@ use super::{ClientConnection, DataMessage}; use crate::energy::EnergyQuanta; use crate::execution_context::WorkloadType; use crate::host::module_host::{EventStatus, ModuleEvent, ModuleFunctionCall}; -use crate::host::{ReducerArgs, ReducerId, Timestamp}; +use crate::host::{ReducerArgs, ReducerCallError, Timestamp}; use crate::identity::Identity; use crate::messages::websocket::{CallReducer, ClientMessage, OneOffQuery}; use crate::worker_metrics::WORKER_METRICS; @@ -12,6 +12,7 @@ use bytestring::ByteString; use spacetimedb_lib::de::serde::DeserializeWrapper; use spacetimedb_lib::identity::RequestId; use spacetimedb_lib::{bsatn, Address}; +use spacetimedb_primitives::ReducerId; use std::sync::Arc; use std::time::{Duration, Instant}; @@ -61,20 +62,31 @@ pub async fn handle(client: &ClientConnection, message: DataMessage, timer: Inst let address = client.module.info().database_identity; let res = match message { ClientMessage::CallReducer(CallReducer { - ref reducer, + reducer_id, args, request_id, flags, }) => { - let res = client.call_reducer(reducer, args, request_id, timer, flags).await; + // Translate `reducer_id` to its name. + let reducer_name = client.module.info().reducers_map.lookup_name(reducer_id); + let reducer_name_for_metrics = reducer_name.as_deref().unwrap_or(""); + + // Call the reducer. + let res = match &reducer_name { + Some(reducer) => client.call_reducer(reducer, args, request_id, timer, flags).await, + None => Err(ReducerCallError::NoSuchReducer), + }; + + // Record roundtrip metrics. WORKER_METRICS .request_round_trip - .with_label_values(&WorkloadType::Reducer, &address, reducer) + .with_label_values(&WorkloadType::Reducer, &address, reducer_name_for_metrics) .observe(timer.elapsed().as_secs_f64()); + res.map(drop).map_err(|e| { ( - Some(reducer), - client.module.info().reducers_map.lookup_id(reducer), + client.module.info().reducers_map.lookup_name(reducer_id), + Some(reducer_id), e.into(), ) }) @@ -100,7 +112,7 @@ pub async fn handle(client: &ClientConnection, message: DataMessage, timer: Inst } }; res.map_err(|(reducer, reducer_id, err)| MessageExecutionError { - reducer: reducer.cloned(), + reducer, reducer_id, caller_identity: client.id.identity, caller_address: Some(client.id.address), @@ -113,7 +125,7 @@ pub async fn handle(client: &ClientConnection, message: DataMessage, timer: Inst #[derive(thiserror::Error, Debug)] #[error("error executing message (reducer: {reducer:?}) (err: {err:?})")] pub struct MessageExecutionError { - pub reducer: Option>, + pub reducer: Option>, pub reducer_id: Option, pub caller_identity: Identity, pub caller_address: Option
, @@ -128,7 +140,7 @@ impl MessageExecutionError { caller_identity: self.caller_identity, caller_address: self.caller_address, function_call: ModuleFunctionCall { - reducer: self.reducer.unwrap_or_else(|| "".into()).into(), + reducer: self.reducer.unwrap_or_else(|| "".into()), reducer_id: self.reducer_id.unwrap_or(u32::MAX.into()), args: Default::default(), }, diff --git a/crates/core/src/client/messages.rs b/crates/core/src/client/messages.rs index eacc330ebf4..6c99ccd8ec3 100644 --- a/crates/core/src/client/messages.rs +++ b/crates/core/src/client/messages.rs @@ -64,7 +64,7 @@ pub fn serialize(msg: impl ToProtocol, config: #[derive(Debug, From)] pub enum SerializableMessage { Query(OneOffQueryResponseMessage), - Identity(IdentityTokenMessage), + AfterConnecting(AfterConnectingMessage), Subscribe(SubscriptionUpdateMessage), TxUpdate(TransactionUpdateMessage), } @@ -75,7 +75,7 @@ impl SerializableMessage { Self::Query(msg) => Some(msg.num_rows()), Self::Subscribe(msg) => Some(msg.num_rows()), Self::TxUpdate(msg) => Some(msg.num_rows()), - Self::Identity(_) => None, + Self::AfterConnecting(_) => None, } } @@ -84,7 +84,7 @@ impl SerializableMessage { Self::Query(_) => Some(WorkloadType::Sql), Self::Subscribe(_) => Some(WorkloadType::Subscribe), Self::TxUpdate(_) => Some(WorkloadType::Update), - Self::Identity(_) => None, + Self::AfterConnecting(_) => None, } } } @@ -94,21 +94,21 @@ impl ToProtocol for SerializableMessage { fn to_protocol(self, protocol: Protocol) -> Self::Encoded { match self { SerializableMessage::Query(msg) => msg.to_protocol(protocol), - SerializableMessage::Identity(msg) => msg.to_protocol(protocol), + SerializableMessage::AfterConnecting(msg) => msg.to_protocol(protocol), SerializableMessage::Subscribe(msg) => msg.to_protocol(protocol), SerializableMessage::TxUpdate(msg) => msg.to_protocol(protocol), } } } -pub type IdentityTokenMessage = ws::IdentityToken; +pub type AfterConnectingMessage = ws::AfterConnecting; -impl ToProtocol for IdentityTokenMessage { +impl ToProtocol for AfterConnectingMessage { type Encoded = SwitchedServerMessage; fn to_protocol(self, protocol: Protocol) -> Self::Encoded { match protocol { - Protocol::Text => FormatSwitch::Json(ws::ServerMessage::IdentityToken(self)), - Protocol::Binary => FormatSwitch::Bsatn(ws::ServerMessage::IdentityToken(self)), + Protocol::Text => FormatSwitch::Json(ws::ServerMessage::AfterConnecting(self)), + Protocol::Binary => FormatSwitch::Bsatn(ws::ServerMessage::AfterConnecting(self)), } } } @@ -153,8 +153,8 @@ impl ToProtocol for TransactionUpdateMessage { status, caller_identity: event.caller_identity, reducer_call: ws::ReducerCallInfo { - reducer_name: event.function_call.reducer.to_owned().into(), - reducer_id: event.function_call.reducer_id.into(), + reducer_id: event.function_call.reducer_id, + reducer_name: F::into_optional_name(&event.function_call.reducer), args, request_id, }, @@ -264,7 +264,7 @@ impl ToProtocol for OneOffQueryResponseMessage { .results .into_iter() .map(|table| ws::OneOffTable { - table_name: table.head.table_name.clone(), + table_id: table.head.table_id, rows: F::encode_list(table.data.into_iter()).0, }) .collect(); diff --git a/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs b/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs index 8aa66b2387b..e77e3938dbf 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/committed_state.rs @@ -510,9 +510,8 @@ impl CommittedState { deletes.push(pv); } - let table_name = &*table.get_schema().table_name; - if !deletes.is_empty() { + let table_name = &table.get_schema().table_name; tx_data.set_deletes_for_table(table_id, table_name, deletes.into()); } } else if !row_ptrs.is_empty() { @@ -551,9 +550,8 @@ impl CommittedState { inserts.push(pv); } - let table_name = &*commit_table.get_schema().table_name; - if !inserts.is_empty() { + let table_name = &commit_table.get_schema().table_name; tx_data.set_inserts_for_table(table_id, table_name, inserts.into()); } diff --git a/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs b/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs index 121a8fc79f9..7c8b69fb500 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/datastore.rs @@ -899,7 +899,6 @@ impl spacetimedb_commitlog::payload::txdata::Visitor for ReplayVi reader: &mut R, ) -> std::result::Result { let schema = self.committed_state.schema_for_table(table_id)?; - // TODO: avoid clone let table_name = schema.table_name.clone(); let row = ProductValue::decode(schema.get_row_type(), reader)?; diff --git a/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs b/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs index b13b650db79..247b572a2d6 100644 --- a/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs +++ b/crates/core/src/db/datastore/locking_tx_datastore/mut_tx.rs @@ -107,7 +107,7 @@ impl MutTxId { // fail if the table already exists. let row = StTableRow { table_id: TableId::SENTINEL, - table_name: table_schema.table_name[..].into(), + table_name: table_schema.table_name.clone(), table_type: table_schema.table_type, table_access: table_schema.table_access, table_primary_key: table_schema.primary_key.map(Into::into), diff --git a/crates/core/src/db/datastore/system_tables.rs b/crates/core/src/db/datastore/system_tables.rs index df920a1db84..3050aa46490 100644 --- a/crates/core/src/db/datastore/system_tables.rs +++ b/crates/core/src/db/datastore/system_tables.rs @@ -38,6 +38,7 @@ use spacetimedb_vm::errors::{ErrorType, ErrorVm}; use spacetimedb_vm::ops::parse; use std::cell::RefCell; use std::str::FromStr; +use std::sync::Arc; use strum::Display; use v9::{RawModuleDefV9Builder, TableType}; @@ -483,7 +484,7 @@ pub(crate) fn system_table_schema(table_id: TableId) -> Option { #[sats(crate = spacetimedb_lib)] pub struct StTableRow { pub(crate) table_id: TableId, - pub(crate) table_name: Box, + pub(crate) table_name: Arc, pub(crate) table_type: StTableType, pub(crate) table_access: StAccess, /// The primary key of the table. diff --git a/crates/core/src/db/datastore/traits.rs b/crates/core/src/db/datastore/traits.rs index 0d7a0631c4b..6bd1fbd317c 100644 --- a/crates/core/src/db/datastore/traits.rs +++ b/crates/core/src/db/datastore/traits.rs @@ -173,7 +173,7 @@ pub struct TxData { deletes: BTreeMap>, /// Map of all `TableId`s in both `inserts` and `deletes` to their /// corresponding table name. - tables: IntMap, + tables: IntMap>, /// Tx offset of the transaction which performed these operations. /// /// `None` implies that `inserts` and `deletes` are both empty, @@ -198,15 +198,15 @@ impl TxData { } /// Set `rows` as the inserted rows for `(table_id, table_name)`. - pub fn set_inserts_for_table(&mut self, table_id: TableId, table_name: &str, rows: Arc<[ProductValue]>) { + pub fn set_inserts_for_table(&mut self, table_id: TableId, table_name: &Arc, rows: Arc<[ProductValue]>) { self.inserts.insert(table_id, rows); - self.tables.entry(table_id).or_insert_with(|| table_name.to_owned()); + self.tables.entry(table_id).or_insert_with(|| table_name.clone()); } /// Set `rows` as the deleted rows for `(table_id, table_name)`. - pub fn set_deletes_for_table(&mut self, table_id: TableId, table_name: &str, rows: Arc<[ProductValue]>) { + pub fn set_deletes_for_table(&mut self, table_id: TableId, table_name: &Arc, rows: Arc<[ProductValue]>) { self.deletes.insert(table_id, rows); - self.tables.entry(table_id).or_insert_with(|| table_name.to_owned()); + self.tables.entry(table_id).or_insert_with(|| table_name.clone()); } /// Obtain an iterator over the inserted rows per table. @@ -218,13 +218,13 @@ impl TxData { /// /// If you don't need access to the table name, [`Self::inserts`] is /// slightly more efficient. - pub fn inserts_with_table_name(&self) -> impl Iterator)> + '_ { + pub fn inserts_with_table_name(&self) -> impl Iterator, &Arc<[ProductValue]>)> + '_ { self.inserts.iter().map(|(table_id, rows)| { let table_name = self .tables .get(table_id) .expect("invalid `TxData`: partial table name mapping"); - (table_id, table_name.as_str(), rows) + (table_id, table_name, rows) }) } @@ -237,13 +237,13 @@ impl TxData { /// /// If you don't need access to the table name, [`Self::deletes`] is /// slightly more efficient. - pub fn deletes_with_table_name(&self) -> impl Iterator)> + '_ { + pub fn deletes_with_table_name(&self) -> impl Iterator, &Arc<[ProductValue]>)> + '_ { self.deletes.iter().map(|(table_id, rows)| { let table_name = self .tables .get(table_id) .expect("invalid `TxData`: partial table name mapping"); - (table_id, table_name.as_str(), rows) + (table_id, table_name, rows) }) } diff --git a/crates/core/src/db/relational_db.rs b/crates/core/src/db/relational_db.rs index 94faf39abb0..f4b3031e431 100644 --- a/crates/core/src/db/relational_db.rs +++ b/crates/core/src/db/relational_db.rs @@ -526,6 +526,7 @@ impl RelationalDB { self.inner.get_all_tables_mut_tx(tx) } + // TODO(perf, centril): this might not be perf sensitive, but the forced allocation here is unfortunate. pub fn get_all_tables(&self, tx: &Tx) -> Result>, DBError> { self.inner.get_all_tables_tx(tx) } diff --git a/crates/core/src/error.rs b/crates/core/src/error.rs index bc5661ef89c..a6c2e3269a6 100644 --- a/crates/core/src/error.rs +++ b/crates/core/src/error.rs @@ -1,7 +1,7 @@ use std::io; use std::num::ParseIntError; use std::path::PathBuf; -use std::sync::{MutexGuard, PoisonError}; +use std::sync::{Arc, MutexGuard, PoisonError}; use hex::FromHexError; use spacetimedb_expr::errors::TypingError; @@ -114,11 +114,11 @@ pub enum PlanError { #[error("Qualified Table `{expect}` not found")] TableNotFoundQualified { expect: String }, #[error("Unknown field: `{field}` not found in the table(s): `{tables:?}`")] - UnknownField { field: String, tables: Vec> }, + UnknownField { field: String, tables: Vec> }, #[error("Unknown field name: `{field}` not found in the table(s): `{tables:?}`")] - UnknownFieldName { field: FieldName, tables: Vec> }, + UnknownFieldName { field: FieldName, tables: Vec> }, #[error("Field(s): `{fields:?}` not found in the table(s): `{tables:?}`")] - UnknownFields { fields: Vec, tables: Vec> }, + UnknownFields { fields: Vec, tables: Vec> }, #[error("Ambiguous field: `{field}`. Also found in {found:?}")] AmbiguousField { field: String, found: Vec }, #[error("Plan error: `{0}`")] diff --git a/crates/core/src/host/host_controller.rs b/crates/core/src/host/host_controller.rs index eb52d8a63f5..4abdfae91d0 100644 --- a/crates/core/src/host/host_controller.rs +++ b/crates/core/src/host/host_controller.rs @@ -269,7 +269,7 @@ impl HostController { trace!("using database {}/{}", database.database_identity, replica_id); let module = self.get_or_launch_module_host(database, replica_id).await?; let on_panic = self.unregister_fn(replica_id); - let result = tokio::task::spawn_blocking(move || f(&module.replica_ctx().relational_db)) + let result = tokio::task::spawn_blocking(move || f(module.db())) .await .unwrap_or_else(|e| { warn!("database operation panicked"); diff --git a/crates/core/src/host/mod.rs b/crates/core/src/host/mod.rs index 1fd8aa462d6..534054aa4e1 100644 --- a/crates/core/src/host/mod.rs +++ b/crates/core/src/host/mod.rs @@ -100,29 +100,6 @@ impl Default for ArgsTuple { } } -#[derive(Copy, Clone, Debug, Default)] -pub struct ReducerId(u32); -impl std::fmt::Display for ReducerId { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - self.0.fmt(f) - } -} -impl From for ReducerId { - fn from(id: usize) -> Self { - Self(id as u32) - } -} -impl From for ReducerId { - fn from(id: u32) -> Self { - Self(id) - } -} -impl From for u32 { - fn from(id: ReducerId) -> Self { - id.0 - } -} - #[derive(thiserror::Error, Debug)] #[error("invalid arguments for reducer {reducer}: {err}")] pub struct InvalidReducerArguments { diff --git a/crates/core/src/host/module_host.rs b/crates/core/src/host/module_host.rs index 3b0c807b37a..eb07fad00bd 100644 --- a/crates/core/src/host/module_host.rs +++ b/crates/core/src/host/module_host.rs @@ -1,10 +1,11 @@ use super::wasm_common::{CLIENT_CONNECTED_DUNDER, CLIENT_DISCONNECTED_DUNDER}; -use super::{ArgsTuple, InvalidReducerArguments, ReducerArgs, ReducerCallResult, ReducerId}; +use super::{ArgsTuple, InvalidReducerArguments, ReducerArgs, ReducerCallResult}; use crate::client::{ClientActorId, ClientConnectionSender}; use crate::database_logger::{LogLevel, Record}; use crate::db::datastore::locking_tx_datastore::MutTxId; use crate::db::datastore::system_tables::{StClientFields, StClientRow, ST_CLIENT_ID}; use crate::db::datastore::traits::{IsolationLevel, Program, TxData}; +use crate::db::relational_db::RelationalDB; use crate::energy::EnergyQuanta; use crate::error::DBError; use crate::execution_context::{ExecutionContext, ReducerContext, Workload}; @@ -14,6 +15,7 @@ use crate::messages::control_db::Database; use crate::replica_context::ReplicaContext; use crate::sql; use crate::subscription::module_subscription_actor::ModuleSubscriptions; +use crate::subscription::subscription::is_table_visible; use crate::util::lending_pool::{Closed, LendingPool, LentResource, PoolClosed}; use crate::worker_metrics::WORKER_METRICS; use anyhow::Context; @@ -24,12 +26,12 @@ use indexmap::IndexSet; use itertools::Itertools; use smallvec::SmallVec; use spacetimedb_client_api_messages::timestamp::Timestamp; -use spacetimedb_client_api_messages::websocket::{Compression, QueryUpdate, WebsocketFormat}; +use spacetimedb_client_api_messages::websocket::{Compression, IdsToNames, QueryUpdate, WebsocketFormat}; use spacetimedb_data_structures::error_stream::ErrorStream; use spacetimedb_data_structures::map::{HashCollectionExt as _, IntMap}; use spacetimedb_lib::identity::{AuthCtx, RequestId}; use spacetimedb_lib::Address; -use spacetimedb_primitives::{col_list, TableId}; +use spacetimedb_primitives::{col_list, ReducerId, TableId}; use spacetimedb_sats::{algebraic_value, ProductValue}; use spacetimedb_schema::auto_migrate::AutoMigrateError; use spacetimedb_schema::def::deserialize::ReducerArgsDeserializeSeed; @@ -61,23 +63,25 @@ impl DatabaseUpdate { } pub fn from_writes(tx_data: &TxData) -> Self { - let mut map: IntMap = IntMap::new(); - let new_update = |table_id, table_name: &str| DatabaseTableUpdate { - table_id, - table_name: table_name.into(), - inserts: [].into(), - deletes: [].into(), - }; - for (table_id, table_name, rows) in tx_data.inserts_with_table_name() { - map.entry(*table_id) - .or_insert_with(|| new_update(*table_id, table_name)) - .inserts = rows.clone(); - } - for (table_id, table_name, rows) in tx_data.deletes_with_table_name() { - map.entry(*table_id) - .or_insert_with(|| new_update(*table_id, table_name)) - .deletes = rows.clone(); + type Map = IntMap; + fn extend_map<'a>( + map: &mut Map, + with: impl Iterator, &'a Arc<[ProductValue]>)>, + proj: impl Fn(&mut DatabaseTableUpdate) -> &mut Arc<[ProductValue]>, + ) { + for (table_id, table_name, rows) in with { + *proj(map.entry(*table_id).or_insert_with(|| DatabaseTableUpdate { + table_id: *table_id, + table_name: table_name.clone(), + inserts: [].into(), + deletes: [].into(), + })) = rows.clone(); + } } + + let mut map: Map = Map::new(); + extend_map(&mut map, tx_data.inserts_with_table_name(), |u| &mut u.inserts); + extend_map(&mut map, tx_data.deletes_with_table_name(), |u| &mut u.deletes); DatabaseUpdate { tables: map.into_values().collect(), } @@ -92,7 +96,7 @@ impl DatabaseUpdate { #[derive(Debug, Clone, PartialEq, Eq)] pub struct DatabaseTableUpdate { pub table_id: TableId, - pub table_name: Box, + pub table_name: Arc, // Note: `Arc<[ProductValue]>` allows to cheaply // use the values from `TxData` without cloning the // contained `ProductValue`s. @@ -108,7 +112,7 @@ pub struct DatabaseUpdateRelValue<'a> { #[derive(PartialEq, Debug)] pub struct DatabaseTableUpdateRelValue<'a> { pub table_id: TableId, - pub table_name: Box, + pub table_name: Arc, pub updates: UpdatesRelValue<'a>, } @@ -150,13 +154,23 @@ impl EventStatus { } } -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone)] pub struct ModuleFunctionCall { - pub reducer: String, + pub reducer: Arc, pub reducer_id: ReducerId, pub args: ArgsTuple, } +impl Default for ModuleFunctionCall { + fn default() -> Self { + Self { + reducer: "".into(), + reducer_id: <_>::default(), + args: <_>::default(), + } + } +} + #[derive(Debug, Clone)] pub struct ModuleEvent { pub timestamp: Timestamp, @@ -231,7 +245,7 @@ impl ModuleInfo { let name = self.reducers_map.lookup_name(reducer_id)?; Some( self.module_def - .reducer(name) + .reducer(&*name) .expect("id was present, so reducer should be present!"), ) } @@ -239,7 +253,7 @@ impl ModuleInfo { /// A bidirectional map between `Identifiers` (reducer names) and `ReducerId`s. /// Invariant: the reducer names are in alphabetical order. -pub struct ReducersMap(IndexSet>); +pub struct ReducersMap(IndexSet>); impl<'a> FromIterator<&'a str> for ReducersMap { fn from_iter>(iter: T) -> Self { @@ -262,9 +276,18 @@ impl ReducersMap { } /// Lookup the name for a reducer ID. - pub fn lookup_name(&self, reducer_id: ReducerId) -> Option<&str> { - let result = self.0.get_index(reducer_id.0 as _)?; - Some(&**result) + pub fn lookup_name(&self, reducer_id: ReducerId) -> Option> { + self.0.get_index(reducer_id.0 as _).cloned() + } + + /// Returns an iterator over all the [`ReducerId`]s in the module. + pub fn iter_ids(&self) -> impl Iterator { + (0..self.0.len()).map(ReducerId::from) + } + + /// Returns all the reducer names in the module. + pub fn iter_idents(&self) -> impl '_ + Iterator> { + self.0.iter().cloned() } } @@ -566,7 +589,7 @@ impl ModuleHost { CLIENT_DISCONNECTED_DUNDER }; - let db = &self.inner.replica_ctx().relational_db; + let db = self.db(); let workload = || { Workload::Reducer(ReducerContext { name: reducer_name.to_owned(), @@ -634,7 +657,7 @@ impl ModuleHost { caller_address: Address, connected: bool, ) -> Result<(), DBError> { - let db = &*self.inner.replica_ctx().relational_db; + let db = self.db(); let row = &StClientRow { identity: caller_identity.into(), @@ -753,7 +776,7 @@ impl ModuleHost { &self, call_reducer_params: impl FnOnce(&MutTxId) -> anyhow::Result> + Send + 'static, ) -> Result { - let db = self.inner.replica_ctx().relational_db.clone(); + let db = self.db().clone(); // scheduled reducer name not fetched yet, anyway this is only for logging purpose const REDUCER: &str = "scheduled_reducer"; let module = self.info.clone(); @@ -839,9 +862,8 @@ impl ModuleHost { #[tracing::instrument(skip_all)] pub fn one_off_query(&self, caller_identity: Identity, query: String) -> Result, anyhow::Error> { - let replica_ctx = self.replica_ctx(); - let db = &replica_ctx.relational_db; - let auth = AuthCtx::new(replica_ctx.owner_identity, caller_identity); + let db = self.db(); + let auth = self.auth_ctx_for(caller_identity); log::debug!("One-off query: {query}"); db.with_read_only(Workload::Sql, |tx| { @@ -855,8 +877,7 @@ impl ModuleHost { /// for tables without primary keys. It is only used in the benchmarks. /// Note: this doesn't drop the table, it just clears it! pub fn clear_table(&self, table_name: &str) -> Result<(), anyhow::Error> { - let db = &*self.replica_ctx().relational_db; - + let db = self.db(); db.with_auto_commit(Workload::Internal, |tx| { let tables = db.get_all_tables_mut(tx)?; // We currently have unique table names, @@ -883,9 +904,51 @@ impl ModuleHost { &self.replica_ctx().database } - pub(crate) fn replica_ctx(&self) -> &ReplicaContext { + fn replica_ctx(&self) -> &ReplicaContext { self.inner.replica_ctx() } + + pub fn db(&self) -> &Arc { + &self.replica_ctx().relational_db + } + + fn auth_ctx_for(&self, caller_identity: Identity) -> AuthCtx { + AuthCtx::new(self.replica_ctx().owner_identity, caller_identity) + } + + pub fn ids_to_names(&self, identity: Identity) -> IdsToNames { + // Compute the ids and names of reducers. + // Although we (the host) know that ids are just the index + // into the lexicographically sorted map of reducers, + // this is an implementation detail that we avoid exposing to the user as a guarantee. + // We do however guarantee clients that `reducer_names` is lexicographically sorted. + let reducers_map = &self.info().reducers_map; + let reducer_ids = reducers_map.iter_ids().collect(); + let reducer_names = reducers_map.iter_idents().collect(); + + // Compute the ids and names of tables. + // Ensure that the returned `table_names` are lexicographically sorted + // for the perf benefit of clients. + let db = self.db(); + let auth = self.auth_ctx_for(identity); + let (table_names, table_ids): (Vec<_>, Vec<_>) = db + .with_read_only(&ExecutionContext::internal(db.address()), |tx| db.get_all_tables(tx)) + .expect("ids_to_name: database in a broken state?") + .iter() + .filter(|schema| is_table_visible(schema, &auth)) + .map(|schema| (&schema.table_name, schema.table_id)) + // TODO(perf, centril): is this already sorted by name? + .sorted_unstable_by_key(|(name, _)| *name) + .map(|(name, id)| (name.clone(), id)) + .unzip(); + + IdsToNames { + reducer_ids, + reducer_names, + table_ids: table_ids.into(), + table_names: table_names.into(), + } + } } impl WeakModuleHost { diff --git a/crates/core/src/host/scheduler.rs b/crates/core/src/host/scheduler.rs index bd999513875..294e083ab29 100644 --- a/crates/core/src/host/scheduler.rs +++ b/crates/core/src/host/scheduler.rs @@ -301,7 +301,7 @@ impl SchedulerActor { let Some(module_host) = self.module_host.upgrade() else { return; }; - let db = module_host.replica_ctx().relational_db.clone(); + let db = module_host.db().clone(); let caller_identity = module_host.info().database_identity; let module_info = module_host.info.clone(); @@ -357,7 +357,7 @@ impl SchedulerActor { })) }; - let db = module_host.replica_ctx().relational_db.clone(); + let db = module_host.db().clone(); let module_host_clone = module_host.clone(); let res = tokio::spawn(async move { module_host.call_scheduled_reducer(call_reducer_params).await }).await; diff --git a/crates/core/src/host/wasm_common/module_host_actor.rs b/crates/core/src/host/wasm_common/module_host_actor.rs index 5ee0d84cb5d..e90116e4532 100644 --- a/crates/core/src/host/wasm_common/module_host_actor.rs +++ b/crates/core/src/host/wasm_common/module_host_actor.rs @@ -1,7 +1,7 @@ use anyhow::Context; use bytes::Bytes; use spacetimedb_client_api_messages::timestamp::Timestamp; -use spacetimedb_primitives::TableId; +use spacetimedb_primitives::{ReducerId, TableId}; use spacetimedb_schema::auto_migrate::ponder_migrate; use spacetimedb_schema::def::ModuleDef; use spacetimedb_schema::schema::{Schema, TableSchema}; @@ -19,7 +19,7 @@ use crate::host::instance_env::InstanceEnv; use crate::host::module_host::{ CallReducerParams, DatabaseUpdate, EventStatus, Module, ModuleEvent, ModuleFunctionCall, ModuleInfo, ModuleInstance, }; -use crate::host::{ArgsTuple, ReducerCallResult, ReducerId, ReducerOutcome, Scheduler, UpdateDatabaseResult}; +use crate::host::{ArgsTuple, ReducerCallResult, ReducerOutcome, Scheduler, UpdateDatabaseResult}; use crate::identity::Identity; use crate::messages::control_db::HostType; use crate::module_host_context::ModuleCreationContext; @@ -405,11 +405,12 @@ impl WasmModuleInstance { let replica_ctx = self.replica_context(); let stdb = &*replica_ctx.relational_db.clone(); let address = replica_ctx.database_identity; - let reducer_name = self + let reducer_name_arc = self .info .reducers_map .lookup_name(reducer_id) .expect("reducer not found"); + let reducer_name = &*reducer_name_arc; let _outer_span = tracing::trace_span!("call_reducer", reducer_name, @@ -528,7 +529,7 @@ impl WasmModuleInstance { caller_identity, caller_address: caller_address_opt, function_call: ModuleFunctionCall { - reducer: reducer_name.to_owned(), + reducer: reducer_name_arc, reducer_id, args, }, diff --git a/crates/core/src/sql/ast.rs b/crates/core/src/sql/ast.rs index 9ad49639863..a3da5e2e07c 100644 --- a/crates/core/src/sql/ast.rs +++ b/crates/core/src/sql/ast.rs @@ -166,8 +166,8 @@ impl From { .chain(self.joins.iter().map(|Join::Inner { rhs, .. }| &**rhs)) } - /// Returns all the table names as a `Vec`, including the ones inside the joins. - pub fn table_names(&self) -> Vec> { + /// Returns all the table names as a `Vec>`, including the ones inside the joins. + pub fn table_names(&self) -> Vec> { self.iter_tables().map(|x| x.table_name.clone()).collect() } diff --git a/crates/core/src/sql/execute.rs b/crates/core/src/sql/execute.rs index 4f55c09a034..39b195fcf0d 100644 --- a/crates/core/src/sql/execute.rs +++ b/crates/core/src/sql/execute.rs @@ -48,8 +48,8 @@ pub(crate) fn collect_result( None => {} Some(update) => { updates.push(DatabaseTableUpdate { - table_name: update.table_name, table_id: update.table_id, + table_name: update.table_name, inserts: update.inserts.into(), deletes: update.deletes.into(), }); @@ -126,7 +126,7 @@ pub fn execute_sql( caller_identity: auth.caller, caller_address: None, function_call: ModuleFunctionCall { - reducer: String::new(), + reducer: "".into(), reducer_id: u32::MAX.into(), args: ArgsTuple::default(), }, diff --git a/crates/core/src/subscription/execution_unit.rs b/crates/core/src/subscription/execution_unit.rs index f44df10503a..27726db3999 100644 --- a/crates/core/src/subscription/execution_unit.rs +++ b/crates/core/src/subscription/execution_unit.rs @@ -18,6 +18,7 @@ use spacetimedb_vm::expr::{AuthAccess, NoInMemUsed, Query, QueryExpr, SourceExpr use spacetimedb_vm::rel_ops::RelOps; use spacetimedb_vm::relation::RelValue; use std::hash::Hash; +use std::sync::Arc; use std::time::Duration; /// A hash for uniquely identifying query execution units, @@ -167,8 +168,8 @@ impl ExecutionUnit { self.return_db_table().table_id } - pub fn return_name(&self) -> Box { - self.return_db_table().head.table_name.clone() + pub fn return_name(&self) -> &Arc { + &self.return_db_table().head.table_name } /// The table on which this query filters rows. @@ -242,7 +243,7 @@ impl ExecutionUnit { updates.has_updates().then(|| DatabaseTableUpdateRelValue { table_id: self.return_table(), - table_name: self.return_name(), + table_name: self.return_name().clone(), updates, }) } diff --git a/crates/core/src/subscription/module_subscription_manager.rs b/crates/core/src/subscription/module_subscription_manager.rs index 3639a06589b..da4fa854879 100644 --- a/crates/core/src/subscription/module_subscription_manager.rs +++ b/crates/core/src/subscription/module_subscription_manager.rs @@ -156,8 +156,6 @@ impl SubscriptionManager { // we copy the DatabaseTableUpdate N times, // which involves cloning BSATN (binary) or product values (json). .flat_map_iter(|(hash, delta)| { - let table_id = delta.table_id; - let table_name = delta.table_name; // Store at most one copy of the serialization to BSATN // and ditto for the "serialization" for JSON. // Each subscriber gets to pick which of these they want, @@ -183,7 +181,7 @@ impl SubscriptionManager { Protocol::Binary => Bsatn(memo_encode::(&delta.updates, client, &mut ops_bin)), Protocol::Text => Json(memo_encode::(&delta.updates, client, &mut ops_json)), }; - (id, table_id, table_name.clone(), update) + (id, delta.table_id, delta.table_name.clone(), update) }) }) .collect::>() @@ -202,8 +200,8 @@ impl SubscriptionManager { Json((tbl_upd, update)) => tbl_upd.push(update), }, Entry::Vacant(entry) => drop(entry.insert(match update { - Bsatn(update) => Bsatn(TableUpdate::new(table_id, table_name, update)), - Json(update) => Json(TableUpdate::new(table_id, table_name, update)), + Bsatn(update) => Bsatn(TableUpdate::new(table_id, &table_name, update)), + Json(update) => Json(TableUpdate::new(table_id, &table_name, update)), })), } tables diff --git a/crates/core/src/subscription/subscription.rs b/crates/core/src/subscription/subscription.rs index c58de78e466..cc9191a4f0c 100644 --- a/crates/core/src/subscription/subscription.rs +++ b/crates/core/src/subscription/subscription.rs @@ -39,6 +39,7 @@ use spacetimedb_lib::identity::AuthCtx; use spacetimedb_lib::relation::DbTable; use spacetimedb_lib::{Identity, ProductValue}; use spacetimedb_primitives::TableId; +use spacetimedb_schema::schema::TableSchema; use spacetimedb_vm::expr::{self, AuthAccess, IndexJoin, Query, QueryExpr, SourceExpr, SourceProvider, SourceSet}; use spacetimedb_vm::rel_ops::RelOps; use spacetimedb_vm::relation::{MemTable, RelValue}; @@ -77,8 +78,8 @@ impl SupportedQuery { self.expr.source.get_db_table().unwrap().table_id } - pub fn return_name(&self) -> String { - self.expr.source.table_name().to_owned() + pub fn return_name(&self) -> &Arc { + self.expr.source.table_name() } /// This is the same as the return table unless this is a join. @@ -607,9 +608,7 @@ pub(crate) fn get_all(relational_db: &RelationalDB, tx: &Tx, auth: &AuthCtx) -> .get_all_tables(tx)? .iter() .map(Deref::deref) - .filter(|t| { - t.table_type == StTableType::User && (auth.owner == auth.caller || t.table_access == StAccess::Public) - }) + .filter(|table| is_table_visible(table, auth)) .map(|src| SupportedQuery { kind: query::Supported::Select, expr: QueryExpr::new(src), @@ -618,6 +617,10 @@ pub(crate) fn get_all(relational_db: &RelationalDB, tx: &Tx, auth: &AuthCtx) -> .collect()) } +pub(crate) fn is_table_visible(table: &TableSchema, auth: &AuthCtx) -> bool { + table.table_type == StTableType::User && (auth.owner == auth.caller || table.table_access == StAccess::Public) +} + #[cfg(test)] mod tests { use super::*; @@ -659,7 +662,7 @@ mod tests { panic!("unexpected result from compilation: {:#?}", exp); }; - assert_eq!(expr.source.table_name(), "lhs"); + assert_eq!(&**expr.source.table_name(), "lhs"); assert_eq!(expr.query.len(), 1); let join = expr.query.pop().unwrap(); @@ -674,7 +677,7 @@ mod tests { let (expr, _sources) = with_delta_table(join, Some(delta), None); let expr: QueryExpr = expr.into(); let mut expr = expr.optimize(&|_, _| i64::MAX); - assert_eq!(expr.source.table_name(), "lhs"); + assert_eq!(&**expr.source.table_name(), "lhs"); assert_eq!(expr.query.len(), 1); let join = expr.query.pop().unwrap(); @@ -739,7 +742,7 @@ mod tests { panic!("unexpected result from compilation: {:#?}", exp); }; - assert_eq!(expr.source.table_name(), "lhs"); + assert_eq!(&**expr.source.table_name(), "lhs"); assert_eq!(expr.query.len(), 1); let join = expr.query.pop().unwrap(); @@ -755,7 +758,7 @@ mod tests { let expr = QueryExpr::from(expr); let mut expr = expr.optimize(&|_, _| i64::MAX); - assert_eq!(expr.source.table_name(), "lhs"); + assert_eq!(&**expr.source.table_name(), "lhs"); assert_eq!(expr.query.len(), 1); assert!(expr.source.is_db_table()); @@ -826,7 +829,7 @@ mod tests { panic!("unexpected result from compilation: {:#?}", exp); }; - assert_eq!(expr.source.table_name(), "lhs"); + assert_eq!(&**expr.source.table_name(), "lhs"); assert_eq!(expr.query.len(), 1); let src_join = &expr.query[0]; diff --git a/crates/core/src/vm.rs b/crates/core/src/vm.rs index 3ac8775f5ae..d00b2bf6b86 100644 --- a/crates/core/src/vm.rs +++ b/crates/core/src/vm.rs @@ -436,7 +436,7 @@ impl<'db, 'tx> DbProgram<'db, 'tx> { } let table_access = query.source.table_access(); - tracing::trace!(table = query.source.table_name()); + tracing::trace!(table = &**query.source.table_name()); let head = query.head().clone(); let rows = build_query(self.db, self.tx, query, &mut |id| { diff --git a/crates/lib/src/db/error.rs b/crates/lib/src/db/error.rs index 3313be3bceb..7866be50332 100644 --- a/crates/lib/src/db/error.rs +++ b/crates/lib/src/db/error.rs @@ -7,6 +7,7 @@ use spacetimedb_sats::product_value::InvalidFieldError; use spacetimedb_sats::satn::Satn as _; use std::fmt; use std::string::FromUtf8Error; +use std::sync::Arc; use thiserror::Error; #[derive(Error, Debug)] @@ -72,7 +73,7 @@ pub enum LibError { #[derive(thiserror::Error, Debug)] pub enum AuthError { #[error("Table `{named}` is private")] - TablePrivate { named: String }, + TablePrivate { named: Arc }, #[error("Index `{named}` is private")] IndexPrivate { named: String }, #[error("Sequence `{named}` is private")] @@ -114,12 +115,12 @@ pub enum SchemaError { #[error("{ty} {name} columns `{columns:?}` not found in table `{table}`")] ColumnsNotFound { name: Box, - table: Box, + table: Arc, columns: Vec, ty: DefType, }, #[error("table `{table}` {ty} should have name. {ty} id: {id}")] - EmptyName { table: Box, ty: DefType, id: u32 }, + EmptyName { table: Arc, ty: DefType, id: u32 }, #[error("table `{table}` have `Constraints::unset()` for columns: {columns:?}")] ConstraintUnset { table: Box, @@ -127,10 +128,10 @@ pub enum SchemaError { columns: ColList, }, #[error("Attempt to define a column with more than 1 auto_inc sequence: Table: `{table}`, Field: `{field}`")] - OneAutoInc { table: Box, field: Box }, + OneAutoInc { table: Arc, field: Box }, #[error("Only Btree Indexes are supported: Table: `{table}`, Index: `{index}` is a `{index_type}`")] OnlyBtree { - table: Box, + table: Arc, index: Box, index_type: IndexType, }, diff --git a/crates/lib/src/relation.rs b/crates/lib/src/relation.rs index 09663c18280..b98253cb0f2 100644 --- a/crates/lib/src/relation.rs +++ b/crates/lib/src/relation.rs @@ -92,7 +92,7 @@ impl Column { #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub struct Header { pub table_id: TableId, - pub table_name: Box, + pub table_name: Arc, pub fields: Vec, pub constraints: BTreeMap, } @@ -103,7 +103,7 @@ impl Header { /// `uncombined_constraints` will be normalized using [`combine_constraints`]. pub fn new( table_id: TableId, - table_name: Box, + table_name: Arc, fields: Vec, uncombined_constraints: impl IntoIterator, ) -> Self { diff --git a/crates/primitives/src/ids.rs b/crates/primitives/src/ids.rs index 6451b760d84..cc66325e896 100644 --- a/crates/primitives/src/ids.rs +++ b/crates/primitives/src/ids.rs @@ -107,3 +107,8 @@ system_id! { pub struct ColId(pub u16); } // ColId works differently from other system IDs and is not auto-incremented. + +system_id! { + /// The module-local id for a particular reducer. + pub struct ReducerId(pub u32); +} diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 8b6c184dc8f..c129f25d933 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -7,7 +7,7 @@ mod ids; pub use attr::{AttributeKind, ColumnAttribute, ConstraintKind, Constraints}; pub use col_list::{ColList, ColSet}; -pub use ids::{ColId, ConstraintId, IndexId, ScheduleId, SequenceId, TableId}; +pub use ids::{ColId, ConstraintId, IndexId, ReducerId, ScheduleId, SequenceId, TableId}; /// The minimum size of a chunk yielded by a wasm abi RowIter. pub const ROW_ITER_CHUNK_SIZE: usize = 32 * 1024; diff --git a/crates/sats/src/de/impls.rs b/crates/sats/src/de/impls.rs index eb7432ebfd5..4cd54380eb6 100644 --- a/crates/sats/src/de/impls.rs +++ b/crates/sats/src/de/impls.rs @@ -102,6 +102,7 @@ impl_deserialize!([T: Deserialize<'de>, const N: usize] SmallVec<[T; N]>, de => }); impl_deserialize!([T: Deserialize<'de>, const N: usize] [T; N], de => T::__deserialize_array(de)); impl_deserialize!([] Box, de => String::deserialize(de).map(|s| s.into_boxed_str())); +impl_deserialize!([] Arc, de => String::deserialize(de).map(|s| s.into())); impl_deserialize!([T: Deserialize<'de>] Box<[T]>, de => Vec::deserialize(de).map(|s| s.into_boxed_slice())); impl_deserialize!([T: Deserialize<'de>] Rc<[T]>, de => Vec::deserialize(de).map(|s| s.into())); impl_deserialize!([T: Deserialize<'de>] Arc<[T]>, de => Vec::deserialize(de).map(|s| s.into())); @@ -666,6 +667,7 @@ impl_deserialize!([] spacetimedb_primitives::IndexId, de => u32::deserialize(de) impl_deserialize!([] spacetimedb_primitives::ConstraintId, de => u32::deserialize(de).map(Self)); impl_deserialize!([] spacetimedb_primitives::ColId, de => u16::deserialize(de).map(Self)); impl_deserialize!([] spacetimedb_primitives::ScheduleId, de => u32::deserialize(de).map(Self)); +impl_deserialize!([] spacetimedb_primitives::ReducerId, de => u32::deserialize(de).map(Self)); impl GrowingVec for ColList { fn with_capacity(cap: usize) -> Self { diff --git a/crates/sats/src/primitives.rs b/crates/sats/src/primitives.rs index c9ec073a526..33ea0748312 100644 --- a/crates/sats/src/primitives.rs +++ b/crates/sats/src/primitives.rs @@ -1,6 +1,5 @@ use crate::{de, impl_deserialize, impl_serialize, impl_st, AlgebraicType}; -pub use spacetimedb_primitives::ColumnAttribute; -pub use spacetimedb_primitives::Constraints; +pub use spacetimedb_primitives::{ColumnAttribute, Constraints}; impl_deserialize!([] ColumnAttribute, de => Self::from_bits(de.deserialize_u8()?) diff --git a/crates/sats/src/ser/impls.rs b/crates/sats/src/ser/impls.rs index 909b5fd2dec..9506054603d 100644 --- a/crates/sats/src/ser/impls.rs +++ b/crates/sats/src/ser/impls.rs @@ -234,6 +234,7 @@ impl_serialize!([] spacetimedb_primitives::IndexId, (self, ser) => ser.serialize impl_serialize!([] spacetimedb_primitives::ConstraintId, (self, ser) => ser.serialize_u32(self.0)); impl_serialize!([] spacetimedb_primitives::ColId, (self, ser) => ser.serialize_u16(self.0)); impl_serialize!([] spacetimedb_primitives::ScheduleId, (self, ser) => ser.serialize_u32(self.0)); +impl_serialize!([] spacetimedb_primitives::ReducerId, (self, ser) => ser.serialize_u32(self.0)); impl_serialize!([] ColList, (self, ser) => { let mut arr = ser.serialize_array(self.len() as usize)?; diff --git a/crates/sats/src/typespace.rs b/crates/sats/src/typespace.rs index 61184fc1998..d9153161d01 100644 --- a/crates/sats/src/typespace.rs +++ b/crates/sats/src/typespace.rs @@ -340,6 +340,7 @@ impl_st!([] spacetimedb_primitives::IndexId, AlgebraicType::U32); impl_st!([] spacetimedb_primitives::SequenceId, AlgebraicType::U32); impl_st!([] spacetimedb_primitives::ConstraintId, AlgebraicType::U32); impl_st!([] spacetimedb_primitives::ScheduleId, AlgebraicType::U32); +impl_st!([] spacetimedb_primitives::ReducerId, AlgebraicType::U32); impl_st!([] spacetimedb_primitives::ColList, ts => AlgebraicType::array(spacetimedb_primitives::ColId::make_type(ts))); impl_st!([] spacetimedb_primitives::ColSet, ts => AlgebraicType::array(spacetimedb_primitives::ColId::make_type(ts))); diff --git a/crates/schema/src/schema.rs b/crates/schema/src/schema.rs index 3ca1b5b09a8..fb7f87eeddf 100644 --- a/crates/schema/src/schema.rs +++ b/crates/schema/src/schema.rs @@ -6,6 +6,7 @@ // TODO(1.0): change all the `Box`s in this file to `Identifier`. // This doesn't affect the ABI so can wait until 1.0. +use core::ops::Deref; use itertools::Itertools; use spacetimedb_lib::db::auth::{StAccess, StTableType}; use spacetimedb_lib::db::error::{DefType, SchemaError}; @@ -60,7 +61,7 @@ pub struct TableSchema { pub table_id: TableId, /// The name of the table. - pub table_name: Box, + pub table_name: Arc, /// The columns of the table. /// Inaccessible to prevent mutation. @@ -102,7 +103,7 @@ impl TableSchema { #[allow(clippy::too_many_arguments)] pub fn new( table_id: TableId, - table_name: Box, + table_name: Arc, columns: Vec, indexes: Vec, constraints: Vec, @@ -494,7 +495,7 @@ impl TableSchema { /// This method works around this problem by copying the column types from the module def into the table schema. /// It can be removed once v8 is removed, since v9 will reject modules with an inconsistency like this. pub fn janky_fix_column_defs(&mut self, module_def: &ModuleDef) { - let table_name = Identifier::new(self.table_name.clone()).unwrap(); + let table_name = Identifier::new(self.table_name.deref().into()).unwrap(); for col in &mut self.columns { let def: &ColumnDef = module_def .lookup((&table_name, &Identifier::new(col.col_name.clone()).unwrap())) @@ -591,7 +592,7 @@ impl Schema for TableSchema { TableSchema::new( table_id, - (*name).clone().into(), + (&**name).into(), columns, indexes, constraints, diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index 59745b4caa7..06aa5f325e6 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -12,6 +12,7 @@ spacetimedb-data-structures.workspace = true spacetimedb-sats.workspace = true spacetimedb-lib = { workspace = true, features = ["serde"]} spacetimedb-client-api-messages.workspace = true +spacetimedb-primitives.workspace = true anyhow = { workspace = true, features = ["backtrace"] } anymap.workspace = true diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs index f15e0b3f320..7e6e61dd707 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/identity_connected_reducer.rs @@ -50,20 +50,19 @@ pub trait identity_connected { impl identity_connected for super::RemoteReducers { fn identity_connected(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("__identity_connected__", IdentityConnected {}) + self.imp.call_reducer(0, IdentityConnected {}) } fn on_identity_connected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityConnectedCallbackId { IdentityConnectedCallbackId(self.imp.on_reducer::( - "__identity_connected__", + 0, Box::new(move |ctx: &super::EventContext, args: &IdentityConnected| callback(ctx)), )) } fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp - .remove_on_reducer::("__identity_connected__", callback.0) + self.imp.remove_on_reducer::(0, callback.0) } } @@ -83,6 +82,6 @@ pub trait set_flags_for_identity_connected { impl set_flags_for_identity_connected for super::SetReducerFlags { fn identity_connected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__identity_connected__", flags); + self.imp.set_call_reducer_flags(0, flags); } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs index 539ad0ecd03..cf36b434d21 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/identity_disconnected_reducer.rs @@ -50,21 +50,19 @@ pub trait identity_disconnected { impl identity_disconnected for super::RemoteReducers { fn identity_disconnected(&self) -> __anyhow::Result<()> { - self.imp - .call_reducer("__identity_disconnected__", IdentityDisconnected {}) + self.imp.call_reducer(1, IdentityDisconnected {}) } fn on_identity_disconnected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityDisconnectedCallbackId { IdentityDisconnectedCallbackId(self.imp.on_reducer::( - "__identity_disconnected__", + 1, Box::new(move |ctx: &super::EventContext, args: &IdentityDisconnected| callback(ctx)), )) } fn remove_on_identity_disconnected(&self, callback: IdentityDisconnectedCallbackId) { - self.imp - .remove_on_reducer::("__identity_disconnected__", callback.0) + self.imp.remove_on_reducer::(1, callback.0) } } @@ -84,6 +82,6 @@ pub trait set_flags_for_identity_disconnected { impl set_flags_for_identity_disconnected for super::SetReducerFlags { fn identity_disconnected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__identity_disconnected__", flags); + self.imp.set_call_reducer_flags(1, flags); } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs index ad2fbd48811..5d9f3ffc0da 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/init_reducer.rs @@ -47,16 +47,16 @@ pub trait init { impl init for super::RemoteReducers { fn init(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("__init__", Init {}) + self.imp.call_reducer(2, Init {}) } fn on_init(&self, mut callback: impl FnMut(&super::EventContext) + Send + 'static) -> InitCallbackId { - InitCallbackId(self.imp.on_reducer::( - "__init__", - Box::new(move |ctx: &super::EventContext, args: &Init| callback(ctx)), - )) + InitCallbackId( + self.imp + .on_reducer::(2, Box::new(move |ctx: &super::EventContext, args: &Init| callback(ctx))), + ) } fn remove_on_init(&self, callback: InitCallbackId) { - self.imp.remove_on_reducer::("__init__", callback.0) + self.imp.remove_on_reducer::(2, callback.0) } } @@ -76,6 +76,6 @@ pub trait set_flags_for_init { impl set_flags_for_init for super::SetReducerFlags { fn init(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__init__", flags); + self.imp.set_call_reducer_flags(2, flags); } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/message_table.rs b/crates/sdk/examples/quickstart-chat/module_bindings/message_table.rs index 8ecce648cc9..4dde5f9d4cb 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/message_table.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/message_table.rs @@ -35,7 +35,7 @@ pub trait MessageTableAccess { impl MessageTableAccess for super::RemoteTables { fn message(&self) -> MessageTableHandle<'_> { MessageTableHandle { - imp: self.imp.get_table::("message"), + imp: self.imp.get_table::(0), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs b/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs index 89acab0f991..7c654e38c5c 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/mod.rs @@ -49,13 +49,13 @@ impl __sdk::spacetime_module::InModule for Reducer { } impl __sdk::spacetime_module::Reducer for Reducer { - fn reducer_name(&self) -> &'static str { + fn reducer_index(&self) -> u32 { match self { - Reducer::IdentityConnected(_) => "__identity_connected__", - Reducer::IdentityDisconnected(_) => "__identity_disconnected__", - Reducer::Init(_) => "__init__", - Reducer::SendMessage(_) => "send_message", - Reducer::SetName(_) => "set_name", + Reducer::IdentityConnected(_) => 0, + Reducer::IdentityDisconnected(_) => 1, + Reducer::Init(_) => 2, + Reducer::SendMessage(_) => 3, + Reducer::SetName(_) => 4, } } fn reducer_args(&self) -> &dyn std::any::Any { @@ -67,33 +67,31 @@ impl __sdk::spacetime_module::Reducer for Reducer { Reducer::SetName(args) => args, } } -} -impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { - type Error = __anyhow::Error; - fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { - match &value.reducer_name[..] { - "__identity_connected__" => Ok(Reducer::IdentityConnected(__sdk::spacetime_module::parse_reducer_args( - "__identity_connected__", - &value.args, - )?)), - "__identity_disconnected__" => Ok(Reducer::IdentityDisconnected( - __sdk::spacetime_module::parse_reducer_args("__identity_disconnected__", &value.args)?, - )), - "__init__" => Ok(Reducer::Init(__sdk::spacetime_module::parse_reducer_args( - "__init__", - &value.args, - )?)), - "send_message" => Ok(Reducer::SendMessage(__sdk::spacetime_module::parse_reducer_args( - "send_message", - &value.args, - )?)), - "set_name" => Ok(Reducer::SetName(__sdk::spacetime_module::parse_reducer_args( - "set_name", - &value.args, - )?)), - _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), + fn parse_call_info( + reducer_id_to_idx: &impl Fn(__ws::ReducerId) -> anyhow::Result, + raw: __ws::ReducerCallInfo<__ws::BsatnFormat>, + ) -> anyhow::Result { + use __sdk::spacetime_module::parse_reducer_args; + let reducer_idx = reducer_id_to_idx(raw.reducer_id)?; + let name = Self::reducer_names()[reducer_idx as usize]; + match reducer_id_to_idx(raw.reducer_id)? { + 0 => Ok(Reducer::IdentityConnected(parse_reducer_args(name, &raw.args)?)), + 1 => Ok(Reducer::IdentityDisconnected(parse_reducer_args(name, &raw.args)?)), + 2 => Ok(Reducer::Init(parse_reducer_args(name, &raw.args)?)), + 3 => Ok(Reducer::SendMessage(parse_reducer_args(name, &raw.args)?)), + 4 => Ok(Reducer::SetName(parse_reducer_args(name, &raw.args)?)), + _ => unreachable!(), } } + fn reducer_names() -> &'static [&'static str] { + &[ + "__identity_connected__", + "__identity_disconnected__", + "__init__", + "send_message", + "set_name", + ] + } } #[derive(Default)] @@ -104,34 +102,36 @@ pub struct DbUpdate { user: __sdk::spacetime_module::TableUpdate, } -impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { - type Error = __anyhow::Error; - fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { - let mut db_update = DbUpdate::default(); - for table_update in raw.tables { - match &table_update.table_name[..] { - "message" => db_update.message = message_table::parse_table_update(table_update)?, - "user" => db_update.user = user_table::parse_table_update(table_update)?, - - unknown => __anyhow::bail!("Unknown table {unknown:?} in DatabaseUpdate"), - } - } - Ok(db_update) - } -} - impl __sdk::spacetime_module::InModule for DbUpdate { type Module = RemoteModule; } impl __sdk::spacetime_module::DbUpdate for DbUpdate { fn apply_to_client_cache(&self, cache: &mut __sdk::client_cache::ClientCache) { - cache.apply_diff_to_table::("message", &self.message); - cache.apply_diff_to_table::("user", &self.user); + cache.apply_diff_to_table::(0, &self.message); + cache.apply_diff_to_table::(1, &self.user); } fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::callbacks::DbCallbacks) { - callbacks.invoke_table_row_callbacks::("message", &self.message, event); - callbacks.invoke_table_row_callbacks::("user", &self.user, event); + callbacks.invoke_table_row_callbacks::(0, &self.message, event); + callbacks.invoke_table_row_callbacks::(1, &self.user, event); + } + fn parse_update( + table_id_to_idx: &impl Fn(__ws::TableId) -> anyhow::Result, + raw: __ws::DatabaseUpdate<__ws::BsatnFormat>, + ) -> anyhow::Result { + let mut db_update = DbUpdate::default(); + for table_update in raw.tables { + match table_id_to_idx(table_update.table_id)? { + 0 => db_update.message = message_table::parse_table_update(table_update)?, + 1 => db_update.user = user_table::parse_table_update(table_update)?, + + _ => unreachable!(), + } + } + Ok(db_update) + } + fn table_names() -> &'static [&'static str] { + &["message", "user"] } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs index 70627bd06e2..bbe77b3a067 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/send_message_reducer.rs @@ -52,19 +52,19 @@ pub trait send_message { impl send_message for super::RemoteReducers { fn send_message(&self, text: String) -> __anyhow::Result<()> { - self.imp.call_reducer("send_message", SendMessage { text }) + self.imp.call_reducer(3, SendMessage { text }) } fn on_send_message( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> SendMessageCallbackId { SendMessageCallbackId(self.imp.on_reducer::( - "send_message", + 3, Box::new(move |ctx: &super::EventContext, args: &SendMessage| callback(ctx, &args.text)), )) } fn remove_on_send_message(&self, callback: SendMessageCallbackId) { - self.imp.remove_on_reducer::("send_message", callback.0) + self.imp.remove_on_reducer::(3, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_send_message { impl set_flags_for_send_message for super::SetReducerFlags { fn send_message(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("send_message", flags); + self.imp.set_call_reducer_flags(3, flags); } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs b/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs index aed78b363b2..7edb17af026 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/set_name_reducer.rs @@ -49,19 +49,19 @@ pub trait set_name { impl set_name for super::RemoteReducers { fn set_name(&self, name: String) -> __anyhow::Result<()> { - self.imp.call_reducer("set_name", SetName { name }) + self.imp.call_reducer(4, SetName { name }) } fn on_set_name( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> SetNameCallbackId { SetNameCallbackId(self.imp.on_reducer::( - "set_name", + 4, Box::new(move |ctx: &super::EventContext, args: &SetName| callback(ctx, &args.name)), )) } fn remove_on_set_name(&self, callback: SetNameCallbackId) { - self.imp.remove_on_reducer::("set_name", callback.0) + self.imp.remove_on_reducer::(4, callback.0) } } @@ -81,6 +81,6 @@ pub trait set_flags_for_set_name { impl set_flags_for_set_name for super::SetReducerFlags { fn set_name(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("set_name", flags); + self.imp.set_call_reducer_flags(4, flags); } } diff --git a/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs b/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs index 5809e27a6af..88391380150 100644 --- a/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs +++ b/crates/sdk/examples/quickstart-chat/module_bindings/user_table.rs @@ -35,7 +35,7 @@ pub trait UserTableAccess { impl UserTableAccess for super::RemoteTables { fn user(&self) -> UserTableHandle<'_> { UserTableHandle { - imp: self.imp.get_table::("user"), + imp: self.imp.get_table::(1), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/src/callbacks.rs b/crates/sdk/src/callbacks.rs index 13e55eb1c1a..09dd157f17d 100644 --- a/crates/sdk/src/callbacks.rs +++ b/crates/sdk/src/callbacks.rs @@ -16,7 +16,7 @@ //! This module is internal, and may incompatibly change without warning. use crate::spacetime_module::{Reducer, SpacetimeModule, TableUpdate}; -use spacetimedb_data_structures::map::HashMap; +use spacetimedb_data_structures::map::{HashMap, IntMap}; use std::{ any::Any, sync::atomic::{AtomicUsize, Ordering}, @@ -51,34 +51,34 @@ impl CallbackId { /// Manages row callbacks for a `DbContext`/`DbConnection`. pub struct DbCallbacks { /// Maps table name to a set of callbacks. - table_callbacks: HashMap<&'static str, TableCallbacks>, + table_callbacks: IntMap>, } impl Default for DbCallbacks { fn default() -> Self { Self { - table_callbacks: HashMap::default(), + table_callbacks: IntMap::default(), } } } impl DbCallbacks { - /// Get the [`TableCallbacks`] for the table `table_name`. - pub(crate) fn get_table_callbacks(&mut self, table_name: &'static str) -> &mut TableCallbacks { - self.table_callbacks.entry(table_name).or_default() + /// Get the [`TableCallbacks`] for the table at `table_idx`. + pub(crate) fn get_table_callbacks(&mut self, table_idx: u32) -> &mut TableCallbacks { + self.table_callbacks.entry(table_idx).or_default() } - /// Invoke all row callbacks for rows modified by `table_update` for the table `table_name`. + /// Invoke all row callbacks for rows modified by `table_update` for the table at `table_idx`. pub fn invoke_table_row_callbacks( &mut self, - table_name: &'static str, + table_idx: u32, table_update: &TableUpdate, event: &M::EventContext, ) { if table_update.is_empty() { return; } - let table_callbacks = self.get_table_callbacks(table_name); + let table_callbacks = self.get_table_callbacks(table_idx); for insert in &table_update.inserts { table_callbacks.invoke_on_insert(event, &insert.row); } @@ -213,8 +213,8 @@ type ReducerCallbackMap = HashMap>; /// References to this struct are autogenerated in the `handle_event` /// function. Users should not reference this struct directly. pub(crate) struct ReducerCallbacks { - /// Maps reducer name to a set of callbacks. - callbacks: HashMap<&'static str, ReducerCallbackMap>, + /// Maps reducer index to a set of callbacks. + callbacks: IntMap>, } impl Default for ReducerCallbacks { @@ -227,9 +227,9 @@ impl Default for ReducerCallbacks { impl ReducerCallbacks { pub(crate) fn invoke_on_reducer(&mut self, ctx: &M::EventContext, reducer: &M::Reducer) { - let name = reducer.reducer_name(); + let index = reducer.reducer_index(); let args = reducer.reducer_args(); - if let Some(callbacks) = self.callbacks.get_mut(name) { + if let Some(callbacks) = self.callbacks.get_mut(&index) { for callback in callbacks.values_mut() { callback(ctx, args); } @@ -238,14 +238,17 @@ impl ReducerCallbacks { pub(crate) fn register_on_reducer( &mut self, - reducer: &'static str, + reducer_index: u32, callback_id: CallbackId, callback: ReducerCallback, ) { - self.callbacks.entry(reducer).or_default().insert(callback_id, callback); + self.callbacks + .entry(reducer_index) + .or_default() + .insert(callback_id, callback); } - pub(crate) fn remove_on_reducer(&mut self, reducer: &'static str, callback_id: CallbackId) { + pub(crate) fn remove_on_reducer(&mut self, reducer_index: u32, callback_id: CallbackId) { // Ugly: `impl FnMut` is `must_use`. // If we don't `.expect` this, no diagnostic, // but we want to assert that we actually removed a callback, @@ -253,7 +256,7 @@ impl ReducerCallbacks { // So we have to `let _ =`. let _ = self .callbacks - .get_mut(reducer) + .get_mut(&reducer_index) .expect("Attempt to remove a callback from a reducer which doesn't have any") .remove(&callback_id) .expect("Attempt to remove non-existent reducer callback"); diff --git a/crates/sdk/src/client_cache.rs b/crates/sdk/src/client_cache.rs index ab4228f345e..5c0f816a6a1 100644 --- a/crates/sdk/src/client_cache.rs +++ b/crates/sdk/src/client_cache.rs @@ -11,6 +11,7 @@ use crate::spacetime_module::{InModule, SpacetimeModule, TableUpdate}; use anymap::{any::CloneAny, Map}; use bytes::Bytes; use im::HashMap; +use spacetimedb_data_structures::map::IntMap; use std::marker::PhantomData; use std::sync::Arc; @@ -90,22 +91,25 @@ impl Default for ClientCache { } } +type TableCacheMap = IntMap>>; + impl ClientCache { - /// Get a handle on the [`TableCache`] which stores rows of type `Row` for the table `table_name`. + /// Get a handle on the [`TableCache`] which stores rows of type `Row` + /// for the table with id `table_id`. pub(crate) fn get_table + Send + Sync + 'static>( &self, - table_name: &'static str, + table_idx: u32, ) -> Option<&Arc>> { self.tables - .get::>>>() - .and_then(|tables_of_row_type| tables_of_row_type.get(table_name)) + .get::>() + .and_then(|tables_of_row_type| tables_of_row_type.get(&table_idx)) } /// Apply all the mutations in `diff` - /// to the [`TableCache`] which stores rows of type `Row` for the table `table_name`. + /// to the [`TableCache`] which stores rows of type `Row` for the table with id `table_id`. pub fn apply_diff_to_table + Clone + Send + Sync + 'static>( &mut self, - table_name: &'static str, + table_idx: u32, diff: &TableUpdate, ) { if diff.is_empty() { @@ -116,15 +120,15 @@ impl ClientCache { // TODO: Do we need to be `Arc`ing these? `im::HashMap` should be doing sharing internally anyway. #[allow(clippy::map_clone)] let mut table = self - .get_table::(table_name) + .get_table::(table_idx) .map(|tbl| TableCache::clone(tbl)) .unwrap_or_default(); table.apply_diff(diff); self.tables - .entry::>>>() - .or_insert(HashMap::default()) - .insert(table_name, Arc::new(table)); + .entry::>() + .or_insert(<_>::default()) + .insert(table_idx, Arc::new(table)); } } diff --git a/crates/sdk/src/db_connection.rs b/crates/sdk/src/db_connection.rs index 4739226d32c..64a4a869ccf 100644 --- a/crates/sdk/src/db_connection.rs +++ b/crates/sdk/src/db_connection.rs @@ -21,19 +21,20 @@ use crate::{ callbacks::{CallbackId, DbCallbacks, ReducerCallback, ReducerCallbacks, RowCallback, UpdateCallback}, client_cache::{ClientCache, ClientCacheView, TableCache, UniqueConstraint}, - spacetime_module::{DbConnection, DbUpdate, EventContext, InModule, SpacetimeModule}, + spacetime_module::{DbConnection, DbUpdate, EventContext, InModule, Reducer as _, SpacetimeModule}, subscription::{OnAppliedCallback, OnErrorCallback, SubscriptionManager}, websocket::{WsConnection, WsParams}, ws_messages as ws, Event, ReducerEvent, Status, }; -use anyhow::{bail, Context, Result}; +use anyhow::{anyhow, bail, Context, Result}; use bytes::Bytes; use futures::StreamExt; use futures_channel::mpsc; use http::Uri; use spacetimedb_client_api_messages::websocket::{BsatnFormat, CallReducerFlags, Compression}; -use spacetimedb_data_structures::map::HashMap; +use spacetimedb_data_structures::map::IntMap; use spacetimedb_lib::{bsatn, de::Deserialize, ser::Serialize, Address, Identity}; +use spacetimedb_primitives::{ReducerId, TableId}; use std::{ sync::{Arc, Mutex as StdMutex, OnceLock}, time::{Duration, SystemTime}, @@ -109,10 +110,17 @@ impl DbContextImpl { } // Initial `IdentityToken` message: - // confirm that the received identity and address are what we expect, - // store them, + // 1. confirm that the received identity and address are what we expect and store them, + // 2. construct the mappings between ids and names for tables and reducers. // then invoke the on_connect callback. - ParsedMessage::IdentityToken(identity, token, addr) => { + ParsedMessage::AfterConnecting( + ws::IdentityToken { + address, + identity, + token, + }, + ids_to_names, + ) => { { // Don't hold the `self.identity` lock while running callbacks. // Callbacks can (will) call [`DbContext::identity`], which acquires that lock, @@ -123,12 +131,32 @@ impl DbContextImpl { } *ident_store = Some(identity); } - assert_eq!(get_client_address(), addr); + assert_eq!(get_client_address(), address); let mut inner = self.inner.lock().unwrap(); + + // Handle the `ids_to_names` mappings. + // Validate that all the reducer and table names are as expected. + // These are `O(n)` checks, but it is only done once per connection for a small set. + inner.reducer_idx_to_id = ids_to_names.reducer_ids; + let check_eq = |got: &[Arc<_>], need: &[&_]| got.iter().map(|n| &**n).eq(need.iter().copied()); + anyhow::ensure!( + check_eq(&ids_to_names.reducer_names, M::Reducer::reducer_names()), + "actual and expected reducer names do not match" + ); + anyhow::ensure!( + check_eq(&ids_to_names.table_names, M::DbUpdate::table_names()), + "actual and expected reducer names do not match" + ); + + // Fire the `on_connect` callback, if any. if let Some(on_connect) = inner.on_connect.take() { let ctx = ::new(self.clone()); on_connect(&ctx, identity, &token); } + + // Handshake processed; now we can process pending mutations. + inner.processed_after_connecting = true; + Ok(()) } @@ -246,12 +274,16 @@ impl DbContextImpl { } // CallReducer: send the `CallReducer` WS message. - PendingMutation::CallReducer { reducer, args_bsatn } => { + PendingMutation::CallReducer { + reducer_idx, + args_bsatn, + } => { let inner = &mut *self.inner.lock().unwrap(); - let flags = inner.call_reducer_flags.get_flags(reducer); + let reducer_id = inner.reducer_idx_to_id[reducer_idx as usize]; + let flags = inner.call_reducer_flags.get_flags(reducer_idx); let msg = ws::ClientMessage::CallReducer(ws::CallReducer { - reducer: reducer.into(), + reducer_id, args: args_bsatn.into(), request_id: 0, flags, @@ -275,7 +307,7 @@ impl DbContextImpl { // Callback stuff: these all do what you expect. PendingMutation::AddInsertCallback { - table, + table_idx, callback_id, callback, } => { @@ -283,11 +315,11 @@ impl DbContextImpl { .lock() .unwrap() .db_callbacks - .get_table_callbacks(table) + .get_table_callbacks(table_idx) .register_on_insert(callback_id, callback); } PendingMutation::AddDeleteCallback { - table, + table_idx, callback_id, callback, } => { @@ -295,11 +327,11 @@ impl DbContextImpl { .lock() .unwrap() .db_callbacks - .get_table_callbacks(table) + .get_table_callbacks(table_idx) .register_on_delete(callback_id, callback); } PendingMutation::AddUpdateCallback { - table, + table_idx, callback_id, callback, } => { @@ -307,11 +339,11 @@ impl DbContextImpl { .lock() .unwrap() .db_callbacks - .get_table_callbacks(table) + .get_table_callbacks(table_idx) .register_on_update(callback_id, callback); } PendingMutation::AddReducerCallback { - reducer, + reducer_idx, callback_id, callback, } => { @@ -319,48 +351,48 @@ impl DbContextImpl { .lock() .unwrap() .reducer_callbacks - .register_on_reducer(reducer, callback_id, callback); + .register_on_reducer(reducer_idx, callback_id, callback); } - PendingMutation::RemoveInsertCallback { table, callback_id } => { + PendingMutation::RemoveInsertCallback { table_idx, callback_id } => { self.inner .lock() .unwrap() .db_callbacks - .get_table_callbacks(table) + .get_table_callbacks(table_idx) .remove_on_insert(callback_id); } - PendingMutation::RemoveDeleteCallback { table, callback_id } => { + PendingMutation::RemoveDeleteCallback { table_idx, callback_id } => { self.inner .lock() .unwrap() .db_callbacks - .get_table_callbacks(table) + .get_table_callbacks(table_idx) .remove_on_delete(callback_id); } - PendingMutation::RemoveUpdateCallback { table, callback_id } => { + PendingMutation::RemoveUpdateCallback { table_idx, callback_id } => { self.inner .lock() .unwrap() .db_callbacks - .get_table_callbacks(table) + .get_table_callbacks(table_idx) .remove_on_update(callback_id); } - PendingMutation::RemoveReducerCallback { reducer, callback_id } => { + PendingMutation::RemoveReducerCallback { + reducer_idx, + callback_id, + } => { self.inner .lock() .unwrap() .reducer_callbacks - .remove_on_reducer(reducer, callback_id); + .remove_on_reducer(reducer_idx, callback_id); } - PendingMutation::SetCallReducerFlags { - reducer: reducer_name, - flags, - } => { + PendingMutation::SetCallReducerFlags { reducer_idx, flags } => { self.inner .lock() .unwrap() .call_reducer_flags - .set_flags(reducer_name, flags); + .set_flags(reducer_idx, flags); } }; Ok(()) @@ -371,9 +403,13 @@ impl DbContextImpl { /// /// Called by the autogenerated `DbConnection` method of the same name. pub fn advance_one_message(&self) -> Result { - // Apply any pending mutations before processing a WS message, - // so that pending callbacks don't get skipped. - self.apply_pending_mutations()?; + // The `AfterConnecting` incoming message must always come first, + // before any pending mutations are processed. + if self.inner.lock().unwrap().processed_after_connecting { + // Apply any pending mutations before processing a WS message, + // so that pending callbacks don't get skipped. + self.apply_pending_mutations()?; + } // Deranged behavior: mpsc's `try_next` returns `Ok(None)` when the channel is closed, // and `Err(_)` when the channel is open and waiting. This seems exactly backwards. @@ -399,9 +435,16 @@ impl DbContextImpl { // We call this out as an incorrect and unsupported thing to do. #![allow(clippy::await_holding_lock)] - let mut pending_mutations = self.pending_mutations_recv.lock().await; let mut recv = self.recv.lock().await; + // The `AfterConnecting` incoming message must always come first, + // before any pending mutations are processed. + if !self.inner.lock().unwrap().processed_after_connecting { + return Message::Ws(recv.next().await); + } + + let mut pending_mutations = self.pending_mutations_recv.lock().await; + // Always process pending mutations before WS messages, if they're available, // so that newly registered callbacks run on messages. // This may be unnecessary, but `tokio::select` does not document any ordering guarantees, @@ -507,56 +550,58 @@ impl DbContextImpl { } /// Called by autogenerated table access methods. - pub fn get_table + Send + Sync + 'static>( - &self, - table_name: &'static str, - ) -> TableHandle { + pub fn get_table + Send + Sync + 'static>(&self, table_idx: u32) -> TableHandle { let table_view = self .cache .lock() .unwrap() - .get_table::(table_name) + .get_table::(table_idx) .cloned() .unwrap_or_else(|| Arc::new(TableCache::default())); let pending_mutations = self.pending_mutations_send.clone(); TableHandle { table_view, pending_mutations, - table: table_name, + table_idx, } } /// Called by autogenerated reducer invocation methods. - pub fn call_reducer>( - &self, - reducer_name: &'static str, - args: Args, - ) -> Result<()> { + /// + /// The `reducer_idx` is the position of the reducer, + /// in the known list of reducers, sorted lexicographically by name. + /// It is not necessarily the ID of the reducer itself, + /// which is resolved using this index. + pub fn call_reducer>(&self, reducer_idx: u32, args: Args) -> Result<()> { // TODO(centril, perf): consider using a thread local pool to avoid allocating each time. - let args_bsatn = bsatn::to_vec(&args) - .with_context(|| format!("Failed to BSATN serialize arguments for reducer {reducer_name}"))?; + let args_bsatn = bsatn::to_vec(&args).with_context(|| { + format!( + "Failed to BSATN serialize arguments for reducer {}", + M::Reducer::reducer_names()[reducer_idx as usize] + ) + })?; self.queue_mutation(PendingMutation::CallReducer { - reducer: reducer_name, + reducer_idx, args_bsatn, }); Ok(()) } /// Called by autogenerated on `reducer_config` methods. - pub fn set_call_reducer_flags(&self, reducer: &'static str, flags: CallReducerFlags) { - self.queue_mutation(PendingMutation::SetCallReducerFlags { reducer, flags }); + pub fn set_call_reducer_flags(&self, reducer_idx: u32, flags: CallReducerFlags) { + self.queue_mutation(PendingMutation::SetCallReducerFlags { reducer_idx, flags }); } /// Called by autogenerated reducer callback methods. pub fn on_reducer + InModule + 'static>( &self, - reducer_name: &'static str, + reducer_idx: u32, mut callback: impl FnMut(&M::EventContext, &Args) + Send + 'static, ) -> CallbackId { let callback_id = CallbackId::get_next(); self.queue_mutation(PendingMutation::AddReducerCallback { - reducer: reducer_name, + reducer_idx, callback_id, callback: Box::new(move |ctx, args| { let args = args.downcast_ref::().unwrap(); @@ -567,10 +612,10 @@ impl DbContextImpl { } /// Called by autogenerated reducer callback methods. - pub fn remove_on_reducer>(&self, reducer_name: &'static str, callback: CallbackId) { + pub fn remove_on_reducer>(&self, reducer_idx: u32, callback_id: CallbackId) { self.queue_mutation(PendingMutation::RemoveReducerCallback { - reducer: reducer_name, - callback_id: callback, + reducer_idx, + callback_id, }); } @@ -613,28 +658,32 @@ pub(crate) struct DbContextImplInner { on_disconnect: Option>, call_reducer_flags: CallReducerFlagsMap, + reducer_idx_to_id: Box<[ReducerId]>, + + /// Have we processed `ParsedMessage::AfterConnecting`? + /// + /// This handshake message must come before processing all pending mutations. + processed_after_connecting: bool, } -/// Maps reducer names to the flags to use for `.call_reducer(..)`. +/// Maps reducer indices to the flags to use for `.call_reducer(..)`. #[derive(Default, Clone)] struct CallReducerFlagsMap { - // TODO(centril): consider replacing the string with a type-id based map - // where each reducer is associated with a marker type. - map: HashMap<&'static str, CallReducerFlags>, + map: IntMap, } impl CallReducerFlagsMap { - /// Returns the [`CallReducerFlags`] for `reducer_name`. - fn get_flags(&self, reducer_name: &str) -> CallReducerFlags { - self.map.get(reducer_name).copied().unwrap_or_default() + /// Returns the [`CallReducerFlags`] for `reducer_idx`. + fn get_flags(&self, reducer_idx: u32) -> CallReducerFlags { + self.map.get(&reducer_idx).copied().unwrap_or_default() } - /// Sets the [`CallReducerFlags`] for `reducer_name` to `flags`. - pub fn set_flags(&mut self, reducer_name: &'static str, flags: CallReducerFlags) { + /// Sets the [`CallReducerFlags`] for `reducer_idx` to `flags`. + pub fn set_flags(&mut self, reducer_idx: u32, flags: CallReducerFlags) { if flags == <_>::default() { - self.map.remove(reducer_name) + self.map.remove(&reducer_idx) } else { - self.map.insert(reducer_name, flags) + self.map.insert(reducer_idx, flags) }; } } @@ -648,8 +697,8 @@ pub struct TableHandle { /// so we can send callback-related [`PendingMutation`] messages. pending_mutations: mpsc::UnboundedSender>, - /// The name of the table. - table: &'static str, + /// The index of the table in the list given at handshake. + table_idx: u32, } impl TableHandle { @@ -675,7 +724,7 @@ impl TableHandle { ) -> CallbackId { let callback_id = CallbackId::get_next(); self.queue_mutation(PendingMutation::AddInsertCallback { - table: self.table, + table_idx: self.table_idx, callback: Box::new(move |ctx, row| { let row = row.downcast_ref::().unwrap(); callback(ctx, row); @@ -688,7 +737,7 @@ impl TableHandle { /// Called by the autogenerated implementation of the [`crate::Table`] method of the same name. pub fn remove_on_insert(&self, callback: CallbackId) { self.queue_mutation(PendingMutation::RemoveInsertCallback { - table: self.table, + table_idx: self.table_idx, callback_id: callback, }); } @@ -700,7 +749,7 @@ impl TableHandle { ) -> CallbackId { let callback_id = CallbackId::get_next(); self.queue_mutation(PendingMutation::AddDeleteCallback { - table: self.table, + table_idx: self.table_idx, callback: Box::new(move |ctx, row| { let row = row.downcast_ref::().unwrap(); callback(ctx, row); @@ -713,7 +762,7 @@ impl TableHandle { /// Called by the autogenerated implementation of the [`crate::Table`] method of the same name. pub fn remove_on_delete(&self, callback: CallbackId) { self.queue_mutation(PendingMutation::RemoveDeleteCallback { - table: self.table, + table_idx: self.table_idx, callback_id: callback, }); } @@ -725,7 +774,7 @@ impl TableHandle { ) -> CallbackId { let callback_id = CallbackId::get_next(); self.queue_mutation(PendingMutation::AddUpdateCallback { - table: self.table, + table_idx: self.table_idx, callback: Box::new(move |ctx, old, new| { let old = old.downcast_ref::().unwrap(); let new = new.downcast_ref::().unwrap(); @@ -739,7 +788,7 @@ impl TableHandle { /// Called by the autogenerated implementation of the [`crate::TableWithPrimaryKey`] method of the same name. pub fn remove_on_update(&self, callback: CallbackId) { self.queue_mutation(PendingMutation::RemoveUpdateCallback { - table: self.table, + table_idx: self.table_idx, callback_id: callback, }); } @@ -883,6 +932,8 @@ but you must call one of them, or else the connection will never progress. on_connect_error: self.on_connect_error, on_disconnect: self.on_disconnect, call_reducer_flags: <_>::default(), + reducer_idx_to_id: <_>::default(), + processed_after_connecting: false, })); let (pending_mutations_send, pending_mutations_recv) = mpsc::unbounded(); let ctx_imp = DbContextImpl { @@ -1028,10 +1079,16 @@ fn enter_or_create_runtime() -> Result<(Option, runtime::Handle)> { enum ParsedMessage { InitialSubscription { db_update: M::DbUpdate, sub_id: u32 }, TransactionUpdate(Event, Option), - IdentityToken(Identity, Box, Address), + AfterConnecting(ws::IdentityToken, IdsToNames), Error(anyhow::Error), } +struct IdsToNames { + reducer_ids: Box<[ReducerId]>, + reducer_names: Box<[Arc]>, + table_names: Box<[Arc]>, +} + fn spawn_parse_loop( raw_message_recv: mpsc::UnboundedReceiver>, handle: &runtime::Handle, @@ -1047,16 +1104,27 @@ async fn parse_loop( mut recv: mpsc::UnboundedReceiver>, send: mpsc::UnboundedSender>, ) { + type TableIdMap = IntMap; + let mut known_table_ids: TableIdMap = <_>::default(); + let get_table_idx = |table_ids: &TableIdMap, table_id| { + table_ids + .get(&table_id) + .ok_or_else(|| anyhow!("no table with id {} found", table_id)) + .copied() + }; + + let mut known_reducer_ids: IntMap = <_>::default(); + while let Some(msg) = recv.next().await { send.unbounded_send(match msg { - ws::ServerMessage::InitialSubscription(sub) => M::DbUpdate::try_from(sub.database_update) - .map(|update| ParsedMessage::InitialSubscription { - db_update: update, - sub_id: sub.request_id, - }) - .unwrap_or_else(|e| { - ParsedMessage::Error(e.context("Failed to parse DbUpdate from InitialSubscription")) - }), + ws::ServerMessage::InitialSubscription(sub) => { + let sub_id = sub.request_id; + let get_table_id = &|id| get_table_idx(&known_table_ids, id); + M::DbUpdate::parse_update(get_table_id, sub.database_update) + .map(|db_update| ParsedMessage::InitialSubscription { db_update, sub_id }) + .map_err(|e| e.context("Failed to parse DbUpdate from InitialSubscription")) + .unwrap_or_else(ParsedMessage::Error) + } ws::ServerMessage::TransactionUpdate(ws::TransactionUpdate { status, timestamp, @@ -1065,10 +1133,16 @@ async fn parse_loop( reducer_call, energy_quanta_used, .. - }) => match Status::parse_status_and_update::(status) { + }) => match Status::parse_status_and_update::(&|id| get_table_idx(&known_table_ids, id), status) { Err(e) => ParsedMessage::Error(e.context("Failed to parse Status from TransactionUpdate")), Ok((status, db_update)) => { - let event = M::Reducer::try_from(reducer_call) + let get_reducer_idx = &|reducer_id| { + known_reducer_ids + .get(&reducer_id) + .ok_or_else(|| anyhow!("no reducer with id {} found", reducer_id)) + .copied() + }; + let event = M::Reducer::parse_call_info(get_reducer_idx, reducer_call) .map(|reducer| { Event::Reducer(ReducerEvent { caller_address: caller_address.none_if_zero(), @@ -1086,16 +1160,32 @@ async fn parse_loop( } }, ws::ServerMessage::TransactionUpdateLight(ws::TransactionUpdateLight { update, request_id: _ }) => { - match M::DbUpdate::parse_update(update) { - Err(e) => ParsedMessage::Error(e.context("Failed to parse update from TransactionUpdateLight")), - Ok(db_update) => ParsedMessage::TransactionUpdate(Event::UnknownTransaction, Some(db_update)), - } + let get_table_id = &|id| get_table_idx(&known_table_ids, id); + M::DbUpdate::parse_update(get_table_id, update) + .map(|db_update| ParsedMessage::TransactionUpdate(Event::UnknownTransaction, Some(db_update))) + .map_err(|e| e.context("Failed to parse update from TransactionUpdateLight")) + .unwrap_or_else(ParsedMessage::Error) + } + ws::ServerMessage::AfterConnecting(ws::AfterConnecting { + identity_token, + ids_to_names, + }) => { + let ws::IdsToNames { + table_ids, + table_names, + reducer_ids, + reducer_names, + } = ids_to_names; + let ids_to_names = IdsToNames { + table_names, + reducer_ids, + reducer_names, + }; + + known_table_ids = table_ids.iter().copied().zip(0u32..).collect(); + known_reducer_ids = ids_to_names.reducer_ids.iter().copied().zip(0u32..).collect(); + ParsedMessage::AfterConnecting(identity_token, ids_to_names) } - ws::ServerMessage::IdentityToken(ws::IdentityToken { - identity, - token, - address, - }) => ParsedMessage::IdentityToken(identity, token, address), ws::ServerMessage::OneOffQueryResponse(_) => { unreachable!("The Rust SDK does not implement one-off queries") } @@ -1115,48 +1205,48 @@ pub(crate) enum PendingMutation { }, // TODO: Unsubscribe { ??? }, CallReducer { - reducer: &'static str, + reducer_idx: u32, args_bsatn: Vec, }, AddInsertCallback { - table: &'static str, + table_idx: u32, callback_id: CallbackId, callback: RowCallback, }, RemoveInsertCallback { - table: &'static str, + table_idx: u32, callback_id: CallbackId, }, AddDeleteCallback { - table: &'static str, + table_idx: u32, callback_id: CallbackId, callback: RowCallback, }, RemoveDeleteCallback { - table: &'static str, + table_idx: u32, callback_id: CallbackId, }, AddUpdateCallback { - table: &'static str, + table_idx: u32, callback_id: CallbackId, callback: UpdateCallback, }, RemoveUpdateCallback { - table: &'static str, + table_idx: u32, callback_id: CallbackId, }, AddReducerCallback { - reducer: &'static str, + reducer_idx: u32, callback_id: CallbackId, callback: ReducerCallback, }, RemoveReducerCallback { - reducer: &'static str, + reducer_idx: u32, callback_id: CallbackId, }, Disconnect, SetCallReducerFlags { - reducer: &'static str, + reducer_idx: u32, flags: CallReducerFlags, }, } diff --git a/crates/sdk/src/event.rs b/crates/sdk/src/event.rs index eebd667374e..04a5be70976 100644 --- a/crates/sdk/src/event.rs +++ b/crates/sdk/src/event.rs @@ -11,8 +11,10 @@ //! to determine what change in your connection's state caused the callback to run. use crate::spacetime_module::{DbUpdate as _, SpacetimeModule}; -use spacetimedb_client_api_messages::websocket::BsatnFormat; +use anyhow::Context as _; +use spacetimedb_client_api_messages::websocket::{BsatnFormat, UpdateStatus}; use spacetimedb_lib::{Address, Identity}; +use spacetimedb_primitives::TableId; use std::time::SystemTime; #[non_exhaustive] @@ -99,14 +101,19 @@ pub enum Status { impl Status { pub(crate) fn parse_status_and_update( - status: crate::ws_messages::UpdateStatus, + table_id_to_idx: &impl Fn(TableId) -> anyhow::Result, + status: UpdateStatus, ) -> anyhow::Result<(Self, Option)> { Ok(match status { - crate::ws_messages::UpdateStatus::Committed(update) => { - (Self::Committed, Some(M::DbUpdate::parse_update(update)?)) - } - crate::ws_messages::UpdateStatus::Failed(errmsg) => (Self::Failed(errmsg), None), - crate::ws_messages::UpdateStatus::OutOfEnergy => (Self::OutOfEnergy, None), + UpdateStatus::Committed(update) => ( + Self::Committed, + Some( + M::DbUpdate::parse_update(table_id_to_idx, update) + .context("Failed to parse DatabaseUpdate from UpdateStatus")?, + ), + ), + UpdateStatus::Failed(errmsg) => (Self::Failed(errmsg), None), + UpdateStatus::OutOfEnergy => (Self::OutOfEnergy, None), }) } } diff --git a/crates/sdk/src/spacetime_module.rs b/crates/sdk/src/spacetime_module.rs index 159cac8bdff..3affa90e6d0 100644 --- a/crates/sdk/src/spacetime_module.rs +++ b/crates/sdk/src/spacetime_module.rs @@ -3,6 +3,7 @@ //! This module is internal, and may incompatibly change without warning. use spacetimedb_client_api_messages::websocket::{BsatnFormat, RowListLen}; +use spacetimedb_primitives::{ReducerId, TableId}; use crate::{ callbacks::DbCallbacks, client_cache::ClientCache, db_connection::DbContextImpl, @@ -51,8 +52,7 @@ pub trait SpacetimeModule: Send + Sync + 'static { /// Implemented by the autogenerated `DbUpdate` type, /// which is a parsed and typed analogue of [`crate::ws::DatabaseUpdate`]. -pub trait DbUpdate: - TryFrom, Error = anyhow::Error> + InModule + Send + 'static +pub trait DbUpdate: InModule + Send + 'static + Sized where Self::Module: SpacetimeModule, { @@ -62,10 +62,11 @@ where event: &<::Module as SpacetimeModule>::EventContext, callbacks: &mut DbCallbacks, ); - - fn parse_update(update: ws::DatabaseUpdate) -> anyhow::Result { - Self::try_from(update).context("Failed to parse DatabaseUpdate from UpdateStatus") - } + fn parse_update( + table_id_to_idx: &impl Fn(TableId) -> anyhow::Result, + update: ws::DatabaseUpdate, + ) -> anyhow::Result; + fn table_names() -> &'static [&'static str]; } /// Implemented by the autogenerated `DbConnection` type, @@ -95,20 +96,29 @@ where /// Implemented by the autogenerated `Reducer` enum, /// which has a variant for each reducer defined by the module. /// This will be the type parameter to [`Event`] and [`crate::ReducerEvent`]. -pub trait Reducer: - InModule + TryFrom, Error = anyhow::Error> + std::fmt::Debug + Send + 'static +pub trait Reducer: InModule + std::fmt::Debug + Send + 'static + Sized where Self::Module: SpacetimeModule, { - /// Get the string name of the reducer variant stored in this instance. + /// Get the index of the reducer variant stored in this instance. /// /// Used by [`crate::callbacks::ReducerCallbacks::invoke_on_reducer`] to determine which callback to run. - fn reducer_name(&self) -> &'static str; + fn reducer_index(&self) -> u32; + /// Get the name of the reducer variant stored in this instance. + fn reducer_name(&self) -> &'static str { + Self::reducer_names()[self.reducer_index() as usize] + } /// Get a reference to the reducer argument struct for the variant stored in this instance. /// /// Used by [`crate::callbacks::ReducerCallbacks::invoke_on_reducer`] /// to pass the reducer arguments to the callback. fn reducer_args(&self) -> &dyn Any; + fn parse_call_info( + reducer_id_to_idx: &impl Fn(ReducerId) -> anyhow::Result, + raw: ws::ReducerCallInfo, + ) -> anyhow::Result; + /// The names of all the reducers in the module, ordered lexicographically. + fn reducer_names() -> &'static [&'static str]; } pub trait SubscriptionHandle: InModule + Send + 'static diff --git a/crates/table/src/table.rs b/crates/table/src/table.rs index 44943f82db1..77a0c7247c2 100644 --- a/crates/table/src/table.rs +++ b/crates/table/src/table.rs @@ -1041,7 +1041,7 @@ impl IndexScanIter<'_> { #[error("Unique constraint violation '{}' in table '{}': column(s): '{:?}' value: {}", constraint_name, table_name, cols, value.to_satn())] pub struct UniqueConstraintViolation { pub constraint_name: Box, - pub table_name: Box, + pub table_name: Arc, pub cols: Vec>, pub value: AlgebraicValue, } diff --git a/crates/testing/src/modules.rs b/crates/testing/src/modules.rs index 497a39e24c9..18caa61bc50 100644 --- a/crates/testing/src/modules.rs +++ b/crates/testing/src/modules.rs @@ -50,9 +50,17 @@ pub struct ModuleHandle { } impl ModuleHandle { - fn call_reducer_msg(reducer: &str, args: Args) -> ws::ClientMessage { + fn call_reducer_msg(&self, reducer: &str, args: Args) -> ws::ClientMessage { + let reducer_id = self + .client + .module + .info() + .reducers_map + .lookup_id(reducer) + .expect("reducer does not exist"); + ws::ClientMessage::CallReducer(ws::CallReducer { - reducer: reducer.into(), + reducer_id, args, request_id: 0, flags: ws::CallReducerFlags::FullUpdate, @@ -61,14 +69,14 @@ impl ModuleHandle { pub async fn call_reducer_json(&self, reducer: &str, args: sats::ProductValue) -> anyhow::Result<()> { let args = serde_json::to_string(&args).unwrap(); - let message = Self::call_reducer_msg(reducer, args); + let message = self.call_reducer_msg(reducer, args); self.send(serde_json::to_string(&SerializeWrapper::new(message)).unwrap()) .await } pub async fn call_reducer_binary(&self, reducer: &str, args: sats::ProductValue) -> anyhow::Result<()> { let args = bsatn::to_vec(&args).unwrap(); - let message = Self::call_reducer_msg(reducer, args); + let message = self.call_reducer_msg(reducer, args); self.send(bsatn::to_vec(&message).unwrap()).await } diff --git a/crates/vm/src/expr.rs b/crates/vm/src/expr.rs index 499c9bb936c..d5750a163a5 100644 --- a/crates/vm/src/expr.rs +++ b/crates/vm/src/expr.rs @@ -567,7 +567,7 @@ impl SourceExpr { } } - pub fn table_name(&self) -> &str { + pub fn table_name(&self) -> &Arc { &self.head().table_name } @@ -2024,7 +2024,7 @@ impl AuthAccess for SourceExpr { } Err(AuthError::TablePrivate { - named: self.table_name().to_string(), + named: self.table_name().clone(), }) } } @@ -2056,7 +2056,7 @@ impl AuthAccess for CrudExpr { #[derive(Debug, PartialEq)] pub struct Update { pub table_id: TableId, - pub table_name: Box, + pub table_name: Arc, pub inserts: Vec, pub deletes: Vec, } @@ -2172,7 +2172,7 @@ mod tests { index_side: SourceExpr::DbTable(DbTable { head: Arc::new(Header { table_id: db_table.head().table_id, - table_name: db_table.table_name().into(), + table_name: db_table.table_name().clone(), fields: vec![], constraints: Default::default(), }), From b1dab7ed73ce244201352a2004e9032e4719b966 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 22 Oct 2024 23:35:32 +0200 Subject: [PATCH 02/11] regenerate snaps & sdk/tests/*/src/module_bindings --- .../snapshots/codegen__codegen_rust.snap | 267 ++- .../src/module_bindings/connected_table.rs | 2 +- .../src/module_bindings/disconnected_table.rs | 2 +- .../identity_connected_reducer.rs | 9 +- .../identity_disconnected_reducer.rs | 10 +- .../src/module_bindings/mod.rs | 75 +- .../delete_pk_address_reducer.rs | 9 +- .../module_bindings/delete_pk_bool_reducer.rs | 8 +- .../delete_pk_i_128_reducer.rs | 8 +- .../module_bindings/delete_pk_i_16_reducer.rs | 8 +- .../delete_pk_i_256_reducer.rs | 8 +- .../module_bindings/delete_pk_i_32_reducer.rs | 8 +- .../module_bindings/delete_pk_i_64_reducer.rs | 8 +- .../module_bindings/delete_pk_i_8_reducer.rs | 8 +- .../delete_pk_identity_reducer.rs | 9 +- .../delete_pk_string_reducer.rs | 9 +- .../delete_pk_u_128_reducer.rs | 8 +- .../module_bindings/delete_pk_u_16_reducer.rs | 8 +- .../delete_pk_u_256_reducer.rs | 8 +- .../module_bindings/delete_pk_u_32_reducer.rs | 8 +- .../module_bindings/delete_pk_u_64_reducer.rs | 8 +- .../module_bindings/delete_pk_u_8_reducer.rs | 8 +- .../delete_unique_address_reducer.rs | 10 +- .../delete_unique_bool_reducer.rs | 9 +- .../delete_unique_i_128_reducer.rs | 9 +- .../delete_unique_i_16_reducer.rs | 9 +- .../delete_unique_i_256_reducer.rs | 9 +- .../delete_unique_i_32_reducer.rs | 9 +- .../delete_unique_i_64_reducer.rs | 9 +- .../delete_unique_i_8_reducer.rs | 9 +- .../delete_unique_identity_reducer.rs | 10 +- .../delete_unique_string_reducer.rs | 9 +- .../delete_unique_u_128_reducer.rs | 9 +- .../delete_unique_u_16_reducer.rs | 9 +- .../delete_unique_u_256_reducer.rs | 9 +- .../delete_unique_u_32_reducer.rs | 9 +- .../delete_unique_u_64_reducer.rs | 9 +- .../delete_unique_u_8_reducer.rs | 9 +- .../insert_caller_one_address_reducer.rs | 10 +- .../insert_caller_one_identity_reducer.rs | 10 +- .../insert_caller_pk_address_reducer.rs | 10 +- .../insert_caller_pk_identity_reducer.rs | 10 +- .../insert_caller_unique_address_reducer.rs | 10 +- .../insert_caller_unique_identity_reducer.rs | 10 +- .../insert_caller_vec_address_reducer.rs | 10 +- .../insert_caller_vec_identity_reducer.rs | 10 +- .../insert_large_table_reducer.rs | 9 +- .../insert_one_address_reducer.rs | 9 +- .../insert_one_bool_reducer.rs | 9 +- .../insert_one_byte_struct_reducer.rs | 10 +- .../insert_one_enum_with_payload_reducer.rs | 10 +- ...sert_one_every_primitive_struct_reducer.rs | 10 +- .../insert_one_every_vec_struct_reducer.rs | 10 +- .../insert_one_f_32_reducer.rs | 8 +- .../insert_one_f_64_reducer.rs | 8 +- .../insert_one_i_128_reducer.rs | 9 +- .../insert_one_i_16_reducer.rs | 8 +- .../insert_one_i_256_reducer.rs | 9 +- .../insert_one_i_32_reducer.rs | 8 +- .../insert_one_i_64_reducer.rs | 8 +- .../module_bindings/insert_one_i_8_reducer.rs | 8 +- .../insert_one_identity_reducer.rs | 9 +- .../insert_one_simple_enum_reducer.rs | 10 +- .../insert_one_string_reducer.rs | 9 +- .../insert_one_u_128_reducer.rs | 9 +- .../insert_one_u_16_reducer.rs | 8 +- .../insert_one_u_256_reducer.rs | 9 +- .../insert_one_u_32_reducer.rs | 8 +- .../insert_one_u_64_reducer.rs | 8 +- .../module_bindings/insert_one_u_8_reducer.rs | 8 +- .../insert_one_unit_struct_reducer.rs | 10 +- ...t_option_every_primitive_struct_reducer.rs | 12 +- .../insert_option_i_32_reducer.rs | 9 +- .../insert_option_identity_reducer.rs | 10 +- .../insert_option_simple_enum_reducer.rs | 10 +- .../insert_option_string_reducer.rs | 9 +- .../insert_option_vec_option_i_32_reducer.rs | 10 +- .../insert_pk_address_reducer.rs | 9 +- .../module_bindings/insert_pk_bool_reducer.rs | 8 +- .../insert_pk_i_128_reducer.rs | 8 +- .../module_bindings/insert_pk_i_16_reducer.rs | 8 +- .../insert_pk_i_256_reducer.rs | 8 +- .../module_bindings/insert_pk_i_32_reducer.rs | 8 +- .../module_bindings/insert_pk_i_64_reducer.rs | 8 +- .../module_bindings/insert_pk_i_8_reducer.rs | 8 +- .../insert_pk_identity_reducer.rs | 10 +- .../insert_pk_string_reducer.rs | 9 +- .../insert_pk_u_128_reducer.rs | 8 +- .../module_bindings/insert_pk_u_16_reducer.rs | 8 +- .../insert_pk_u_256_reducer.rs | 8 +- .../module_bindings/insert_pk_u_32_reducer.rs | 8 +- .../module_bindings/insert_pk_u_64_reducer.rs | 8 +- .../module_bindings/insert_pk_u_8_reducer.rs | 8 +- .../insert_primitives_as_strings_reducer.rs | 10 +- .../insert_table_holds_table_reducer.rs | 10 +- .../insert_unique_address_reducer.rs | 10 +- .../insert_unique_bool_reducer.rs | 10 +- .../insert_unique_i_128_reducer.rs | 10 +- .../insert_unique_i_16_reducer.rs | 9 +- .../insert_unique_i_256_reducer.rs | 10 +- .../insert_unique_i_32_reducer.rs | 9 +- .../insert_unique_i_64_reducer.rs | 9 +- .../insert_unique_i_8_reducer.rs | 9 +- .../insert_unique_identity_reducer.rs | 10 +- .../insert_unique_string_reducer.rs | 10 +- .../insert_unique_u_128_reducer.rs | 10 +- .../insert_unique_u_16_reducer.rs | 9 +- .../insert_unique_u_256_reducer.rs | 10 +- .../insert_unique_u_32_reducer.rs | 9 +- .../insert_unique_u_64_reducer.rs | 9 +- .../insert_unique_u_8_reducer.rs | 9 +- .../insert_vec_address_reducer.rs | 9 +- .../insert_vec_bool_reducer.rs | 9 +- .../insert_vec_byte_struct_reducer.rs | 10 +- .../insert_vec_enum_with_payload_reducer.rs | 10 +- ...sert_vec_every_primitive_struct_reducer.rs | 10 +- .../insert_vec_every_vec_struct_reducer.rs | 10 +- .../insert_vec_f_32_reducer.rs | 8 +- .../insert_vec_f_64_reducer.rs | 8 +- .../insert_vec_i_128_reducer.rs | 9 +- .../insert_vec_i_16_reducer.rs | 8 +- .../insert_vec_i_256_reducer.rs | 9 +- .../insert_vec_i_32_reducer.rs | 8 +- .../insert_vec_i_64_reducer.rs | 8 +- .../module_bindings/insert_vec_i_8_reducer.rs | 8 +- .../insert_vec_identity_reducer.rs | 9 +- .../insert_vec_simple_enum_reducer.rs | 10 +- .../insert_vec_string_reducer.rs | 9 +- .../insert_vec_u_128_reducer.rs | 9 +- .../insert_vec_u_16_reducer.rs | 8 +- .../insert_vec_u_256_reducer.rs | 9 +- .../insert_vec_u_32_reducer.rs | 8 +- .../insert_vec_u_64_reducer.rs | 8 +- .../module_bindings/insert_vec_u_8_reducer.rs | 8 +- .../insert_vec_unit_struct_reducer.rs | 10 +- .../src/module_bindings/large_table_table.rs | 2 +- .../test-client/src/module_bindings/mod.rs | 1995 ++++++++--------- .../module_bindings/no_op_succeeds_reducer.rs | 8 +- .../src/module_bindings/one_address_table.rs | 2 +- .../src/module_bindings/one_bool_table.rs | 2 +- .../module_bindings/one_byte_struct_table.rs | 2 +- .../one_enum_with_payload_table.rs | 2 +- .../one_every_primitive_struct_table.rs | 4 +- .../one_every_vec_struct_table.rs | 2 +- .../src/module_bindings/one_f_32_table.rs | 2 +- .../src/module_bindings/one_f_64_table.rs | 2 +- .../src/module_bindings/one_i_128_table.rs | 2 +- .../src/module_bindings/one_i_16_table.rs | 2 +- .../src/module_bindings/one_i_256_table.rs | 2 +- .../src/module_bindings/one_i_32_table.rs | 2 +- .../src/module_bindings/one_i_64_table.rs | 2 +- .../src/module_bindings/one_i_8_table.rs | 2 +- .../src/module_bindings/one_identity_table.rs | 2 +- .../module_bindings/one_simple_enum_table.rs | 2 +- .../src/module_bindings/one_string_table.rs | 2 +- .../src/module_bindings/one_u_128_table.rs | 2 +- .../src/module_bindings/one_u_16_table.rs | 2 +- .../src/module_bindings/one_u_256_table.rs | 2 +- .../src/module_bindings/one_u_32_table.rs | 2 +- .../src/module_bindings/one_u_64_table.rs | 2 +- .../src/module_bindings/one_u_8_table.rs | 2 +- .../module_bindings/one_unit_struct_table.rs | 2 +- .../option_every_primitive_struct_table.rs | 4 +- .../src/module_bindings/option_i_32_table.rs | 2 +- .../module_bindings/option_identity_table.rs | 2 +- .../option_simple_enum_table.rs | 2 +- .../module_bindings/option_string_table.rs | 2 +- .../option_vec_option_i_32_table.rs | 2 +- .../src/module_bindings/pk_address_table.rs | 2 +- .../src/module_bindings/pk_bool_table.rs | 2 +- .../src/module_bindings/pk_i_128_table.rs | 2 +- .../src/module_bindings/pk_i_16_table.rs | 2 +- .../src/module_bindings/pk_i_256_table.rs | 2 +- .../src/module_bindings/pk_i_32_table.rs | 2 +- .../src/module_bindings/pk_i_64_table.rs | 2 +- .../src/module_bindings/pk_i_8_table.rs | 2 +- .../src/module_bindings/pk_identity_table.rs | 2 +- .../src/module_bindings/pk_string_table.rs | 2 +- .../src/module_bindings/pk_u_128_table.rs | 2 +- .../src/module_bindings/pk_u_16_table.rs | 2 +- .../src/module_bindings/pk_u_256_table.rs | 2 +- .../src/module_bindings/pk_u_32_table.rs | 2 +- .../src/module_bindings/pk_u_64_table.rs | 2 +- .../src/module_bindings/pk_u_8_table.rs | 2 +- .../table_holds_table_table.rs | 2 +- .../module_bindings/unique_address_table.rs | 2 +- .../src/module_bindings/unique_bool_table.rs | 2 +- .../src/module_bindings/unique_i_128_table.rs | 2 +- .../src/module_bindings/unique_i_16_table.rs | 2 +- .../src/module_bindings/unique_i_256_table.rs | 2 +- .../src/module_bindings/unique_i_32_table.rs | 2 +- .../src/module_bindings/unique_i_64_table.rs | 2 +- .../src/module_bindings/unique_i_8_table.rs | 2 +- .../module_bindings/unique_identity_table.rs | 2 +- .../module_bindings/unique_string_table.rs | 2 +- .../src/module_bindings/unique_u_128_table.rs | 2 +- .../src/module_bindings/unique_u_16_table.rs | 2 +- .../src/module_bindings/unique_u_256_table.rs | 2 +- .../src/module_bindings/unique_u_32_table.rs | 2 +- .../src/module_bindings/unique_u_64_table.rs | 2 +- .../src/module_bindings/unique_u_8_table.rs | 2 +- .../update_pk_address_reducer.rs | 9 +- .../module_bindings/update_pk_bool_reducer.rs | 8 +- .../update_pk_i_128_reducer.rs | 8 +- .../module_bindings/update_pk_i_16_reducer.rs | 8 +- .../update_pk_i_256_reducer.rs | 8 +- .../module_bindings/update_pk_i_32_reducer.rs | 8 +- .../module_bindings/update_pk_i_64_reducer.rs | 8 +- .../module_bindings/update_pk_i_8_reducer.rs | 8 +- .../update_pk_identity_reducer.rs | 10 +- .../update_pk_string_reducer.rs | 9 +- .../update_pk_u_128_reducer.rs | 8 +- .../module_bindings/update_pk_u_16_reducer.rs | 8 +- .../update_pk_u_256_reducer.rs | 8 +- .../module_bindings/update_pk_u_32_reducer.rs | 8 +- .../module_bindings/update_pk_u_64_reducer.rs | 8 +- .../module_bindings/update_pk_u_8_reducer.rs | 8 +- .../update_unique_address_reducer.rs | 10 +- .../update_unique_bool_reducer.rs | 10 +- .../update_unique_i_128_reducer.rs | 10 +- .../update_unique_i_16_reducer.rs | 9 +- .../update_unique_i_256_reducer.rs | 10 +- .../update_unique_i_32_reducer.rs | 9 +- .../update_unique_i_64_reducer.rs | 9 +- .../update_unique_i_8_reducer.rs | 9 +- .../update_unique_identity_reducer.rs | 10 +- .../update_unique_string_reducer.rs | 10 +- .../update_unique_u_128_reducer.rs | 10 +- .../update_unique_u_16_reducer.rs | 9 +- .../update_unique_u_256_reducer.rs | 10 +- .../update_unique_u_32_reducer.rs | 9 +- .../update_unique_u_64_reducer.rs | 9 +- .../update_unique_u_8_reducer.rs | 9 +- .../src/module_bindings/vec_address_table.rs | 2 +- .../src/module_bindings/vec_bool_table.rs | 2 +- .../module_bindings/vec_byte_struct_table.rs | 2 +- .../vec_enum_with_payload_table.rs | 2 +- .../vec_every_primitive_struct_table.rs | 4 +- .../vec_every_vec_struct_table.rs | 2 +- .../src/module_bindings/vec_f_32_table.rs | 2 +- .../src/module_bindings/vec_f_64_table.rs | 2 +- .../src/module_bindings/vec_i_128_table.rs | 2 +- .../src/module_bindings/vec_i_16_table.rs | 2 +- .../src/module_bindings/vec_i_256_table.rs | 2 +- .../src/module_bindings/vec_i_32_table.rs | 2 +- .../src/module_bindings/vec_i_64_table.rs | 2 +- .../src/module_bindings/vec_i_8_table.rs | 2 +- .../src/module_bindings/vec_identity_table.rs | 2 +- .../module_bindings/vec_simple_enum_table.rs | 2 +- .../src/module_bindings/vec_string_table.rs | 2 +- .../src/module_bindings/vec_u_128_table.rs | 2 +- .../src/module_bindings/vec_u_16_table.rs | 2 +- .../src/module_bindings/vec_u_256_table.rs | 2 +- .../src/module_bindings/vec_u_32_table.rs | 2 +- .../src/module_bindings/vec_u_64_table.rs | 2 +- .../src/module_bindings/vec_u_8_table.rs | 2 +- .../module_bindings/vec_unit_struct_table.rs | 2 +- 257 files changed, 1805 insertions(+), 2183 deletions(-) diff --git a/crates/cli/tests/snapshots/codegen__codegen_rust.snap b/crates/cli/tests/snapshots/codegen__codegen_rust.snap index 213ea25df70..7fcf9f9d97a 100644 --- a/crates/cli/tests/snapshots/codegen__codegen_rust.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_rust.snap @@ -59,19 +59,19 @@ pub trait add_player { impl add_player for super::RemoteReducers { fn add_player(&self, name: String, ) -> __anyhow::Result<()> { - self.imp.call_reducer("add_player", AddPlayer { name, }) + self.imp.call_reducer(2, AddPlayer { name, }) } fn on_add_player( &self, mut callback: impl FnMut(&super::EventContext, &String, ) + Send + 'static, ) -> AddPlayerCallbackId { AddPlayerCallbackId(self.imp.on_reducer::( - "add_player", + 2, Box::new(move |ctx: &super::EventContext, args: &AddPlayer| callback(ctx, &args.name, )), )) } fn remove_on_add_player(&self, callback: AddPlayerCallbackId) { - self.imp.remove_on_reducer::("add_player", callback.0) + self.imp.remove_on_reducer::(2, callback.0) } } @@ -91,7 +91,7 @@ pub trait set_flags_for_add_player { impl set_flags_for_add_player for super::SetReducerFlags { fn add_player(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("add_player", flags); + self.imp.set_call_reducer_flags(2, flags); } } @@ -153,19 +153,19 @@ pub trait add_private { impl add_private for super::RemoteReducers { fn add_private(&self, name: String, ) -> __anyhow::Result<()> { - self.imp.call_reducer("add_private", AddPrivate { name, }) + self.imp.call_reducer(3, AddPrivate { name, }) } fn on_add_private( &self, mut callback: impl FnMut(&super::EventContext, &String, ) + Send + 'static, ) -> AddPrivateCallbackId { AddPrivateCallbackId(self.imp.on_reducer::( - "add_private", + 3, Box::new(move |ctx: &super::EventContext, args: &AddPrivate| callback(ctx, &args.name, )), )) } fn remove_on_add_private(&self, callback: AddPrivateCallbackId) { - self.imp.remove_on_reducer::("add_private", callback.0) + self.imp.remove_on_reducer::(3, callback.0) } } @@ -185,7 +185,7 @@ pub trait set_flags_for_add_private { impl set_flags_for_add_private for super::SetReducerFlags { fn add_private(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("add_private", flags); + self.imp.set_call_reducer_flags(3, flags); } } @@ -272,19 +272,19 @@ pub trait delete_player { impl delete_player for super::RemoteReducers { fn delete_player(&self, id: u64, ) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_player", DeletePlayer { id, }) + self.imp.call_reducer(4, DeletePlayer { id, }) } fn on_delete_player( &self, mut callback: impl FnMut(&super::EventContext, &u64, ) + Send + 'static, ) -> DeletePlayerCallbackId { DeletePlayerCallbackId(self.imp.on_reducer::( - "delete_player", + 4, Box::new(move |ctx: &super::EventContext, args: &DeletePlayer| callback(ctx, &args.id, )), )) } fn remove_on_delete_player(&self, callback: DeletePlayerCallbackId) { - self.imp.remove_on_reducer::("delete_player", callback.0) + self.imp.remove_on_reducer::(4, callback.0) } } @@ -304,7 +304,7 @@ pub trait set_flags_for_delete_player { impl set_flags_for_delete_player for super::SetReducerFlags { fn delete_player(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_player", flags); + self.imp.set_call_reducer_flags(4, flags); } } @@ -366,19 +366,19 @@ pub trait delete_players_by_name { impl delete_players_by_name for super::RemoteReducers { fn delete_players_by_name(&self, name: String, ) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_players_by_name", DeletePlayersByName { name, }) + self.imp.call_reducer(5, DeletePlayersByName { name, }) } fn on_delete_players_by_name( &self, mut callback: impl FnMut(&super::EventContext, &String, ) + Send + 'static, ) -> DeletePlayersByNameCallbackId { DeletePlayersByNameCallbackId(self.imp.on_reducer::( - "delete_players_by_name", + 5, Box::new(move |ctx: &super::EventContext, args: &DeletePlayersByName| callback(ctx, &args.name, )), )) } fn remove_on_delete_players_by_name(&self, callback: DeletePlayersByNameCallbackId) { - self.imp.remove_on_reducer::("delete_players_by_name", callback.0) + self.imp.remove_on_reducer::(5, callback.0) } } @@ -398,7 +398,7 @@ pub trait set_flags_for_delete_players_by_name { impl set_flags_for_delete_players_by_name for super::SetReducerFlags { fn delete_players_by_name(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_players_by_name", flags); + self.imp.set_call_reducer_flags(5, flags); } } @@ -474,7 +474,7 @@ pub trait HasSpecialStuffTableAccess { impl HasSpecialStuffTableAccess for super::RemoteTables { fn has_special_stuff(&self) -> HasSpecialStuffTableHandle<'_> { HasSpecialStuffTableHandle { - imp: self.imp.get_table::("has_special_stuff"), + imp: self.imp.get_table::(0), ctx: std::marker::PhantomData, } } @@ -605,19 +605,19 @@ pub trait identity_connected { impl identity_connected for super::RemoteReducers { fn identity_connected(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("__identity_connected__", IdentityConnected { }) + self.imp.call_reducer(0, IdentityConnected { }) } fn on_identity_connected( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> IdentityConnectedCallbackId { IdentityConnectedCallbackId(self.imp.on_reducer::( - "__identity_connected__", + 0, Box::new(move |ctx: &super::EventContext, args: &IdentityConnected| callback(ctx, )), )) } fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp.remove_on_reducer::("__identity_connected__", callback.0) + self.imp.remove_on_reducer::(0, callback.0) } } @@ -637,7 +637,7 @@ pub trait set_flags_for_identity_connected { impl set_flags_for_identity_connected for super::SetReducerFlags { fn identity_connected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__identity_connected__", flags); + self.imp.set_call_reducer_flags(0, flags); } } @@ -696,19 +696,19 @@ pub trait init { impl init for super::RemoteReducers { fn init(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("__init__", Init { }) + self.imp.call_reducer(1, Init { }) } fn on_init( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> InitCallbackId { InitCallbackId(self.imp.on_reducer::( - "__init__", + 1, Box::new(move |ctx: &super::EventContext, args: &Init| callback(ctx, )), )) } fn remove_on_init(&self, callback: InitCallbackId) { - self.imp.remove_on_reducer::("__init__", callback.0) + self.imp.remove_on_reducer::(1, callback.0) } } @@ -728,7 +728,7 @@ pub trait set_flags_for_init { impl set_flags_for_init for super::SetReducerFlags { fn init(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__init__", flags); + self.imp.set_call_reducer_flags(1, flags); } } @@ -840,18 +840,18 @@ impl __sdk::spacetime_module::InModule for Reducer { } impl __sdk::spacetime_module::Reducer for Reducer { - fn reducer_name(&self) -> &'static str { + fn reducer_index(&self) -> u32 { match self { - Reducer::IdentityConnected(_) => "__identity_connected__", - Reducer::Init(_) => "__init__", - Reducer::AddPlayer(_) => "add_player", - Reducer::AddPrivate(_) => "add_private", - Reducer::DeletePlayer(_) => "delete_player", - Reducer::DeletePlayersByName(_) => "delete_players_by_name", - Reducer::QueryPrivate(_) => "query_private", - Reducer::RepeatingTest(_) => "repeating_test", - Reducer::Test(_) => "test", - Reducer::TestBtreeIndexArgs(_) => "test_btree_index_args", + Reducer::IdentityConnected(_) => 0, + Reducer::Init(_) => 1, + Reducer::AddPlayer(_) => 2, + Reducer::AddPrivate(_) => 3, + Reducer::DeletePlayer(_) => 4, + Reducer::DeletePlayersByName(_) => 5, + Reducer::QueryPrivate(_) => 6, + Reducer::RepeatingTest(_) => 7, + Reducer::Test(_) => 8, + Reducer::TestBtreeIndexArgs(_) => 9, } } fn reducer_args(&self) -> &dyn std::any::Any { @@ -868,24 +868,40 @@ fn reducer_args(&self) -> &dyn std::any::Any { Reducer::TestBtreeIndexArgs(args) => args, } } -} -impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { - type Error = __anyhow::Error; -fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { - match &value.reducer_name[..] { - "__identity_connected__" => Ok(Reducer::IdentityConnected(__sdk::spacetime_module::parse_reducer_args("__identity_connected__", &value.args)?)), - "__init__" => Ok(Reducer::Init(__sdk::spacetime_module::parse_reducer_args("__init__", &value.args)?)), - "add_player" => Ok(Reducer::AddPlayer(__sdk::spacetime_module::parse_reducer_args("add_player", &value.args)?)), - "add_private" => Ok(Reducer::AddPrivate(__sdk::spacetime_module::parse_reducer_args("add_private", &value.args)?)), - "delete_player" => Ok(Reducer::DeletePlayer(__sdk::spacetime_module::parse_reducer_args("delete_player", &value.args)?)), - "delete_players_by_name" => Ok(Reducer::DeletePlayersByName(__sdk::spacetime_module::parse_reducer_args("delete_players_by_name", &value.args)?)), - "query_private" => Ok(Reducer::QueryPrivate(__sdk::spacetime_module::parse_reducer_args("query_private", &value.args)?)), - "repeating_test" => Ok(Reducer::RepeatingTest(__sdk::spacetime_module::parse_reducer_args("repeating_test", &value.args)?)), - "test" => Ok(Reducer::Test(__sdk::spacetime_module::parse_reducer_args("test", &value.args)?)), - "test_btree_index_args" => Ok(Reducer::TestBtreeIndexArgs(__sdk::spacetime_module::parse_reducer_args("test_btree_index_args", &value.args)?)), - _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), -} -} +fn parse_call_info( + reducer_id_to_idx: &impl Fn(__ws::ReducerId) -> anyhow::Result, + raw: __ws::ReducerCallInfo<__ws::BsatnFormat>, + ) -> anyhow::Result { + use __sdk::spacetime_module::parse_reducer_args; + let reducer_idx = reducer_id_to_idx(raw.reducer_id)?; + let name = Self::reducer_names()[reducer_idx as usize]; + match reducer_id_to_idx(raw.reducer_id)? { + 0 => Ok(Reducer::IdentityConnected(parse_reducer_args(name, &raw.args)?)), + 1 => Ok(Reducer::Init(parse_reducer_args(name, &raw.args)?)), + 2 => Ok(Reducer::AddPlayer(parse_reducer_args(name, &raw.args)?)), + 3 => Ok(Reducer::AddPrivate(parse_reducer_args(name, &raw.args)?)), + 4 => Ok(Reducer::DeletePlayer(parse_reducer_args(name, &raw.args)?)), + 5 => Ok(Reducer::DeletePlayersByName(parse_reducer_args(name, &raw.args)?)), + 6 => Ok(Reducer::QueryPrivate(parse_reducer_args(name, &raw.args)?)), + 7 => Ok(Reducer::RepeatingTest(parse_reducer_args(name, &raw.args)?)), + 8 => Ok(Reducer::Test(parse_reducer_args(name, &raw.args)?)), + 9 => Ok(Reducer::TestBtreeIndexArgs(parse_reducer_args(name, &raw.args)?)), + _ => unreachable!(), + + } +} +fn reducer_names() -> &'static [&'static str] {&[ + "__identity_connected__", + "__init__", + "add_player", + "add_private", + "delete_player", + "delete_players_by_name", + "query_private", + "repeating_test", + "test", + "test_btree_index_args", +]} } #[derive(Default)] @@ -904,57 +920,66 @@ pub struct DbUpdate { } -impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { - type Error = __anyhow::Error; - fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { - let mut db_update = DbUpdate::default(); - for table_update in raw.tables { - match &table_update.table_name[..] { - - "has_special_stuff" => db_update.has_special_stuff = has_special_stuff_table::parse_table_update(table_update)?, - "pk_multi_identity" => db_update.pk_multi_identity = pk_multi_identity_table::parse_table_update(table_update)?, - "points" => db_update.points = points_table::parse_table_update(table_update)?, - "private" => db_update.private = private_table::parse_table_update(table_update)?, - "repeating_test_arg" => db_update.repeating_test_arg = repeating_test_arg_table::parse_table_update(table_update)?, - "test_a" => db_update.test_a = test_a_table::parse_table_update(table_update)?, - "test_d" => db_update.test_d = test_d_table::parse_table_update(table_update)?, - "test_e" => db_update.test_e = test_e_table::parse_table_update(table_update)?, - "test_f" => db_update.test_f = test_f_table::parse_table_update(table_update)?, - - unknown => __anyhow::bail!("Unknown table {unknown:?} in DatabaseUpdate"), - } - } - Ok(db_update) - } -} - impl __sdk::spacetime_module::InModule for DbUpdate { type Module = RemoteModule; } impl __sdk::spacetime_module::DbUpdate for DbUpdate { fn apply_to_client_cache(&self, cache: &mut __sdk::client_cache::ClientCache) { - cache.apply_diff_to_table::("has_special_stuff", &self.has_special_stuff); - cache.apply_diff_to_table::("pk_multi_identity", &self.pk_multi_identity); - cache.apply_diff_to_table::("points", &self.points); - cache.apply_diff_to_table::("private", &self.private); - cache.apply_diff_to_table::("repeating_test_arg", &self.repeating_test_arg); - cache.apply_diff_to_table::("test_a", &self.test_a); - cache.apply_diff_to_table::("test_d", &self.test_d); - cache.apply_diff_to_table::("test_e", &self.test_e); - cache.apply_diff_to_table::("test_f", &self.test_f); + cache.apply_diff_to_table::(0, &self.has_special_stuff); + cache.apply_diff_to_table::(1, &self.pk_multi_identity); + cache.apply_diff_to_table::(2, &self.points); + cache.apply_diff_to_table::(3, &self.private); + cache.apply_diff_to_table::(4, &self.repeating_test_arg); + cache.apply_diff_to_table::(5, &self.test_a); + cache.apply_diff_to_table::(6, &self.test_d); + cache.apply_diff_to_table::(7, &self.test_e); + cache.apply_diff_to_table::(8, &self.test_f); } fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::callbacks::DbCallbacks) { - callbacks.invoke_table_row_callbacks::("has_special_stuff", &self.has_special_stuff, event); - callbacks.invoke_table_row_callbacks::("pk_multi_identity", &self.pk_multi_identity, event); - callbacks.invoke_table_row_callbacks::("points", &self.points, event); - callbacks.invoke_table_row_callbacks::("private", &self.private, event); - callbacks.invoke_table_row_callbacks::("repeating_test_arg", &self.repeating_test_arg, event); - callbacks.invoke_table_row_callbacks::("test_a", &self.test_a, event); - callbacks.invoke_table_row_callbacks::("test_d", &self.test_d, event); - callbacks.invoke_table_row_callbacks::("test_e", &self.test_e, event); - callbacks.invoke_table_row_callbacks::("test_f", &self.test_f, event); -} + callbacks.invoke_table_row_callbacks::(0, &self.has_special_stuff, event); + callbacks.invoke_table_row_callbacks::(1, &self.pk_multi_identity, event); + callbacks.invoke_table_row_callbacks::(2, &self.points, event); + callbacks.invoke_table_row_callbacks::(3, &self.private, event); + callbacks.invoke_table_row_callbacks::(4, &self.repeating_test_arg, event); + callbacks.invoke_table_row_callbacks::(5, &self.test_a, event); + callbacks.invoke_table_row_callbacks::(6, &self.test_d, event); + callbacks.invoke_table_row_callbacks::(7, &self.test_e, event); + callbacks.invoke_table_row_callbacks::(8, &self.test_f, event); +} +fn parse_update( + table_id_to_idx: &impl Fn(__ws::TableId) -> anyhow::Result, + raw: __ws::DatabaseUpdate<__ws::BsatnFormat>, + ) -> anyhow::Result { + let mut db_update = DbUpdate::default(); + for table_update in raw.tables { + match table_id_to_idx(table_update.table_id)? { + 0 => db_update.has_special_stuff = has_special_stuff_table::parse_table_update(table_update)?, + 1 => db_update.pk_multi_identity = pk_multi_identity_table::parse_table_update(table_update)?, + 2 => db_update.points = points_table::parse_table_update(table_update)?, + 3 => db_update.private = private_table::parse_table_update(table_update)?, + 4 => db_update.repeating_test_arg = repeating_test_arg_table::parse_table_update(table_update)?, + 5 => db_update.test_a = test_a_table::parse_table_update(table_update)?, + 6 => db_update.test_d = test_d_table::parse_table_update(table_update)?, + 7 => db_update.test_e = test_e_table::parse_table_update(table_update)?, + 8 => db_update.test_f = test_f_table::parse_table_update(table_update)?, + + _ => unreachable!(), + } + } + Ok(db_update) + } +fn table_names() -> &'static [&'static str] {&[ + "has_special_stuff", + "pk_multi_identity", + "points", + "private", + "repeating_test_arg", + "test_a", + "test_d", + "test_e", + "test_f", +]} } @@ -1370,7 +1395,7 @@ pub trait PkMultiIdentityTableAccess { impl PkMultiIdentityTableAccess for super::RemoteTables { fn pk_multi_identity(&self) -> PkMultiIdentityTableHandle<'_> { PkMultiIdentityTableHandle { - imp: self.imp.get_table::("pk_multi_identity"), + imp: self.imp.get_table::(1), ctx: std::marker::PhantomData, } } @@ -1591,7 +1616,7 @@ pub trait PointsTableAccess { impl PointsTableAccess for super::RemoteTables { fn points(&self) -> PointsTableHandle<'_> { PointsTableHandle { - imp: self.imp.get_table::("points"), + imp: self.imp.get_table::(2), ctx: std::marker::PhantomData, } } @@ -1681,7 +1706,7 @@ pub trait PrivateTableAccess { impl PrivateTableAccess for super::RemoteTables { fn private(&self) -> PrivateTableHandle<'_> { PrivateTableHandle { - imp: self.imp.get_table::("private"), + imp: self.imp.get_table::(3), ctx: std::marker::PhantomData, } } @@ -1811,19 +1836,19 @@ pub trait query_private { impl query_private for super::RemoteReducers { fn query_private(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("query_private", QueryPrivate { }) + self.imp.call_reducer(6, QueryPrivate { }) } fn on_query_private( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> QueryPrivateCallbackId { QueryPrivateCallbackId(self.imp.on_reducer::( - "query_private", + 6, Box::new(move |ctx: &super::EventContext, args: &QueryPrivate| callback(ctx, )), )) } fn remove_on_query_private(&self, callback: QueryPrivateCallbackId) { - self.imp.remove_on_reducer::("query_private", callback.0) + self.imp.remove_on_reducer::(6, callback.0) } } @@ -1843,7 +1868,7 @@ pub trait set_flags_for_query_private { impl set_flags_for_query_private for super::SetReducerFlags { fn query_private(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("query_private", flags); + self.imp.set_call_reducer_flags(6, flags); } } @@ -1887,7 +1912,7 @@ pub trait RepeatingTestArgTableAccess { impl RepeatingTestArgTableAccess for super::RemoteTables { fn repeating_test_arg(&self) -> RepeatingTestArgTableHandle<'_> { RepeatingTestArgTableHandle { - imp: self.imp.get_table::("repeating_test_arg"), + imp: self.imp.get_table::(4), ctx: std::marker::PhantomData, } } @@ -2072,19 +2097,19 @@ pub trait repeating_test { impl repeating_test for super::RemoteReducers { fn repeating_test(&self, arg: RepeatingTestArg, ) -> __anyhow::Result<()> { - self.imp.call_reducer("repeating_test", RepeatingTest { arg, }) + self.imp.call_reducer(7, RepeatingTest { arg, }) } fn on_repeating_test( &self, mut callback: impl FnMut(&super::EventContext, &RepeatingTestArg, ) + Send + 'static, ) -> RepeatingTestCallbackId { RepeatingTestCallbackId(self.imp.on_reducer::( - "repeating_test", + 7, Box::new(move |ctx: &super::EventContext, args: &RepeatingTest| callback(ctx, &args.arg, )), )) } fn remove_on_repeating_test(&self, callback: RepeatingTestCallbackId) { - self.imp.remove_on_reducer::("repeating_test", callback.0) + self.imp.remove_on_reducer::(7, callback.0) } } @@ -2104,7 +2129,7 @@ pub trait set_flags_for_repeating_test { impl set_flags_for_repeating_test for super::SetReducerFlags { fn repeating_test(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("repeating_test", flags); + self.imp.set_call_reducer_flags(7, flags); } } @@ -2148,7 +2173,7 @@ pub trait TestATableAccess { impl TestATableAccess for super::RemoteTables { fn test_a(&self) -> TestATableHandle<'_> { TestATableHandle { - imp: self.imp.get_table::("test_a"), + imp: self.imp.get_table::(5), ctx: std::marker::PhantomData, } } @@ -2305,19 +2330,19 @@ pub trait test_btree_index_args { impl test_btree_index_args for super::RemoteReducers { fn test_btree_index_args(&self, ) -> __anyhow::Result<()> { - self.imp.call_reducer("test_btree_index_args", TestBtreeIndexArgs { }) + self.imp.call_reducer(9, TestBtreeIndexArgs { }) } fn on_test_btree_index_args( &self, mut callback: impl FnMut(&super::EventContext, ) + Send + 'static, ) -> TestBtreeIndexArgsCallbackId { TestBtreeIndexArgsCallbackId(self.imp.on_reducer::( - "test_btree_index_args", + 9, Box::new(move |ctx: &super::EventContext, args: &TestBtreeIndexArgs| callback(ctx, )), )) } fn remove_on_test_btree_index_args(&self, callback: TestBtreeIndexArgsCallbackId) { - self.imp.remove_on_reducer::("test_btree_index_args", callback.0) + self.imp.remove_on_reducer::(9, callback.0) } } @@ -2337,7 +2362,7 @@ pub trait set_flags_for_test_btree_index_args { impl set_flags_for_test_btree_index_args for super::SetReducerFlags { fn test_btree_index_args(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("test_btree_index_args", flags); + self.imp.set_call_reducer_flags(9, flags); } } @@ -2382,7 +2407,7 @@ pub trait TestDTableAccess { impl TestDTableAccess for super::RemoteTables { fn test_d(&self) -> TestDTableHandle<'_> { TestDTableHandle { - imp: self.imp.get_table::("test_d"), + imp: self.imp.get_table::(6), ctx: std::marker::PhantomData, } } @@ -2498,7 +2523,7 @@ pub trait TestETableAccess { impl TestETableAccess for super::RemoteTables { fn test_e(&self) -> TestETableHandle<'_> { TestETableHandle { - imp: self.imp.get_table::("test_e"), + imp: self.imp.get_table::(7), ctx: std::marker::PhantomData, } } @@ -2664,7 +2689,7 @@ pub trait TestFTableAccess { impl TestFTableAccess for super::RemoteTables { fn test_f(&self) -> TestFTableHandle<'_> { TestFTableHandle { - imp: self.imp.get_table::("test_f"), + imp: self.imp.get_table::(8), ctx: std::marker::PhantomData, } } @@ -2811,19 +2836,19 @@ arg_2: TestB, arg_3: NamespaceTestC, arg_4: NamespaceTestF, ) -> __anyhow::Result<()> { - self.imp.call_reducer("test", Test { arg, arg_2, arg_3, arg_4, }) + self.imp.call_reducer(8, Test { arg, arg_2, arg_3, arg_4, }) } fn on_test( &self, mut callback: impl FnMut(&super::EventContext, &TestA, &TestB, &NamespaceTestC, &NamespaceTestF, ) + Send + 'static, ) -> TestCallbackId { TestCallbackId(self.imp.on_reducer::( - "test", + 8, Box::new(move |ctx: &super::EventContext, args: &Test| callback(ctx, &args.arg, &args.arg_2, &args.arg_3, &args.arg_4, )), )) } fn remove_on_test(&self, callback: TestCallbackId) { - self.imp.remove_on_reducer::("test", callback.0) + self.imp.remove_on_reducer::(8, callback.0) } } @@ -2843,7 +2868,7 @@ pub trait set_flags_for_test { impl set_flags_for_test for super::SetReducerFlags { fn test(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("test", flags); + self.imp.set_call_reducer_flags(8, flags); } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/connected_table.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/connected_table.rs index 5099d2f598a..10d48618744 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/connected_table.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/connected_table.rs @@ -35,7 +35,7 @@ pub trait ConnectedTableAccess { impl ConnectedTableAccess for super::RemoteTables { fn connected(&self) -> ConnectedTableHandle<'_> { ConnectedTableHandle { - imp: self.imp.get_table::("connected"), + imp: self.imp.get_table::(0), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/disconnected_table.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/disconnected_table.rs index 8905a117917..92ef846f9cd 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/disconnected_table.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/disconnected_table.rs @@ -35,7 +35,7 @@ pub trait DisconnectedTableAccess { impl DisconnectedTableAccess for super::RemoteTables { fn disconnected(&self) -> DisconnectedTableHandle<'_> { DisconnectedTableHandle { - imp: self.imp.get_table::("disconnected"), + imp: self.imp.get_table::(1), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs index f15e0b3f320..7e6e61dd707 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_connected_reducer.rs @@ -50,20 +50,19 @@ pub trait identity_connected { impl identity_connected for super::RemoteReducers { fn identity_connected(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("__identity_connected__", IdentityConnected {}) + self.imp.call_reducer(0, IdentityConnected {}) } fn on_identity_connected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityConnectedCallbackId { IdentityConnectedCallbackId(self.imp.on_reducer::( - "__identity_connected__", + 0, Box::new(move |ctx: &super::EventContext, args: &IdentityConnected| callback(ctx)), )) } fn remove_on_identity_connected(&self, callback: IdentityConnectedCallbackId) { - self.imp - .remove_on_reducer::("__identity_connected__", callback.0) + self.imp.remove_on_reducer::(0, callback.0) } } @@ -83,6 +82,6 @@ pub trait set_flags_for_identity_connected { impl set_flags_for_identity_connected for super::SetReducerFlags { fn identity_connected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__identity_connected__", flags); + self.imp.set_call_reducer_flags(0, flags); } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs index 539ad0ecd03..cf36b434d21 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/identity_disconnected_reducer.rs @@ -50,21 +50,19 @@ pub trait identity_disconnected { impl identity_disconnected for super::RemoteReducers { fn identity_disconnected(&self) -> __anyhow::Result<()> { - self.imp - .call_reducer("__identity_disconnected__", IdentityDisconnected {}) + self.imp.call_reducer(1, IdentityDisconnected {}) } fn on_identity_disconnected( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> IdentityDisconnectedCallbackId { IdentityDisconnectedCallbackId(self.imp.on_reducer::( - "__identity_disconnected__", + 1, Box::new(move |ctx: &super::EventContext, args: &IdentityDisconnected| callback(ctx)), )) } fn remove_on_identity_disconnected(&self, callback: IdentityDisconnectedCallbackId) { - self.imp - .remove_on_reducer::("__identity_disconnected__", callback.0) + self.imp.remove_on_reducer::(1, callback.0) } } @@ -84,6 +82,6 @@ pub trait set_flags_for_identity_disconnected { impl set_flags_for_identity_disconnected for super::SetReducerFlags { fn identity_disconnected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("__identity_disconnected__", flags); + self.imp.set_call_reducer_flags(1, flags); } } diff --git a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs index f73114a1878..a76b165e1b7 100644 --- a/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs +++ b/crates/sdk/tests/connect_disconnect_client/src/module_bindings/mod.rs @@ -40,10 +40,10 @@ impl __sdk::spacetime_module::InModule for Reducer { } impl __sdk::spacetime_module::Reducer for Reducer { - fn reducer_name(&self) -> &'static str { + fn reducer_index(&self) -> u32 { match self { - Reducer::IdentityConnected(_) => "__identity_connected__", - Reducer::IdentityDisconnected(_) => "__identity_disconnected__", + Reducer::IdentityConnected(_) => 0, + Reducer::IdentityDisconnected(_) => 1, } } fn reducer_args(&self) -> &dyn std::any::Any { @@ -52,21 +52,22 @@ impl __sdk::spacetime_module::Reducer for Reducer { Reducer::IdentityDisconnected(args) => args, } } -} -impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { - type Error = __anyhow::Error; - fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { - match &value.reducer_name[..] { - "__identity_connected__" => Ok(Reducer::IdentityConnected(__sdk::spacetime_module::parse_reducer_args( - "__identity_connected__", - &value.args, - )?)), - "__identity_disconnected__" => Ok(Reducer::IdentityDisconnected( - __sdk::spacetime_module::parse_reducer_args("__identity_disconnected__", &value.args)?, - )), - _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), + fn parse_call_info( + reducer_id_to_idx: &impl Fn(__ws::ReducerId) -> anyhow::Result, + raw: __ws::ReducerCallInfo<__ws::BsatnFormat>, + ) -> anyhow::Result { + use __sdk::spacetime_module::parse_reducer_args; + let reducer_idx = reducer_id_to_idx(raw.reducer_id)?; + let name = Self::reducer_names()[reducer_idx as usize]; + match reducer_id_to_idx(raw.reducer_id)? { + 0 => Ok(Reducer::IdentityConnected(parse_reducer_args(name, &raw.args)?)), + 1 => Ok(Reducer::IdentityDisconnected(parse_reducer_args(name, &raw.args)?)), + _ => unreachable!(), } } + fn reducer_names() -> &'static [&'static str] { + &["__identity_connected__", "__identity_disconnected__"] + } } #[derive(Default)] @@ -77,34 +78,36 @@ pub struct DbUpdate { disconnected: __sdk::spacetime_module::TableUpdate, } -impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { - type Error = __anyhow::Error; - fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { - let mut db_update = DbUpdate::default(); - for table_update in raw.tables { - match &table_update.table_name[..] { - "connected" => db_update.connected = connected_table::parse_table_update(table_update)?, - "disconnected" => db_update.disconnected = disconnected_table::parse_table_update(table_update)?, - - unknown => __anyhow::bail!("Unknown table {unknown:?} in DatabaseUpdate"), - } - } - Ok(db_update) - } -} - impl __sdk::spacetime_module::InModule for DbUpdate { type Module = RemoteModule; } impl __sdk::spacetime_module::DbUpdate for DbUpdate { fn apply_to_client_cache(&self, cache: &mut __sdk::client_cache::ClientCache) { - cache.apply_diff_to_table::("connected", &self.connected); - cache.apply_diff_to_table::("disconnected", &self.disconnected); + cache.apply_diff_to_table::(0, &self.connected); + cache.apply_diff_to_table::(1, &self.disconnected); } fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::callbacks::DbCallbacks) { - callbacks.invoke_table_row_callbacks::("connected", &self.connected, event); - callbacks.invoke_table_row_callbacks::("disconnected", &self.disconnected, event); + callbacks.invoke_table_row_callbacks::(0, &self.connected, event); + callbacks.invoke_table_row_callbacks::(1, &self.disconnected, event); + } + fn parse_update( + table_id_to_idx: &impl Fn(__ws::TableId) -> anyhow::Result, + raw: __ws::DatabaseUpdate<__ws::BsatnFormat>, + ) -> anyhow::Result { + let mut db_update = DbUpdate::default(); + for table_update in raw.tables { + match table_id_to_idx(table_update.table_id)? { + 0 => db_update.connected = connected_table::parse_table_update(table_update)?, + 1 => db_update.disconnected = disconnected_table::parse_table_update(table_update)?, + + _ => unreachable!(), + } + } + Ok(db_update) + } + fn table_names() -> &'static [&'static str] { + &["connected", "disconnected"] } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs index ef302a66de4..854b8e77221 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_address_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_pk_address { impl delete_pk_address for super::RemoteReducers { fn delete_pk_address(&self, a: __sdk::Address) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_address", DeletePkAddress { a }) + self.imp.call_reducer(0, DeletePkAddress { a }) } fn on_delete_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address) + Send + 'static, ) -> DeletePkAddressCallbackId { DeletePkAddressCallbackId(self.imp.on_reducer::( - "delete_pk_address", + 0, Box::new(move |ctx: &super::EventContext, args: &DeletePkAddress| callback(ctx, &args.a)), )) } fn remove_on_delete_pk_address(&self, callback: DeletePkAddressCallbackId) { - self.imp - .remove_on_reducer::("delete_pk_address", callback.0) + self.imp.remove_on_reducer::(0, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_pk_address { impl set_flags_for_delete_pk_address for super::SetReducerFlags { fn delete_pk_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_address", flags); + self.imp.set_call_reducer_flags(0, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs index bad581aa9cb..92898766c78 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_bool_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_bool { impl delete_pk_bool for super::RemoteReducers { fn delete_pk_bool(&self, b: bool) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_bool", DeletePkBool { b }) + self.imp.call_reducer(1, DeletePkBool { b }) } fn on_delete_pk_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool) + Send + 'static, ) -> DeletePkBoolCallbackId { DeletePkBoolCallbackId(self.imp.on_reducer::( - "delete_pk_bool", + 1, Box::new(move |ctx: &super::EventContext, args: &DeletePkBool| callback(ctx, &args.b)), )) } fn remove_on_delete_pk_bool(&self, callback: DeletePkBoolCallbackId) { - self.imp.remove_on_reducer::("delete_pk_bool", callback.0) + self.imp.remove_on_reducer::(1, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_bool { impl set_flags_for_delete_pk_bool for super::SetReducerFlags { fn delete_pk_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_bool", flags); + self.imp.set_call_reducer_flags(1, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs index 37d809e71b8..6df5190b2ac 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_128_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_i_128 { impl delete_pk_i_128 for super::RemoteReducers { fn delete_pk_i_128(&self, n: i128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i128", DeletePkI128 { n }) + self.imp.call_reducer(2, DeletePkI128 { n }) } fn on_delete_pk_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128) + Send + 'static, ) -> DeletePkI128CallbackId { DeletePkI128CallbackId(self.imp.on_reducer::( - "delete_pk_i128", + 2, Box::new(move |ctx: &super::EventContext, args: &DeletePkI128| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_i_128(&self, callback: DeletePkI128CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i128", callback.0) + self.imp.remove_on_reducer::(2, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_i_128 { impl set_flags_for_delete_pk_i_128 for super::SetReducerFlags { fn delete_pk_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_i128", flags); + self.imp.set_call_reducer_flags(2, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs index fc5b3576d2f..76d58c0b9cd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_16_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_i_16 { impl delete_pk_i_16 for super::RemoteReducers { fn delete_pk_i_16(&self, n: i16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i16", DeletePkI16 { n }) + self.imp.call_reducer(3, DeletePkI16 { n }) } fn on_delete_pk_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16) + Send + 'static, ) -> DeletePkI16CallbackId { DeletePkI16CallbackId(self.imp.on_reducer::( - "delete_pk_i16", + 3, Box::new(move |ctx: &super::EventContext, args: &DeletePkI16| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_i_16(&self, callback: DeletePkI16CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i16", callback.0) + self.imp.remove_on_reducer::(3, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_i_16 { impl set_flags_for_delete_pk_i_16 for super::SetReducerFlags { fn delete_pk_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_i16", flags); + self.imp.set_call_reducer_flags(3, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs index fa3e0f10647..b3c8888f40d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_256_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_i_256 { impl delete_pk_i_256 for super::RemoteReducers { fn delete_pk_i_256(&self, n: __sats::i256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i256", DeletePkI256 { n }) + self.imp.call_reducer(4, DeletePkI256 { n }) } fn on_delete_pk_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256) + Send + 'static, ) -> DeletePkI256CallbackId { DeletePkI256CallbackId(self.imp.on_reducer::( - "delete_pk_i256", + 4, Box::new(move |ctx: &super::EventContext, args: &DeletePkI256| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_i_256(&self, callback: DeletePkI256CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i256", callback.0) + self.imp.remove_on_reducer::(4, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_i_256 { impl set_flags_for_delete_pk_i_256 for super::SetReducerFlags { fn delete_pk_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_i256", flags); + self.imp.set_call_reducer_flags(4, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs index 2b958640d52..c93efc67cc7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_32_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_i_32 { impl delete_pk_i_32 for super::RemoteReducers { fn delete_pk_i_32(&self, n: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i32", DeletePkI32 { n }) + self.imp.call_reducer(5, DeletePkI32 { n }) } fn on_delete_pk_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> DeletePkI32CallbackId { DeletePkI32CallbackId(self.imp.on_reducer::( - "delete_pk_i32", + 5, Box::new(move |ctx: &super::EventContext, args: &DeletePkI32| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_i_32(&self, callback: DeletePkI32CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i32", callback.0) + self.imp.remove_on_reducer::(5, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_i_32 { impl set_flags_for_delete_pk_i_32 for super::SetReducerFlags { fn delete_pk_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_i32", flags); + self.imp.set_call_reducer_flags(5, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs index 34330ea4201..798c3ba2c07 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_64_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_i_64 { impl delete_pk_i_64 for super::RemoteReducers { fn delete_pk_i_64(&self, n: i64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i64", DeletePkI64 { n }) + self.imp.call_reducer(6, DeletePkI64 { n }) } fn on_delete_pk_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64) + Send + 'static, ) -> DeletePkI64CallbackId { DeletePkI64CallbackId(self.imp.on_reducer::( - "delete_pk_i64", + 6, Box::new(move |ctx: &super::EventContext, args: &DeletePkI64| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_i_64(&self, callback: DeletePkI64CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i64", callback.0) + self.imp.remove_on_reducer::(6, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_i_64 { impl set_flags_for_delete_pk_i_64 for super::SetReducerFlags { fn delete_pk_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_i64", flags); + self.imp.set_call_reducer_flags(6, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs index 94e022f6ada..c6a816d766f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_i_8_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_i_8 { impl delete_pk_i_8 for super::RemoteReducers { fn delete_pk_i_8(&self, n: i8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_i8", DeletePkI8 { n }) + self.imp.call_reducer(7, DeletePkI8 { n }) } fn on_delete_pk_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8) + Send + 'static, ) -> DeletePkI8CallbackId { DeletePkI8CallbackId(self.imp.on_reducer::( - "delete_pk_i8", + 7, Box::new(move |ctx: &super::EventContext, args: &DeletePkI8| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_i_8(&self, callback: DeletePkI8CallbackId) { - self.imp.remove_on_reducer::("delete_pk_i8", callback.0) + self.imp.remove_on_reducer::(7, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_i_8 { impl set_flags_for_delete_pk_i_8 for super::SetReducerFlags { fn delete_pk_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_i8", flags); + self.imp.set_call_reducer_flags(7, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs index ee73a1d1a77..a0091457135 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_identity_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_pk_identity { impl delete_pk_identity for super::RemoteReducers { fn delete_pk_identity(&self, i: __sdk::Identity) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_identity", DeletePkIdentity { i }) + self.imp.call_reducer(8, DeletePkIdentity { i }) } fn on_delete_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity) + Send + 'static, ) -> DeletePkIdentityCallbackId { DeletePkIdentityCallbackId(self.imp.on_reducer::( - "delete_pk_identity", + 8, Box::new(move |ctx: &super::EventContext, args: &DeletePkIdentity| callback(ctx, &args.i)), )) } fn remove_on_delete_pk_identity(&self, callback: DeletePkIdentityCallbackId) { - self.imp - .remove_on_reducer::("delete_pk_identity", callback.0) + self.imp.remove_on_reducer::(8, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_pk_identity { impl set_flags_for_delete_pk_identity for super::SetReducerFlags { fn delete_pk_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_identity", flags); + self.imp.set_call_reducer_flags(8, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs index 5cdbb0814b9..57f6b1c5d53 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_string_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_pk_string { impl delete_pk_string for super::RemoteReducers { fn delete_pk_string(&self, s: String) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_string", DeletePkString { s }) + self.imp.call_reducer(9, DeletePkString { s }) } fn on_delete_pk_string( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> DeletePkStringCallbackId { DeletePkStringCallbackId(self.imp.on_reducer::( - "delete_pk_string", + 9, Box::new(move |ctx: &super::EventContext, args: &DeletePkString| callback(ctx, &args.s)), )) } fn remove_on_delete_pk_string(&self, callback: DeletePkStringCallbackId) { - self.imp - .remove_on_reducer::("delete_pk_string", callback.0) + self.imp.remove_on_reducer::(9, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_pk_string { impl set_flags_for_delete_pk_string for super::SetReducerFlags { fn delete_pk_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_string", flags); + self.imp.set_call_reducer_flags(9, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs index da5b69c3952..baee06a6771 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_128_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_u_128 { impl delete_pk_u_128 for super::RemoteReducers { fn delete_pk_u_128(&self, n: u128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u128", DeletePkU128 { n }) + self.imp.call_reducer(10, DeletePkU128 { n }) } fn on_delete_pk_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128) + Send + 'static, ) -> DeletePkU128CallbackId { DeletePkU128CallbackId(self.imp.on_reducer::( - "delete_pk_u128", + 10, Box::new(move |ctx: &super::EventContext, args: &DeletePkU128| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_u_128(&self, callback: DeletePkU128CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u128", callback.0) + self.imp.remove_on_reducer::(10, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_u_128 { impl set_flags_for_delete_pk_u_128 for super::SetReducerFlags { fn delete_pk_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_u128", flags); + self.imp.set_call_reducer_flags(10, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs index 6dc81e2a5e2..c9d9bf4fc65 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_16_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_u_16 { impl delete_pk_u_16 for super::RemoteReducers { fn delete_pk_u_16(&self, n: u16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u16", DeletePkU16 { n }) + self.imp.call_reducer(11, DeletePkU16 { n }) } fn on_delete_pk_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16) + Send + 'static, ) -> DeletePkU16CallbackId { DeletePkU16CallbackId(self.imp.on_reducer::( - "delete_pk_u16", + 11, Box::new(move |ctx: &super::EventContext, args: &DeletePkU16| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_u_16(&self, callback: DeletePkU16CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u16", callback.0) + self.imp.remove_on_reducer::(11, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_u_16 { impl set_flags_for_delete_pk_u_16 for super::SetReducerFlags { fn delete_pk_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_u16", flags); + self.imp.set_call_reducer_flags(11, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs index 295f70ba972..503ddf86942 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_256_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_u_256 { impl delete_pk_u_256 for super::RemoteReducers { fn delete_pk_u_256(&self, n: __sats::u256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u256", DeletePkU256 { n }) + self.imp.call_reducer(12, DeletePkU256 { n }) } fn on_delete_pk_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256) + Send + 'static, ) -> DeletePkU256CallbackId { DeletePkU256CallbackId(self.imp.on_reducer::( - "delete_pk_u256", + 12, Box::new(move |ctx: &super::EventContext, args: &DeletePkU256| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_u_256(&self, callback: DeletePkU256CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u256", callback.0) + self.imp.remove_on_reducer::(12, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_u_256 { impl set_flags_for_delete_pk_u_256 for super::SetReducerFlags { fn delete_pk_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_u256", flags); + self.imp.set_call_reducer_flags(12, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs index d5f7b40a957..68a304a1c2e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_32_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_u_32 { impl delete_pk_u_32 for super::RemoteReducers { fn delete_pk_u_32(&self, n: u32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u32", DeletePkU32 { n }) + self.imp.call_reducer(13, DeletePkU32 { n }) } fn on_delete_pk_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32) + Send + 'static, ) -> DeletePkU32CallbackId { DeletePkU32CallbackId(self.imp.on_reducer::( - "delete_pk_u32", + 13, Box::new(move |ctx: &super::EventContext, args: &DeletePkU32| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_u_32(&self, callback: DeletePkU32CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u32", callback.0) + self.imp.remove_on_reducer::(13, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_u_32 { impl set_flags_for_delete_pk_u_32 for super::SetReducerFlags { fn delete_pk_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_u32", flags); + self.imp.set_call_reducer_flags(13, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs index 33ab5fcc7dc..f7424a9ddc0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_64_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_u_64 { impl delete_pk_u_64 for super::RemoteReducers { fn delete_pk_u_64(&self, n: u64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u64", DeletePkU64 { n }) + self.imp.call_reducer(14, DeletePkU64 { n }) } fn on_delete_pk_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64) + Send + 'static, ) -> DeletePkU64CallbackId { DeletePkU64CallbackId(self.imp.on_reducer::( - "delete_pk_u64", + 14, Box::new(move |ctx: &super::EventContext, args: &DeletePkU64| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_u_64(&self, callback: DeletePkU64CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u64", callback.0) + self.imp.remove_on_reducer::(14, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_u_64 { impl set_flags_for_delete_pk_u_64 for super::SetReducerFlags { fn delete_pk_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_u64", flags); + self.imp.set_call_reducer_flags(14, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs index 5962cec3438..53a28168675 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_pk_u_8_reducer.rs @@ -52,19 +52,19 @@ pub trait delete_pk_u_8 { impl delete_pk_u_8 for super::RemoteReducers { fn delete_pk_u_8(&self, n: u8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_pk_u8", DeletePkU8 { n }) + self.imp.call_reducer(15, DeletePkU8 { n }) } fn on_delete_pk_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8) + Send + 'static, ) -> DeletePkU8CallbackId { DeletePkU8CallbackId(self.imp.on_reducer::( - "delete_pk_u8", + 15, Box::new(move |ctx: &super::EventContext, args: &DeletePkU8| callback(ctx, &args.n)), )) } fn remove_on_delete_pk_u_8(&self, callback: DeletePkU8CallbackId) { - self.imp.remove_on_reducer::("delete_pk_u8", callback.0) + self.imp.remove_on_reducer::(15, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_delete_pk_u_8 { impl set_flags_for_delete_pk_u_8 for super::SetReducerFlags { fn delete_pk_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_pk_u8", flags); + self.imp.set_call_reducer_flags(15, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs index c034849d2e4..f172e0d1e17 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_address_reducer.rs @@ -52,21 +52,19 @@ pub trait delete_unique_address { impl delete_unique_address for super::RemoteReducers { fn delete_unique_address(&self, a: __sdk::Address) -> __anyhow::Result<()> { - self.imp - .call_reducer("delete_unique_address", DeleteUniqueAddress { a }) + self.imp.call_reducer(16, DeleteUniqueAddress { a }) } fn on_delete_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address) + Send + 'static, ) -> DeleteUniqueAddressCallbackId { DeleteUniqueAddressCallbackId(self.imp.on_reducer::( - "delete_unique_address", + 16, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueAddress| callback(ctx, &args.a)), )) } fn remove_on_delete_unique_address(&self, callback: DeleteUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_address", callback.0) + self.imp.remove_on_reducer::(16, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_delete_unique_address { impl set_flags_for_delete_unique_address for super::SetReducerFlags { fn delete_unique_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_address", flags); + self.imp.set_call_reducer_flags(16, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs index eef5605b62b..b465a8f9ede 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_bool_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_bool { impl delete_unique_bool for super::RemoteReducers { fn delete_unique_bool(&self, b: bool) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_bool", DeleteUniqueBool { b }) + self.imp.call_reducer(17, DeleteUniqueBool { b }) } fn on_delete_unique_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool) + Send + 'static, ) -> DeleteUniqueBoolCallbackId { DeleteUniqueBoolCallbackId(self.imp.on_reducer::( - "delete_unique_bool", + 17, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueBool| callback(ctx, &args.b)), )) } fn remove_on_delete_unique_bool(&self, callback: DeleteUniqueBoolCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_bool", callback.0) + self.imp.remove_on_reducer::(17, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_bool { impl set_flags_for_delete_unique_bool for super::SetReducerFlags { fn delete_unique_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_bool", flags); + self.imp.set_call_reducer_flags(17, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs index 6f2950634b6..7ca30f237b4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_128_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_i_128 { impl delete_unique_i_128 for super::RemoteReducers { fn delete_unique_i_128(&self, n: i128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i128", DeleteUniqueI128 { n }) + self.imp.call_reducer(18, DeleteUniqueI128 { n }) } fn on_delete_unique_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128) + Send + 'static, ) -> DeleteUniqueI128CallbackId { DeleteUniqueI128CallbackId(self.imp.on_reducer::( - "delete_unique_i128", + 18, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI128| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_i_128(&self, callback: DeleteUniqueI128CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i128", callback.0) + self.imp.remove_on_reducer::(18, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_i_128 { impl set_flags_for_delete_unique_i_128 for super::SetReducerFlags { fn delete_unique_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_i128", flags); + self.imp.set_call_reducer_flags(18, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs index 0f08c5ec716..fa2f47ab152 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_16_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_i_16 { impl delete_unique_i_16 for super::RemoteReducers { fn delete_unique_i_16(&self, n: i16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i16", DeleteUniqueI16 { n }) + self.imp.call_reducer(19, DeleteUniqueI16 { n }) } fn on_delete_unique_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16) + Send + 'static, ) -> DeleteUniqueI16CallbackId { DeleteUniqueI16CallbackId(self.imp.on_reducer::( - "delete_unique_i16", + 19, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI16| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_i_16(&self, callback: DeleteUniqueI16CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i16", callback.0) + self.imp.remove_on_reducer::(19, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_i_16 { impl set_flags_for_delete_unique_i_16 for super::SetReducerFlags { fn delete_unique_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_i16", flags); + self.imp.set_call_reducer_flags(19, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs index 4d20cf591fe..df108943c54 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_256_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_i_256 { impl delete_unique_i_256 for super::RemoteReducers { fn delete_unique_i_256(&self, n: __sats::i256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i256", DeleteUniqueI256 { n }) + self.imp.call_reducer(20, DeleteUniqueI256 { n }) } fn on_delete_unique_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256) + Send + 'static, ) -> DeleteUniqueI256CallbackId { DeleteUniqueI256CallbackId(self.imp.on_reducer::( - "delete_unique_i256", + 20, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI256| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_i_256(&self, callback: DeleteUniqueI256CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i256", callback.0) + self.imp.remove_on_reducer::(20, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_i_256 { impl set_flags_for_delete_unique_i_256 for super::SetReducerFlags { fn delete_unique_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_i256", flags); + self.imp.set_call_reducer_flags(20, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs index 15bb9189ce9..6cfe0d3f16e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_32_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_i_32 { impl delete_unique_i_32 for super::RemoteReducers { fn delete_unique_i_32(&self, n: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i32", DeleteUniqueI32 { n }) + self.imp.call_reducer(21, DeleteUniqueI32 { n }) } fn on_delete_unique_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> DeleteUniqueI32CallbackId { DeleteUniqueI32CallbackId(self.imp.on_reducer::( - "delete_unique_i32", + 21, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI32| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_i_32(&self, callback: DeleteUniqueI32CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i32", callback.0) + self.imp.remove_on_reducer::(21, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_i_32 { impl set_flags_for_delete_unique_i_32 for super::SetReducerFlags { fn delete_unique_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_i32", flags); + self.imp.set_call_reducer_flags(21, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs index 7f72627391e..9fd46b54887 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_64_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_i_64 { impl delete_unique_i_64 for super::RemoteReducers { fn delete_unique_i_64(&self, n: i64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i64", DeleteUniqueI64 { n }) + self.imp.call_reducer(22, DeleteUniqueI64 { n }) } fn on_delete_unique_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64) + Send + 'static, ) -> DeleteUniqueI64CallbackId { DeleteUniqueI64CallbackId(self.imp.on_reducer::( - "delete_unique_i64", + 22, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI64| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_i_64(&self, callback: DeleteUniqueI64CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i64", callback.0) + self.imp.remove_on_reducer::(22, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_i_64 { impl set_flags_for_delete_unique_i_64 for super::SetReducerFlags { fn delete_unique_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_i64", flags); + self.imp.set_call_reducer_flags(22, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs index 030be737cfa..2685c950088 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_i_8_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_i_8 { impl delete_unique_i_8 for super::RemoteReducers { fn delete_unique_i_8(&self, n: i8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_i8", DeleteUniqueI8 { n }) + self.imp.call_reducer(23, DeleteUniqueI8 { n }) } fn on_delete_unique_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8) + Send + 'static, ) -> DeleteUniqueI8CallbackId { DeleteUniqueI8CallbackId(self.imp.on_reducer::( - "delete_unique_i8", + 23, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueI8| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_i_8(&self, callback: DeleteUniqueI8CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_i8", callback.0) + self.imp.remove_on_reducer::(23, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_i_8 { impl set_flags_for_delete_unique_i_8 for super::SetReducerFlags { fn delete_unique_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_i8", flags); + self.imp.set_call_reducer_flags(23, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs index 19ce7967f93..529c780adb3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_identity_reducer.rs @@ -52,21 +52,19 @@ pub trait delete_unique_identity { impl delete_unique_identity for super::RemoteReducers { fn delete_unique_identity(&self, i: __sdk::Identity) -> __anyhow::Result<()> { - self.imp - .call_reducer("delete_unique_identity", DeleteUniqueIdentity { i }) + self.imp.call_reducer(24, DeleteUniqueIdentity { i }) } fn on_delete_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity) + Send + 'static, ) -> DeleteUniqueIdentityCallbackId { DeleteUniqueIdentityCallbackId(self.imp.on_reducer::( - "delete_unique_identity", + 24, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueIdentity| callback(ctx, &args.i)), )) } fn remove_on_delete_unique_identity(&self, callback: DeleteUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_identity", callback.0) + self.imp.remove_on_reducer::(24, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_delete_unique_identity { impl set_flags_for_delete_unique_identity for super::SetReducerFlags { fn delete_unique_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_identity", flags); + self.imp.set_call_reducer_flags(24, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs index 997aa914e58..16ab7922aa7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_string_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_string { impl delete_unique_string for super::RemoteReducers { fn delete_unique_string(&self, s: String) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_string", DeleteUniqueString { s }) + self.imp.call_reducer(25, DeleteUniqueString { s }) } fn on_delete_unique_string( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> DeleteUniqueStringCallbackId { DeleteUniqueStringCallbackId(self.imp.on_reducer::( - "delete_unique_string", + 25, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueString| callback(ctx, &args.s)), )) } fn remove_on_delete_unique_string(&self, callback: DeleteUniqueStringCallbackId) { - self.imp - .remove_on_reducer::("delete_unique_string", callback.0) + self.imp.remove_on_reducer::(25, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_string { impl set_flags_for_delete_unique_string for super::SetReducerFlags { fn delete_unique_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_string", flags); + self.imp.set_call_reducer_flags(25, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs index d4878402c7f..8ae47ece20f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_128_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_u_128 { impl delete_unique_u_128 for super::RemoteReducers { fn delete_unique_u_128(&self, n: u128) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u128", DeleteUniqueU128 { n }) + self.imp.call_reducer(26, DeleteUniqueU128 { n }) } fn on_delete_unique_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128) + Send + 'static, ) -> DeleteUniqueU128CallbackId { DeleteUniqueU128CallbackId(self.imp.on_reducer::( - "delete_unique_u128", + 26, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU128| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_u_128(&self, callback: DeleteUniqueU128CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u128", callback.0) + self.imp.remove_on_reducer::(26, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_u_128 { impl set_flags_for_delete_unique_u_128 for super::SetReducerFlags { fn delete_unique_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_u128", flags); + self.imp.set_call_reducer_flags(26, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs index 362ab6334da..d08f3120edb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_16_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_u_16 { impl delete_unique_u_16 for super::RemoteReducers { fn delete_unique_u_16(&self, n: u16) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u16", DeleteUniqueU16 { n }) + self.imp.call_reducer(27, DeleteUniqueU16 { n }) } fn on_delete_unique_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16) + Send + 'static, ) -> DeleteUniqueU16CallbackId { DeleteUniqueU16CallbackId(self.imp.on_reducer::( - "delete_unique_u16", + 27, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU16| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_u_16(&self, callback: DeleteUniqueU16CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u16", callback.0) + self.imp.remove_on_reducer::(27, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_u_16 { impl set_flags_for_delete_unique_u_16 for super::SetReducerFlags { fn delete_unique_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_u16", flags); + self.imp.set_call_reducer_flags(27, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs index 7be56298065..1d6517ab7ec 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_256_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_u_256 { impl delete_unique_u_256 for super::RemoteReducers { fn delete_unique_u_256(&self, n: __sats::u256) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u256", DeleteUniqueU256 { n }) + self.imp.call_reducer(28, DeleteUniqueU256 { n }) } fn on_delete_unique_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256) + Send + 'static, ) -> DeleteUniqueU256CallbackId { DeleteUniqueU256CallbackId(self.imp.on_reducer::( - "delete_unique_u256", + 28, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU256| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_u_256(&self, callback: DeleteUniqueU256CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u256", callback.0) + self.imp.remove_on_reducer::(28, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_u_256 { impl set_flags_for_delete_unique_u_256 for super::SetReducerFlags { fn delete_unique_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_u256", flags); + self.imp.set_call_reducer_flags(28, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs index 25a845bb27c..db744d79a17 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_32_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_u_32 { impl delete_unique_u_32 for super::RemoteReducers { fn delete_unique_u_32(&self, n: u32) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u32", DeleteUniqueU32 { n }) + self.imp.call_reducer(29, DeleteUniqueU32 { n }) } fn on_delete_unique_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32) + Send + 'static, ) -> DeleteUniqueU32CallbackId { DeleteUniqueU32CallbackId(self.imp.on_reducer::( - "delete_unique_u32", + 29, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU32| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_u_32(&self, callback: DeleteUniqueU32CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u32", callback.0) + self.imp.remove_on_reducer::(29, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_u_32 { impl set_flags_for_delete_unique_u_32 for super::SetReducerFlags { fn delete_unique_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_u32", flags); + self.imp.set_call_reducer_flags(29, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs index 51ef5443bb6..9dfba3c0e97 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_64_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_u_64 { impl delete_unique_u_64 for super::RemoteReducers { fn delete_unique_u_64(&self, n: u64) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u64", DeleteUniqueU64 { n }) + self.imp.call_reducer(30, DeleteUniqueU64 { n }) } fn on_delete_unique_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64) + Send + 'static, ) -> DeleteUniqueU64CallbackId { DeleteUniqueU64CallbackId(self.imp.on_reducer::( - "delete_unique_u64", + 30, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU64| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_u_64(&self, callback: DeleteUniqueU64CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u64", callback.0) + self.imp.remove_on_reducer::(30, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_u_64 { impl set_flags_for_delete_unique_u_64 for super::SetReducerFlags { fn delete_unique_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_u64", flags); + self.imp.set_call_reducer_flags(30, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs index 7673e5e1569..07a7b0791ff 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/delete_unique_u_8_reducer.rs @@ -52,20 +52,19 @@ pub trait delete_unique_u_8 { impl delete_unique_u_8 for super::RemoteReducers { fn delete_unique_u_8(&self, n: u8) -> __anyhow::Result<()> { - self.imp.call_reducer("delete_unique_u8", DeleteUniqueU8 { n }) + self.imp.call_reducer(31, DeleteUniqueU8 { n }) } fn on_delete_unique_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8) + Send + 'static, ) -> DeleteUniqueU8CallbackId { DeleteUniqueU8CallbackId(self.imp.on_reducer::( - "delete_unique_u8", + 31, Box::new(move |ctx: &super::EventContext, args: &DeleteUniqueU8| callback(ctx, &args.n)), )) } fn remove_on_delete_unique_u_8(&self, callback: DeleteUniqueU8CallbackId) { - self.imp - .remove_on_reducer::("delete_unique_u8", callback.0) + self.imp.remove_on_reducer::(31, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_delete_unique_u_8 { impl set_flags_for_delete_unique_u_8 for super::SetReducerFlags { fn delete_unique_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("delete_unique_u8", flags); + self.imp.set_call_reducer_flags(31, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs index a3f0cda63bd..d53f2765077 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_address_reducer.rs @@ -50,21 +50,19 @@ pub trait insert_caller_one_address { impl insert_caller_one_address for super::RemoteReducers { fn insert_caller_one_address(&self) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_one_address", InsertCallerOneAddress {}) + self.imp.call_reducer(32, InsertCallerOneAddress {}) } fn on_insert_caller_one_address( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerOneAddressCallbackId { InsertCallerOneAddressCallbackId(self.imp.on_reducer::( - "insert_caller_one_address", + 32, Box::new(move |ctx: &super::EventContext, args: &InsertCallerOneAddress| callback(ctx)), )) } fn remove_on_insert_caller_one_address(&self, callback: InsertCallerOneAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_one_address", callback.0) + self.imp.remove_on_reducer::(32, callback.0) } } @@ -84,6 +82,6 @@ pub trait set_flags_for_insert_caller_one_address { impl set_flags_for_insert_caller_one_address for super::SetReducerFlags { fn insert_caller_one_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_one_address", flags); + self.imp.set_call_reducer_flags(32, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs index 7a518a6d7fc..1babb4dec40 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_one_identity_reducer.rs @@ -50,21 +50,19 @@ pub trait insert_caller_one_identity { impl insert_caller_one_identity for super::RemoteReducers { fn insert_caller_one_identity(&self) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_one_identity", InsertCallerOneIdentity {}) + self.imp.call_reducer(33, InsertCallerOneIdentity {}) } fn on_insert_caller_one_identity( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerOneIdentityCallbackId { InsertCallerOneIdentityCallbackId(self.imp.on_reducer::( - "insert_caller_one_identity", + 33, Box::new(move |ctx: &super::EventContext, args: &InsertCallerOneIdentity| callback(ctx)), )) } fn remove_on_insert_caller_one_identity(&self, callback: InsertCallerOneIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_one_identity", callback.0) + self.imp.remove_on_reducer::(33, callback.0) } } @@ -84,6 +82,6 @@ pub trait set_flags_for_insert_caller_one_identity { impl set_flags_for_insert_caller_one_identity for super::SetReducerFlags { fn insert_caller_one_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_one_identity", flags); + self.imp.set_call_reducer_flags(33, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs index 14ba0ce94da..bbfc8a52fe0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_address_reducer.rs @@ -52,21 +52,19 @@ pub trait insert_caller_pk_address { impl insert_caller_pk_address for super::RemoteReducers { fn insert_caller_pk_address(&self, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_pk_address", InsertCallerPkAddress { data }) + self.imp.call_reducer(34, InsertCallerPkAddress { data }) } fn on_insert_caller_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerPkAddressCallbackId { InsertCallerPkAddressCallbackId(self.imp.on_reducer::( - "insert_caller_pk_address", + 34, Box::new(move |ctx: &super::EventContext, args: &InsertCallerPkAddress| callback(ctx, &args.data)), )) } fn remove_on_insert_caller_pk_address(&self, callback: InsertCallerPkAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_pk_address", callback.0) + self.imp.remove_on_reducer::(34, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_insert_caller_pk_address { impl set_flags_for_insert_caller_pk_address for super::SetReducerFlags { fn insert_caller_pk_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_pk_address", flags); + self.imp.set_call_reducer_flags(34, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs index 6cd10d4e3a1..80418c6532d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_pk_identity_reducer.rs @@ -52,21 +52,19 @@ pub trait insert_caller_pk_identity { impl insert_caller_pk_identity for super::RemoteReducers { fn insert_caller_pk_identity(&self, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_pk_identity", InsertCallerPkIdentity { data }) + self.imp.call_reducer(35, InsertCallerPkIdentity { data }) } fn on_insert_caller_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerPkIdentityCallbackId { InsertCallerPkIdentityCallbackId(self.imp.on_reducer::( - "insert_caller_pk_identity", + 35, Box::new(move |ctx: &super::EventContext, args: &InsertCallerPkIdentity| callback(ctx, &args.data)), )) } fn remove_on_insert_caller_pk_identity(&self, callback: InsertCallerPkIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_pk_identity", callback.0) + self.imp.remove_on_reducer::(35, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_insert_caller_pk_identity { impl set_flags_for_insert_caller_pk_identity for super::SetReducerFlags { fn insert_caller_pk_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_pk_identity", flags); + self.imp.set_call_reducer_flags(35, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs index 61f5f2bcdfb..4b0712e76eb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_address_reducer.rs @@ -52,21 +52,19 @@ pub trait insert_caller_unique_address { impl insert_caller_unique_address for super::RemoteReducers { fn insert_caller_unique_address(&self, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_unique_address", InsertCallerUniqueAddress { data }) + self.imp.call_reducer(36, InsertCallerUniqueAddress { data }) } fn on_insert_caller_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerUniqueAddressCallbackId { InsertCallerUniqueAddressCallbackId(self.imp.on_reducer::( - "insert_caller_unique_address", + 36, Box::new(move |ctx: &super::EventContext, args: &InsertCallerUniqueAddress| callback(ctx, &args.data)), )) } fn remove_on_insert_caller_unique_address(&self, callback: InsertCallerUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_unique_address", callback.0) + self.imp.remove_on_reducer::(36, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_insert_caller_unique_address { impl set_flags_for_insert_caller_unique_address for super::SetReducerFlags { fn insert_caller_unique_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_unique_address", flags); + self.imp.set_call_reducer_flags(36, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs index 98fae641f9a..2c1d9eb8d68 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_unique_identity_reducer.rs @@ -52,21 +52,19 @@ pub trait insert_caller_unique_identity { impl insert_caller_unique_identity for super::RemoteReducers { fn insert_caller_unique_identity(&self, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_unique_identity", InsertCallerUniqueIdentity { data }) + self.imp.call_reducer(37, InsertCallerUniqueIdentity { data }) } fn on_insert_caller_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertCallerUniqueIdentityCallbackId { InsertCallerUniqueIdentityCallbackId(self.imp.on_reducer::( - "insert_caller_unique_identity", + 37, Box::new(move |ctx: &super::EventContext, args: &InsertCallerUniqueIdentity| callback(ctx, &args.data)), )) } fn remove_on_insert_caller_unique_identity(&self, callback: InsertCallerUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_unique_identity", callback.0) + self.imp.remove_on_reducer::(37, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_insert_caller_unique_identity { impl set_flags_for_insert_caller_unique_identity for super::SetReducerFlags { fn insert_caller_unique_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_unique_identity", flags); + self.imp.set_call_reducer_flags(37, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs index c564d3dcd34..feaf51c2eb3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_address_reducer.rs @@ -50,21 +50,19 @@ pub trait insert_caller_vec_address { impl insert_caller_vec_address for super::RemoteReducers { fn insert_caller_vec_address(&self) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_vec_address", InsertCallerVecAddress {}) + self.imp.call_reducer(38, InsertCallerVecAddress {}) } fn on_insert_caller_vec_address( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerVecAddressCallbackId { InsertCallerVecAddressCallbackId(self.imp.on_reducer::( - "insert_caller_vec_address", + 38, Box::new(move |ctx: &super::EventContext, args: &InsertCallerVecAddress| callback(ctx)), )) } fn remove_on_insert_caller_vec_address(&self, callback: InsertCallerVecAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_vec_address", callback.0) + self.imp.remove_on_reducer::(38, callback.0) } } @@ -84,6 +82,6 @@ pub trait set_flags_for_insert_caller_vec_address { impl set_flags_for_insert_caller_vec_address for super::SetReducerFlags { fn insert_caller_vec_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_vec_address", flags); + self.imp.set_call_reducer_flags(38, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs index a343cd78e1e..6a90f45166c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_caller_vec_identity_reducer.rs @@ -50,21 +50,19 @@ pub trait insert_caller_vec_identity { impl insert_caller_vec_identity for super::RemoteReducers { fn insert_caller_vec_identity(&self) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_caller_vec_identity", InsertCallerVecIdentity {}) + self.imp.call_reducer(39, InsertCallerVecIdentity {}) } fn on_insert_caller_vec_identity( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> InsertCallerVecIdentityCallbackId { InsertCallerVecIdentityCallbackId(self.imp.on_reducer::( - "insert_caller_vec_identity", + 39, Box::new(move |ctx: &super::EventContext, args: &InsertCallerVecIdentity| callback(ctx)), )) } fn remove_on_insert_caller_vec_identity(&self, callback: InsertCallerVecIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_caller_vec_identity", callback.0) + self.imp.remove_on_reducer::(39, callback.0) } } @@ -84,6 +82,6 @@ pub trait set_flags_for_insert_caller_vec_identity { impl set_flags_for_insert_caller_vec_identity for super::SetReducerFlags { fn insert_caller_vec_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_caller_vec_identity", flags); + self.imp.set_call_reducer_flags(39, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs index ed171b244ce..070437d667e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_large_table_reducer.rs @@ -154,7 +154,7 @@ impl insert_large_table for super::RemoteReducers { v: EveryVecStruct, ) -> __anyhow::Result<()> { self.imp.call_reducer( - "insert_large_table", + 40, InsertLargeTable { a, b, @@ -211,7 +211,7 @@ impl insert_large_table for super::RemoteReducers { + 'static, ) -> InsertLargeTableCallbackId { InsertLargeTableCallbackId(self.imp.on_reducer::( - "insert_large_table", + 40, Box::new(move |ctx: &super::EventContext, args: &InsertLargeTable| { callback( ctx, &args.a, &args.b, &args.c, &args.d, &args.e, &args.f, &args.g, &args.h, &args.i, &args.j, @@ -222,8 +222,7 @@ impl insert_large_table for super::RemoteReducers { )) } fn remove_on_insert_large_table(&self, callback: InsertLargeTableCallbackId) { - self.imp - .remove_on_reducer::("insert_large_table", callback.0) + self.imp.remove_on_reducer::(40, callback.0) } } @@ -243,6 +242,6 @@ pub trait set_flags_for_insert_large_table { impl set_flags_for_insert_large_table for super::SetReducerFlags { fn insert_large_table(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_large_table", flags); + self.imp.set_call_reducer_flags(40, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs index dae46ab9e7d..77c215d3053 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_address_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_address { impl insert_one_address for super::RemoteReducers { fn insert_one_address(&self, a: __sdk::Address) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_address", InsertOneAddress { a }) + self.imp.call_reducer(41, InsertOneAddress { a }) } fn on_insert_one_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address) + Send + 'static, ) -> InsertOneAddressCallbackId { InsertOneAddressCallbackId(self.imp.on_reducer::( - "insert_one_address", + 41, Box::new(move |ctx: &super::EventContext, args: &InsertOneAddress| callback(ctx, &args.a)), )) } fn remove_on_insert_one_address(&self, callback: InsertOneAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_one_address", callback.0) + self.imp.remove_on_reducer::(41, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_address { impl set_flags_for_insert_one_address for super::SetReducerFlags { fn insert_one_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_address", flags); + self.imp.set_call_reducer_flags(41, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs index e934f5b5162..4e2017a81c4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_bool_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_bool { impl insert_one_bool for super::RemoteReducers { fn insert_one_bool(&self, b: bool) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_bool", InsertOneBool { b }) + self.imp.call_reducer(42, InsertOneBool { b }) } fn on_insert_one_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool) + Send + 'static, ) -> InsertOneBoolCallbackId { InsertOneBoolCallbackId(self.imp.on_reducer::( - "insert_one_bool", + 42, Box::new(move |ctx: &super::EventContext, args: &InsertOneBool| callback(ctx, &args.b)), )) } fn remove_on_insert_one_bool(&self, callback: InsertOneBoolCallbackId) { - self.imp - .remove_on_reducer::("insert_one_bool", callback.0) + self.imp.remove_on_reducer::(42, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_bool { impl set_flags_for_insert_one_bool for super::SetReducerFlags { fn insert_one_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_bool", flags); + self.imp.set_call_reducer_flags(42, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs index fd56ecace5f..adda5478478 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_byte_struct_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_one_byte_struct { impl insert_one_byte_struct for super::RemoteReducers { fn insert_one_byte_struct(&self, s: ByteStruct) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_byte_struct", InsertOneByteStruct { s }) + self.imp.call_reducer(43, InsertOneByteStruct { s }) } fn on_insert_one_byte_struct( &self, mut callback: impl FnMut(&super::EventContext, &ByteStruct) + Send + 'static, ) -> InsertOneByteStructCallbackId { InsertOneByteStructCallbackId(self.imp.on_reducer::( - "insert_one_byte_struct", + 43, Box::new(move |ctx: &super::EventContext, args: &InsertOneByteStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_one_byte_struct(&self, callback: InsertOneByteStructCallbackId) { - self.imp - .remove_on_reducer::("insert_one_byte_struct", callback.0) + self.imp.remove_on_reducer::(43, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_one_byte_struct { impl set_flags_for_insert_one_byte_struct for super::SetReducerFlags { fn insert_one_byte_struct(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_byte_struct", flags); + self.imp.set_call_reducer_flags(43, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs index 16436743c93..57a24afb0e1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_enum_with_payload_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_one_enum_with_payload { impl insert_one_enum_with_payload for super::RemoteReducers { fn insert_one_enum_with_payload(&self, e: EnumWithPayload) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_enum_with_payload", InsertOneEnumWithPayload { e }) + self.imp.call_reducer(44, InsertOneEnumWithPayload { e }) } fn on_insert_one_enum_with_payload( &self, mut callback: impl FnMut(&super::EventContext, &EnumWithPayload) + Send + 'static, ) -> InsertOneEnumWithPayloadCallbackId { InsertOneEnumWithPayloadCallbackId(self.imp.on_reducer::( - "insert_one_enum_with_payload", + 44, Box::new(move |ctx: &super::EventContext, args: &InsertOneEnumWithPayload| callback(ctx, &args.e)), )) } fn remove_on_insert_one_enum_with_payload(&self, callback: InsertOneEnumWithPayloadCallbackId) { - self.imp - .remove_on_reducer::("insert_one_enum_with_payload", callback.0) + self.imp.remove_on_reducer::(44, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_one_enum_with_payload { impl set_flags_for_insert_one_enum_with_payload for super::SetReducerFlags { fn insert_one_enum_with_payload(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_enum_with_payload", flags); + self.imp.set_call_reducer_flags(44, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs index 32b97f36733..ca9ac68ddd2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_primitive_struct_reducer.rs @@ -54,21 +54,20 @@ pub trait insert_one_every_primitive_struct { impl insert_one_every_primitive_struct for super::RemoteReducers { fn insert_one_every_primitive_struct(&self, s: EveryPrimitiveStruct) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_every_primitive_struct", InsertOneEveryPrimitiveStruct { s }) + self.imp.call_reducer(45, InsertOneEveryPrimitiveStruct { s }) } fn on_insert_one_every_primitive_struct( &self, mut callback: impl FnMut(&super::EventContext, &EveryPrimitiveStruct) + Send + 'static, ) -> InsertOneEveryPrimitiveStructCallbackId { InsertOneEveryPrimitiveStructCallbackId(self.imp.on_reducer::( - "insert_one_every_primitive_struct", + 45, Box::new(move |ctx: &super::EventContext, args: &InsertOneEveryPrimitiveStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_one_every_primitive_struct(&self, callback: InsertOneEveryPrimitiveStructCallbackId) { self.imp - .remove_on_reducer::("insert_one_every_primitive_struct", callback.0) + .remove_on_reducer::(45, callback.0) } } @@ -88,7 +87,6 @@ pub trait set_flags_for_insert_one_every_primitive_struct { impl set_flags_for_insert_one_every_primitive_struct for super::SetReducerFlags { fn insert_one_every_primitive_struct(&self, flags: __ws::CallReducerFlags) { - self.imp - .set_call_reducer_flags("insert_one_every_primitive_struct", flags); + self.imp.set_call_reducer_flags(45, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs index 67bdda007d0..080c60f3b28 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_every_vec_struct_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_one_every_vec_struct { impl insert_one_every_vec_struct for super::RemoteReducers { fn insert_one_every_vec_struct(&self, s: EveryVecStruct) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_every_vec_struct", InsertOneEveryVecStruct { s }) + self.imp.call_reducer(46, InsertOneEveryVecStruct { s }) } fn on_insert_one_every_vec_struct( &self, mut callback: impl FnMut(&super::EventContext, &EveryVecStruct) + Send + 'static, ) -> InsertOneEveryVecStructCallbackId { InsertOneEveryVecStructCallbackId(self.imp.on_reducer::( - "insert_one_every_vec_struct", + 46, Box::new(move |ctx: &super::EventContext, args: &InsertOneEveryVecStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_one_every_vec_struct(&self, callback: InsertOneEveryVecStructCallbackId) { - self.imp - .remove_on_reducer::("insert_one_every_vec_struct", callback.0) + self.imp.remove_on_reducer::(46, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_one_every_vec_struct { impl set_flags_for_insert_one_every_vec_struct for super::SetReducerFlags { fn insert_one_every_vec_struct(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_every_vec_struct", flags); + self.imp.set_call_reducer_flags(46, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs index 693e9905bd4..38656770511 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_32_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_f_32 { impl insert_one_f_32 for super::RemoteReducers { fn insert_one_f_32(&self, f: f32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_f32", InsertOneF32 { f }) + self.imp.call_reducer(47, InsertOneF32 { f }) } fn on_insert_one_f_32( &self, mut callback: impl FnMut(&super::EventContext, &f32) + Send + 'static, ) -> InsertOneF32CallbackId { InsertOneF32CallbackId(self.imp.on_reducer::( - "insert_one_f32", + 47, Box::new(move |ctx: &super::EventContext, args: &InsertOneF32| callback(ctx, &args.f)), )) } fn remove_on_insert_one_f_32(&self, callback: InsertOneF32CallbackId) { - self.imp.remove_on_reducer::("insert_one_f32", callback.0) + self.imp.remove_on_reducer::(47, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_f_32 { impl set_flags_for_insert_one_f_32 for super::SetReducerFlags { fn insert_one_f_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_f32", flags); + self.imp.set_call_reducer_flags(47, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs index 40cfdc0a563..756a08da2d1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_f_64_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_f_64 { impl insert_one_f_64 for super::RemoteReducers { fn insert_one_f_64(&self, f: f64) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_f64", InsertOneF64 { f }) + self.imp.call_reducer(48, InsertOneF64 { f }) } fn on_insert_one_f_64( &self, mut callback: impl FnMut(&super::EventContext, &f64) + Send + 'static, ) -> InsertOneF64CallbackId { InsertOneF64CallbackId(self.imp.on_reducer::( - "insert_one_f64", + 48, Box::new(move |ctx: &super::EventContext, args: &InsertOneF64| callback(ctx, &args.f)), )) } fn remove_on_insert_one_f_64(&self, callback: InsertOneF64CallbackId) { - self.imp.remove_on_reducer::("insert_one_f64", callback.0) + self.imp.remove_on_reducer::(48, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_f_64 { impl set_flags_for_insert_one_f_64 for super::SetReducerFlags { fn insert_one_f_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_f64", flags); + self.imp.set_call_reducer_flags(48, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs index baf515e6ae3..bf707b1c5e0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_128_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_i_128 { impl insert_one_i_128 for super::RemoteReducers { fn insert_one_i_128(&self, n: i128) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i128", InsertOneI128 { n }) + self.imp.call_reducer(49, InsertOneI128 { n }) } fn on_insert_one_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128) + Send + 'static, ) -> InsertOneI128CallbackId { InsertOneI128CallbackId(self.imp.on_reducer::( - "insert_one_i128", + 49, Box::new(move |ctx: &super::EventContext, args: &InsertOneI128| callback(ctx, &args.n)), )) } fn remove_on_insert_one_i_128(&self, callback: InsertOneI128CallbackId) { - self.imp - .remove_on_reducer::("insert_one_i128", callback.0) + self.imp.remove_on_reducer::(49, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_i_128 { impl set_flags_for_insert_one_i_128 for super::SetReducerFlags { fn insert_one_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_i128", flags); + self.imp.set_call_reducer_flags(49, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs index e8deffd28bc..23fcf15bc66 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_16_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_i_16 { impl insert_one_i_16 for super::RemoteReducers { fn insert_one_i_16(&self, n: i16) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i16", InsertOneI16 { n }) + self.imp.call_reducer(50, InsertOneI16 { n }) } fn on_insert_one_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16) + Send + 'static, ) -> InsertOneI16CallbackId { InsertOneI16CallbackId(self.imp.on_reducer::( - "insert_one_i16", + 50, Box::new(move |ctx: &super::EventContext, args: &InsertOneI16| callback(ctx, &args.n)), )) } fn remove_on_insert_one_i_16(&self, callback: InsertOneI16CallbackId) { - self.imp.remove_on_reducer::("insert_one_i16", callback.0) + self.imp.remove_on_reducer::(50, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_i_16 { impl set_flags_for_insert_one_i_16 for super::SetReducerFlags { fn insert_one_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_i16", flags); + self.imp.set_call_reducer_flags(50, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs index 6195af58bae..9c58ce6f15d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_256_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_i_256 { impl insert_one_i_256 for super::RemoteReducers { fn insert_one_i_256(&self, n: __sats::i256) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i256", InsertOneI256 { n }) + self.imp.call_reducer(51, InsertOneI256 { n }) } fn on_insert_one_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256) + Send + 'static, ) -> InsertOneI256CallbackId { InsertOneI256CallbackId(self.imp.on_reducer::( - "insert_one_i256", + 51, Box::new(move |ctx: &super::EventContext, args: &InsertOneI256| callback(ctx, &args.n)), )) } fn remove_on_insert_one_i_256(&self, callback: InsertOneI256CallbackId) { - self.imp - .remove_on_reducer::("insert_one_i256", callback.0) + self.imp.remove_on_reducer::(51, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_i_256 { impl set_flags_for_insert_one_i_256 for super::SetReducerFlags { fn insert_one_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_i256", flags); + self.imp.set_call_reducer_flags(51, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs index 617a70112c2..0ef4a470f74 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_32_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_i_32 { impl insert_one_i_32 for super::RemoteReducers { fn insert_one_i_32(&self, n: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i32", InsertOneI32 { n }) + self.imp.call_reducer(52, InsertOneI32 { n }) } fn on_insert_one_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32) + Send + 'static, ) -> InsertOneI32CallbackId { InsertOneI32CallbackId(self.imp.on_reducer::( - "insert_one_i32", + 52, Box::new(move |ctx: &super::EventContext, args: &InsertOneI32| callback(ctx, &args.n)), )) } fn remove_on_insert_one_i_32(&self, callback: InsertOneI32CallbackId) { - self.imp.remove_on_reducer::("insert_one_i32", callback.0) + self.imp.remove_on_reducer::(52, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_i_32 { impl set_flags_for_insert_one_i_32 for super::SetReducerFlags { fn insert_one_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_i32", flags); + self.imp.set_call_reducer_flags(52, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs index 228d17b3e1e..ae8cf8570bb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_64_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_i_64 { impl insert_one_i_64 for super::RemoteReducers { fn insert_one_i_64(&self, n: i64) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i64", InsertOneI64 { n }) + self.imp.call_reducer(53, InsertOneI64 { n }) } fn on_insert_one_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64) + Send + 'static, ) -> InsertOneI64CallbackId { InsertOneI64CallbackId(self.imp.on_reducer::( - "insert_one_i64", + 53, Box::new(move |ctx: &super::EventContext, args: &InsertOneI64| callback(ctx, &args.n)), )) } fn remove_on_insert_one_i_64(&self, callback: InsertOneI64CallbackId) { - self.imp.remove_on_reducer::("insert_one_i64", callback.0) + self.imp.remove_on_reducer::(53, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_i_64 { impl set_flags_for_insert_one_i_64 for super::SetReducerFlags { fn insert_one_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_i64", flags); + self.imp.set_call_reducer_flags(53, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs index 520732e7907..d7a05437612 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_i_8_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_i_8 { impl insert_one_i_8 for super::RemoteReducers { fn insert_one_i_8(&self, n: i8) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_i8", InsertOneI8 { n }) + self.imp.call_reducer(54, InsertOneI8 { n }) } fn on_insert_one_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8) + Send + 'static, ) -> InsertOneI8CallbackId { InsertOneI8CallbackId(self.imp.on_reducer::( - "insert_one_i8", + 54, Box::new(move |ctx: &super::EventContext, args: &InsertOneI8| callback(ctx, &args.n)), )) } fn remove_on_insert_one_i_8(&self, callback: InsertOneI8CallbackId) { - self.imp.remove_on_reducer::("insert_one_i8", callback.0) + self.imp.remove_on_reducer::(54, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_i_8 { impl set_flags_for_insert_one_i_8 for super::SetReducerFlags { fn insert_one_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_i8", flags); + self.imp.set_call_reducer_flags(54, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs index 647f7e2bfa8..a89a2381e41 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_identity_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_identity { impl insert_one_identity for super::RemoteReducers { fn insert_one_identity(&self, i: __sdk::Identity) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_identity", InsertOneIdentity { i }) + self.imp.call_reducer(55, InsertOneIdentity { i }) } fn on_insert_one_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity) + Send + 'static, ) -> InsertOneIdentityCallbackId { InsertOneIdentityCallbackId(self.imp.on_reducer::( - "insert_one_identity", + 55, Box::new(move |ctx: &super::EventContext, args: &InsertOneIdentity| callback(ctx, &args.i)), )) } fn remove_on_insert_one_identity(&self, callback: InsertOneIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_one_identity", callback.0) + self.imp.remove_on_reducer::(55, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_identity { impl set_flags_for_insert_one_identity for super::SetReducerFlags { fn insert_one_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_identity", flags); + self.imp.set_call_reducer_flags(55, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs index 3ece98fb8e5..9975027f8c3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_simple_enum_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_one_simple_enum { impl insert_one_simple_enum for super::RemoteReducers { fn insert_one_simple_enum(&self, e: SimpleEnum) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_simple_enum", InsertOneSimpleEnum { e }) + self.imp.call_reducer(56, InsertOneSimpleEnum { e }) } fn on_insert_one_simple_enum( &self, mut callback: impl FnMut(&super::EventContext, &SimpleEnum) + Send + 'static, ) -> InsertOneSimpleEnumCallbackId { InsertOneSimpleEnumCallbackId(self.imp.on_reducer::( - "insert_one_simple_enum", + 56, Box::new(move |ctx: &super::EventContext, args: &InsertOneSimpleEnum| callback(ctx, &args.e)), )) } fn remove_on_insert_one_simple_enum(&self, callback: InsertOneSimpleEnumCallbackId) { - self.imp - .remove_on_reducer::("insert_one_simple_enum", callback.0) + self.imp.remove_on_reducer::(56, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_one_simple_enum { impl set_flags_for_insert_one_simple_enum for super::SetReducerFlags { fn insert_one_simple_enum(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_simple_enum", flags); + self.imp.set_call_reducer_flags(56, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs index 7606e406d28..f50d53b078d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_string_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_string { impl insert_one_string for super::RemoteReducers { fn insert_one_string(&self, s: String) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_string", InsertOneString { s }) + self.imp.call_reducer(57, InsertOneString { s }) } fn on_insert_one_string( &self, mut callback: impl FnMut(&super::EventContext, &String) + Send + 'static, ) -> InsertOneStringCallbackId { InsertOneStringCallbackId(self.imp.on_reducer::( - "insert_one_string", + 57, Box::new(move |ctx: &super::EventContext, args: &InsertOneString| callback(ctx, &args.s)), )) } fn remove_on_insert_one_string(&self, callback: InsertOneStringCallbackId) { - self.imp - .remove_on_reducer::("insert_one_string", callback.0) + self.imp.remove_on_reducer::(57, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_string { impl set_flags_for_insert_one_string for super::SetReducerFlags { fn insert_one_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_string", flags); + self.imp.set_call_reducer_flags(57, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs index d63f011747b..c370f8b443d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_128_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_u_128 { impl insert_one_u_128 for super::RemoteReducers { fn insert_one_u_128(&self, n: u128) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u128", InsertOneU128 { n }) + self.imp.call_reducer(58, InsertOneU128 { n }) } fn on_insert_one_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128) + Send + 'static, ) -> InsertOneU128CallbackId { InsertOneU128CallbackId(self.imp.on_reducer::( - "insert_one_u128", + 58, Box::new(move |ctx: &super::EventContext, args: &InsertOneU128| callback(ctx, &args.n)), )) } fn remove_on_insert_one_u_128(&self, callback: InsertOneU128CallbackId) { - self.imp - .remove_on_reducer::("insert_one_u128", callback.0) + self.imp.remove_on_reducer::(58, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_u_128 { impl set_flags_for_insert_one_u_128 for super::SetReducerFlags { fn insert_one_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_u128", flags); + self.imp.set_call_reducer_flags(58, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs index dd1155f2f47..05e0c25cc35 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_16_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_u_16 { impl insert_one_u_16 for super::RemoteReducers { fn insert_one_u_16(&self, n: u16) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u16", InsertOneU16 { n }) + self.imp.call_reducer(59, InsertOneU16 { n }) } fn on_insert_one_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16) + Send + 'static, ) -> InsertOneU16CallbackId { InsertOneU16CallbackId(self.imp.on_reducer::( - "insert_one_u16", + 59, Box::new(move |ctx: &super::EventContext, args: &InsertOneU16| callback(ctx, &args.n)), )) } fn remove_on_insert_one_u_16(&self, callback: InsertOneU16CallbackId) { - self.imp.remove_on_reducer::("insert_one_u16", callback.0) + self.imp.remove_on_reducer::(59, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_u_16 { impl set_flags_for_insert_one_u_16 for super::SetReducerFlags { fn insert_one_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_u16", flags); + self.imp.set_call_reducer_flags(59, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs index 98c8c244247..c9dd56090af 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_256_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_one_u_256 { impl insert_one_u_256 for super::RemoteReducers { fn insert_one_u_256(&self, n: __sats::u256) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u256", InsertOneU256 { n }) + self.imp.call_reducer(60, InsertOneU256 { n }) } fn on_insert_one_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256) + Send + 'static, ) -> InsertOneU256CallbackId { InsertOneU256CallbackId(self.imp.on_reducer::( - "insert_one_u256", + 60, Box::new(move |ctx: &super::EventContext, args: &InsertOneU256| callback(ctx, &args.n)), )) } fn remove_on_insert_one_u_256(&self, callback: InsertOneU256CallbackId) { - self.imp - .remove_on_reducer::("insert_one_u256", callback.0) + self.imp.remove_on_reducer::(60, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_one_u_256 { impl set_flags_for_insert_one_u_256 for super::SetReducerFlags { fn insert_one_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_u256", flags); + self.imp.set_call_reducer_flags(60, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs index 3196c11caa4..ef3c104bfb3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_32_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_u_32 { impl insert_one_u_32 for super::RemoteReducers { fn insert_one_u_32(&self, n: u32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u32", InsertOneU32 { n }) + self.imp.call_reducer(61, InsertOneU32 { n }) } fn on_insert_one_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32) + Send + 'static, ) -> InsertOneU32CallbackId { InsertOneU32CallbackId(self.imp.on_reducer::( - "insert_one_u32", + 61, Box::new(move |ctx: &super::EventContext, args: &InsertOneU32| callback(ctx, &args.n)), )) } fn remove_on_insert_one_u_32(&self, callback: InsertOneU32CallbackId) { - self.imp.remove_on_reducer::("insert_one_u32", callback.0) + self.imp.remove_on_reducer::(61, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_u_32 { impl set_flags_for_insert_one_u_32 for super::SetReducerFlags { fn insert_one_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_u32", flags); + self.imp.set_call_reducer_flags(61, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs index 1d213658af7..3c3f56b51fa 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_64_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_u_64 { impl insert_one_u_64 for super::RemoteReducers { fn insert_one_u_64(&self, n: u64) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u64", InsertOneU64 { n }) + self.imp.call_reducer(62, InsertOneU64 { n }) } fn on_insert_one_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64) + Send + 'static, ) -> InsertOneU64CallbackId { InsertOneU64CallbackId(self.imp.on_reducer::( - "insert_one_u64", + 62, Box::new(move |ctx: &super::EventContext, args: &InsertOneU64| callback(ctx, &args.n)), )) } fn remove_on_insert_one_u_64(&self, callback: InsertOneU64CallbackId) { - self.imp.remove_on_reducer::("insert_one_u64", callback.0) + self.imp.remove_on_reducer::(62, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_u_64 { impl set_flags_for_insert_one_u_64 for super::SetReducerFlags { fn insert_one_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_u64", flags); + self.imp.set_call_reducer_flags(62, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs index 3d3d14f7e9f..7c39a54e673 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_u_8_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_one_u_8 { impl insert_one_u_8 for super::RemoteReducers { fn insert_one_u_8(&self, n: u8) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_one_u8", InsertOneU8 { n }) + self.imp.call_reducer(63, InsertOneU8 { n }) } fn on_insert_one_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8) + Send + 'static, ) -> InsertOneU8CallbackId { InsertOneU8CallbackId(self.imp.on_reducer::( - "insert_one_u8", + 63, Box::new(move |ctx: &super::EventContext, args: &InsertOneU8| callback(ctx, &args.n)), )) } fn remove_on_insert_one_u_8(&self, callback: InsertOneU8CallbackId) { - self.imp.remove_on_reducer::("insert_one_u8", callback.0) + self.imp.remove_on_reducer::(63, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_one_u_8 { impl set_flags_for_insert_one_u_8 for super::SetReducerFlags { fn insert_one_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_u8", flags); + self.imp.set_call_reducer_flags(63, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs index d806945cfe6..6a25b85776b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_one_unit_struct_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_one_unit_struct { impl insert_one_unit_struct for super::RemoteReducers { fn insert_one_unit_struct(&self, s: UnitStruct) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_one_unit_struct", InsertOneUnitStruct { s }) + self.imp.call_reducer(64, InsertOneUnitStruct { s }) } fn on_insert_one_unit_struct( &self, mut callback: impl FnMut(&super::EventContext, &UnitStruct) + Send + 'static, ) -> InsertOneUnitStructCallbackId { InsertOneUnitStructCallbackId(self.imp.on_reducer::( - "insert_one_unit_struct", + 64, Box::new(move |ctx: &super::EventContext, args: &InsertOneUnitStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_one_unit_struct(&self, callback: InsertOneUnitStructCallbackId) { - self.imp - .remove_on_reducer::("insert_one_unit_struct", callback.0) + self.imp.remove_on_reducer::(64, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_one_unit_struct { impl set_flags_for_insert_one_unit_struct for super::SetReducerFlags { fn insert_one_unit_struct(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_one_unit_struct", flags); + self.imp.set_call_reducer_flags(64, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs index 2469942acab..b4e9e5ca72f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_every_primitive_struct_reducer.rs @@ -54,23 +54,20 @@ pub trait insert_option_every_primitive_struct { impl insert_option_every_primitive_struct for super::RemoteReducers { fn insert_option_every_primitive_struct(&self, s: Option) -> __anyhow::Result<()> { - self.imp.call_reducer( - "insert_option_every_primitive_struct", - InsertOptionEveryPrimitiveStruct { s }, - ) + self.imp.call_reducer(65, InsertOptionEveryPrimitiveStruct { s }) } fn on_insert_option_every_primitive_struct( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionEveryPrimitiveStructCallbackId { InsertOptionEveryPrimitiveStructCallbackId(self.imp.on_reducer::( - "insert_option_every_primitive_struct", + 65, Box::new(move |ctx: &super::EventContext, args: &InsertOptionEveryPrimitiveStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_option_every_primitive_struct(&self, callback: InsertOptionEveryPrimitiveStructCallbackId) { self.imp - .remove_on_reducer::("insert_option_every_primitive_struct", callback.0) + .remove_on_reducer::(65, callback.0) } } @@ -90,7 +87,6 @@ pub trait set_flags_for_insert_option_every_primitive_struct { impl set_flags_for_insert_option_every_primitive_struct for super::SetReducerFlags { fn insert_option_every_primitive_struct(&self, flags: __ws::CallReducerFlags) { - self.imp - .set_call_reducer_flags("insert_option_every_primitive_struct", flags); + self.imp.set_call_reducer_flags(65, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs index 1645099c4bc..6d17ae4af0b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_i_32_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_option_i_32 { impl insert_option_i_32 for super::RemoteReducers { fn insert_option_i_32(&self, n: Option) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_option_i32", InsertOptionI32 { n }) + self.imp.call_reducer(66, InsertOptionI32 { n }) } fn on_insert_option_i_32( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionI32CallbackId { InsertOptionI32CallbackId(self.imp.on_reducer::( - "insert_option_i32", + 66, Box::new(move |ctx: &super::EventContext, args: &InsertOptionI32| callback(ctx, &args.n)), )) } fn remove_on_insert_option_i_32(&self, callback: InsertOptionI32CallbackId) { - self.imp - .remove_on_reducer::("insert_option_i32", callback.0) + self.imp.remove_on_reducer::(66, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_option_i_32 { impl set_flags_for_insert_option_i_32 for super::SetReducerFlags { fn insert_option_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_option_i32", flags); + self.imp.set_call_reducer_flags(66, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs index b6a8094ac7b..a6b04fecb2d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_identity_reducer.rs @@ -52,21 +52,19 @@ pub trait insert_option_identity { impl insert_option_identity for super::RemoteReducers { fn insert_option_identity(&self, i: Option<__sdk::Identity>) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_option_identity", InsertOptionIdentity { i }) + self.imp.call_reducer(67, InsertOptionIdentity { i }) } fn on_insert_option_identity( &self, mut callback: impl FnMut(&super::EventContext, &Option<__sdk::Identity>) + Send + 'static, ) -> InsertOptionIdentityCallbackId { InsertOptionIdentityCallbackId(self.imp.on_reducer::( - "insert_option_identity", + 67, Box::new(move |ctx: &super::EventContext, args: &InsertOptionIdentity| callback(ctx, &args.i)), )) } fn remove_on_insert_option_identity(&self, callback: InsertOptionIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_option_identity", callback.0) + self.imp.remove_on_reducer::(67, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_insert_option_identity { impl set_flags_for_insert_option_identity for super::SetReducerFlags { fn insert_option_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_option_identity", flags); + self.imp.set_call_reducer_flags(67, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs index bd3bddfc289..ed6a1dd2608 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_simple_enum_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_option_simple_enum { impl insert_option_simple_enum for super::RemoteReducers { fn insert_option_simple_enum(&self, e: Option) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_option_simple_enum", InsertOptionSimpleEnum { e }) + self.imp.call_reducer(68, InsertOptionSimpleEnum { e }) } fn on_insert_option_simple_enum( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionSimpleEnumCallbackId { InsertOptionSimpleEnumCallbackId(self.imp.on_reducer::( - "insert_option_simple_enum", + 68, Box::new(move |ctx: &super::EventContext, args: &InsertOptionSimpleEnum| callback(ctx, &args.e)), )) } fn remove_on_insert_option_simple_enum(&self, callback: InsertOptionSimpleEnumCallbackId) { - self.imp - .remove_on_reducer::("insert_option_simple_enum", callback.0) + self.imp.remove_on_reducer::(68, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_option_simple_enum { impl set_flags_for_insert_option_simple_enum for super::SetReducerFlags { fn insert_option_simple_enum(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_option_simple_enum", flags); + self.imp.set_call_reducer_flags(68, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs index 62df5fc9637..68f21d49467 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_string_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_option_string { impl insert_option_string for super::RemoteReducers { fn insert_option_string(&self, s: Option) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_option_string", InsertOptionString { s }) + self.imp.call_reducer(69, InsertOptionString { s }) } fn on_insert_option_string( &self, mut callback: impl FnMut(&super::EventContext, &Option) + Send + 'static, ) -> InsertOptionStringCallbackId { InsertOptionStringCallbackId(self.imp.on_reducer::( - "insert_option_string", + 69, Box::new(move |ctx: &super::EventContext, args: &InsertOptionString| callback(ctx, &args.s)), )) } fn remove_on_insert_option_string(&self, callback: InsertOptionStringCallbackId) { - self.imp - .remove_on_reducer::("insert_option_string", callback.0) + self.imp.remove_on_reducer::(69, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_option_string { impl set_flags_for_insert_option_string for super::SetReducerFlags { fn insert_option_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_option_string", flags); + self.imp.set_call_reducer_flags(69, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs index a427a6036cc..1c759faf57f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_option_vec_option_i_32_reducer.rs @@ -52,21 +52,19 @@ pub trait insert_option_vec_option_i_32 { impl insert_option_vec_option_i_32 for super::RemoteReducers { fn insert_option_vec_option_i_32(&self, v: Option>>) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_option_vec_option_i32", InsertOptionVecOptionI32 { v }) + self.imp.call_reducer(70, InsertOptionVecOptionI32 { v }) } fn on_insert_option_vec_option_i_32( &self, mut callback: impl FnMut(&super::EventContext, &Option>>) + Send + 'static, ) -> InsertOptionVecOptionI32CallbackId { InsertOptionVecOptionI32CallbackId(self.imp.on_reducer::( - "insert_option_vec_option_i32", + 70, Box::new(move |ctx: &super::EventContext, args: &InsertOptionVecOptionI32| callback(ctx, &args.v)), )) } fn remove_on_insert_option_vec_option_i_32(&self, callback: InsertOptionVecOptionI32CallbackId) { - self.imp - .remove_on_reducer::("insert_option_vec_option_i32", callback.0) + self.imp.remove_on_reducer::(70, callback.0) } } @@ -86,6 +84,6 @@ pub trait set_flags_for_insert_option_vec_option_i_32 { impl set_flags_for_insert_option_vec_option_i_32 for super::SetReducerFlags { fn insert_option_vec_option_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_option_vec_option_i32", flags); + self.imp.set_call_reducer_flags(70, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs index f5aba467538..dbc125f8560 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_address_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_pk_address { impl insert_pk_address for super::RemoteReducers { fn insert_pk_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_address", InsertPkAddress { a, data }) + self.imp.call_reducer(71, InsertPkAddress { a, data }) } fn on_insert_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> InsertPkAddressCallbackId { InsertPkAddressCallbackId(self.imp.on_reducer::( - "insert_pk_address", + 71, Box::new(move |ctx: &super::EventContext, args: &InsertPkAddress| callback(ctx, &args.a, &args.data)), )) } fn remove_on_insert_pk_address(&self, callback: InsertPkAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_pk_address", callback.0) + self.imp.remove_on_reducer::(71, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_pk_address { impl set_flags_for_insert_pk_address for super::SetReducerFlags { fn insert_pk_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_address", flags); + self.imp.set_call_reducer_flags(71, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs index 57f45f08f6d..a703c44789d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_bool_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_bool { impl insert_pk_bool for super::RemoteReducers { fn insert_pk_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_bool", InsertPkBool { b, data }) + self.imp.call_reducer(72, InsertPkBool { b, data }) } fn on_insert_pk_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> InsertPkBoolCallbackId { InsertPkBoolCallbackId(self.imp.on_reducer::( - "insert_pk_bool", + 72, Box::new(move |ctx: &super::EventContext, args: &InsertPkBool| callback(ctx, &args.b, &args.data)), )) } fn remove_on_insert_pk_bool(&self, callback: InsertPkBoolCallbackId) { - self.imp.remove_on_reducer::("insert_pk_bool", callback.0) + self.imp.remove_on_reducer::(72, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_bool { impl set_flags_for_insert_pk_bool for super::SetReducerFlags { fn insert_pk_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_bool", flags); + self.imp.set_call_reducer_flags(72, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs index c759048ebf6..152dd2ce5ca 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_128_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_i_128 { impl insert_pk_i_128 for super::RemoteReducers { fn insert_pk_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i128", InsertPkI128 { n, data }) + self.imp.call_reducer(73, InsertPkI128 { n, data }) } fn on_insert_pk_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> InsertPkI128CallbackId { InsertPkI128CallbackId(self.imp.on_reducer::( - "insert_pk_i128", + 73, Box::new(move |ctx: &super::EventContext, args: &InsertPkI128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_i_128(&self, callback: InsertPkI128CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i128", callback.0) + self.imp.remove_on_reducer::(73, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_i_128 { impl set_flags_for_insert_pk_i_128 for super::SetReducerFlags { fn insert_pk_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_i128", flags); + self.imp.set_call_reducer_flags(73, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs index eeb2555c2c9..fab2fb10b4f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_16_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_i_16 { impl insert_pk_i_16 for super::RemoteReducers { fn insert_pk_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i16", InsertPkI16 { n, data }) + self.imp.call_reducer(74, InsertPkI16 { n, data }) } fn on_insert_pk_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> InsertPkI16CallbackId { InsertPkI16CallbackId(self.imp.on_reducer::( - "insert_pk_i16", + 74, Box::new(move |ctx: &super::EventContext, args: &InsertPkI16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_i_16(&self, callback: InsertPkI16CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i16", callback.0) + self.imp.remove_on_reducer::(74, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_i_16 { impl set_flags_for_insert_pk_i_16 for super::SetReducerFlags { fn insert_pk_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_i16", flags); + self.imp.set_call_reducer_flags(74, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs index abc52651fac..e0ef62e0daa 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_256_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_i_256 { impl insert_pk_i_256 for super::RemoteReducers { fn insert_pk_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i256", InsertPkI256 { n, data }) + self.imp.call_reducer(75, InsertPkI256 { n, data }) } fn on_insert_pk_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> InsertPkI256CallbackId { InsertPkI256CallbackId(self.imp.on_reducer::( - "insert_pk_i256", + 75, Box::new(move |ctx: &super::EventContext, args: &InsertPkI256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_i_256(&self, callback: InsertPkI256CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i256", callback.0) + self.imp.remove_on_reducer::(75, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_i_256 { impl set_flags_for_insert_pk_i_256 for super::SetReducerFlags { fn insert_pk_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_i256", flags); + self.imp.set_call_reducer_flags(75, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs index d2ab5dc024d..d32d8473e7c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_32_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_i_32 { impl insert_pk_i_32 for super::RemoteReducers { fn insert_pk_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i32", InsertPkI32 { n, data }) + self.imp.call_reducer(76, InsertPkI32 { n, data }) } fn on_insert_pk_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> InsertPkI32CallbackId { InsertPkI32CallbackId(self.imp.on_reducer::( - "insert_pk_i32", + 76, Box::new(move |ctx: &super::EventContext, args: &InsertPkI32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_i_32(&self, callback: InsertPkI32CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i32", callback.0) + self.imp.remove_on_reducer::(76, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_i_32 { impl set_flags_for_insert_pk_i_32 for super::SetReducerFlags { fn insert_pk_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_i32", flags); + self.imp.set_call_reducer_flags(76, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs index 3858e6fd81f..64447587597 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_64_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_i_64 { impl insert_pk_i_64 for super::RemoteReducers { fn insert_pk_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i64", InsertPkI64 { n, data }) + self.imp.call_reducer(77, InsertPkI64 { n, data }) } fn on_insert_pk_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> InsertPkI64CallbackId { InsertPkI64CallbackId(self.imp.on_reducer::( - "insert_pk_i64", + 77, Box::new(move |ctx: &super::EventContext, args: &InsertPkI64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_i_64(&self, callback: InsertPkI64CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i64", callback.0) + self.imp.remove_on_reducer::(77, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_i_64 { impl set_flags_for_insert_pk_i_64 for super::SetReducerFlags { fn insert_pk_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_i64", flags); + self.imp.set_call_reducer_flags(77, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs index 492a45487c7..c944657dc5b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_i_8_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_i_8 { impl insert_pk_i_8 for super::RemoteReducers { fn insert_pk_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_i8", InsertPkI8 { n, data }) + self.imp.call_reducer(78, InsertPkI8 { n, data }) } fn on_insert_pk_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> InsertPkI8CallbackId { InsertPkI8CallbackId(self.imp.on_reducer::( - "insert_pk_i8", + 78, Box::new(move |ctx: &super::EventContext, args: &InsertPkI8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_i_8(&self, callback: InsertPkI8CallbackId) { - self.imp.remove_on_reducer::("insert_pk_i8", callback.0) + self.imp.remove_on_reducer::(78, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_i_8 { impl set_flags_for_insert_pk_i_8 for super::SetReducerFlags { fn insert_pk_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_i8", flags); + self.imp.set_call_reducer_flags(78, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs index 045b52060b4..618a72f74ef 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_identity_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_pk_identity { impl insert_pk_identity for super::RemoteReducers { fn insert_pk_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_pk_identity", InsertPkIdentity { i, data }) + self.imp.call_reducer(79, InsertPkIdentity { i, data }) } fn on_insert_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> InsertPkIdentityCallbackId { InsertPkIdentityCallbackId(self.imp.on_reducer::( - "insert_pk_identity", + 79, Box::new(move |ctx: &super::EventContext, args: &InsertPkIdentity| callback(ctx, &args.i, &args.data)), )) } fn remove_on_insert_pk_identity(&self, callback: InsertPkIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_pk_identity", callback.0) + self.imp.remove_on_reducer::(79, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_pk_identity { impl set_flags_for_insert_pk_identity for super::SetReducerFlags { fn insert_pk_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_identity", flags); + self.imp.set_call_reducer_flags(79, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs index 930917a9f42..162f88efaa6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_string_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_pk_string { impl insert_pk_string for super::RemoteReducers { fn insert_pk_string(&self, s: String, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_string", InsertPkString { s, data }) + self.imp.call_reducer(80, InsertPkString { s, data }) } fn on_insert_pk_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> InsertPkStringCallbackId { InsertPkStringCallbackId(self.imp.on_reducer::( - "insert_pk_string", + 80, Box::new(move |ctx: &super::EventContext, args: &InsertPkString| callback(ctx, &args.s, &args.data)), )) } fn remove_on_insert_pk_string(&self, callback: InsertPkStringCallbackId) { - self.imp - .remove_on_reducer::("insert_pk_string", callback.0) + self.imp.remove_on_reducer::(80, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_pk_string { impl set_flags_for_insert_pk_string for super::SetReducerFlags { fn insert_pk_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_string", flags); + self.imp.set_call_reducer_flags(80, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs index f66528a632c..e8feb97c892 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_128_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_u_128 { impl insert_pk_u_128 for super::RemoteReducers { fn insert_pk_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u128", InsertPkU128 { n, data }) + self.imp.call_reducer(81, InsertPkU128 { n, data }) } fn on_insert_pk_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> InsertPkU128CallbackId { InsertPkU128CallbackId(self.imp.on_reducer::( - "insert_pk_u128", + 81, Box::new(move |ctx: &super::EventContext, args: &InsertPkU128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_u_128(&self, callback: InsertPkU128CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u128", callback.0) + self.imp.remove_on_reducer::(81, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_u_128 { impl set_flags_for_insert_pk_u_128 for super::SetReducerFlags { fn insert_pk_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_u128", flags); + self.imp.set_call_reducer_flags(81, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs index 523a26e4e69..1688a57f11d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_16_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_u_16 { impl insert_pk_u_16 for super::RemoteReducers { fn insert_pk_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u16", InsertPkU16 { n, data }) + self.imp.call_reducer(82, InsertPkU16 { n, data }) } fn on_insert_pk_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> InsertPkU16CallbackId { InsertPkU16CallbackId(self.imp.on_reducer::( - "insert_pk_u16", + 82, Box::new(move |ctx: &super::EventContext, args: &InsertPkU16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_u_16(&self, callback: InsertPkU16CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u16", callback.0) + self.imp.remove_on_reducer::(82, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_u_16 { impl set_flags_for_insert_pk_u_16 for super::SetReducerFlags { fn insert_pk_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_u16", flags); + self.imp.set_call_reducer_flags(82, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs index 8be24c42cf8..deb07a02973 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_256_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_u_256 { impl insert_pk_u_256 for super::RemoteReducers { fn insert_pk_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u256", InsertPkU256 { n, data }) + self.imp.call_reducer(83, InsertPkU256 { n, data }) } fn on_insert_pk_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> InsertPkU256CallbackId { InsertPkU256CallbackId(self.imp.on_reducer::( - "insert_pk_u256", + 83, Box::new(move |ctx: &super::EventContext, args: &InsertPkU256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_u_256(&self, callback: InsertPkU256CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u256", callback.0) + self.imp.remove_on_reducer::(83, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_u_256 { impl set_flags_for_insert_pk_u_256 for super::SetReducerFlags { fn insert_pk_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_u256", flags); + self.imp.set_call_reducer_flags(83, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs index d64e320bded..4563b05c876 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_32_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_u_32 { impl insert_pk_u_32 for super::RemoteReducers { fn insert_pk_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u32", InsertPkU32 { n, data }) + self.imp.call_reducer(84, InsertPkU32 { n, data }) } fn on_insert_pk_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> InsertPkU32CallbackId { InsertPkU32CallbackId(self.imp.on_reducer::( - "insert_pk_u32", + 84, Box::new(move |ctx: &super::EventContext, args: &InsertPkU32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_u_32(&self, callback: InsertPkU32CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u32", callback.0) + self.imp.remove_on_reducer::(84, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_u_32 { impl set_flags_for_insert_pk_u_32 for super::SetReducerFlags { fn insert_pk_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_u32", flags); + self.imp.set_call_reducer_flags(84, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs index 1d58f1a5a24..f10cd55296e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_64_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_u_64 { impl insert_pk_u_64 for super::RemoteReducers { fn insert_pk_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u64", InsertPkU64 { n, data }) + self.imp.call_reducer(85, InsertPkU64 { n, data }) } fn on_insert_pk_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> InsertPkU64CallbackId { InsertPkU64CallbackId(self.imp.on_reducer::( - "insert_pk_u64", + 85, Box::new(move |ctx: &super::EventContext, args: &InsertPkU64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_u_64(&self, callback: InsertPkU64CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u64", callback.0) + self.imp.remove_on_reducer::(85, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_u_64 { impl set_flags_for_insert_pk_u_64 for super::SetReducerFlags { fn insert_pk_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_u64", flags); + self.imp.set_call_reducer_flags(85, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs index 26a320bac70..20f8ce1e777 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_pk_u_8_reducer.rs @@ -53,19 +53,19 @@ pub trait insert_pk_u_8 { impl insert_pk_u_8 for super::RemoteReducers { fn insert_pk_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_pk_u8", InsertPkU8 { n, data }) + self.imp.call_reducer(86, InsertPkU8 { n, data }) } fn on_insert_pk_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> InsertPkU8CallbackId { InsertPkU8CallbackId(self.imp.on_reducer::( - "insert_pk_u8", + 86, Box::new(move |ctx: &super::EventContext, args: &InsertPkU8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_pk_u_8(&self, callback: InsertPkU8CallbackId) { - self.imp.remove_on_reducer::("insert_pk_u8", callback.0) + self.imp.remove_on_reducer::(86, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_insert_pk_u_8 { impl set_flags_for_insert_pk_u_8 for super::SetReducerFlags { fn insert_pk_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_pk_u8", flags); + self.imp.set_call_reducer_flags(86, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs index 3538a93a302..cde92297749 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_primitives_as_strings_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_primitives_as_strings { impl insert_primitives_as_strings for super::RemoteReducers { fn insert_primitives_as_strings(&self, s: EveryPrimitiveStruct) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_primitives_as_strings", InsertPrimitivesAsStrings { s }) + self.imp.call_reducer(87, InsertPrimitivesAsStrings { s }) } fn on_insert_primitives_as_strings( &self, mut callback: impl FnMut(&super::EventContext, &EveryPrimitiveStruct) + Send + 'static, ) -> InsertPrimitivesAsStringsCallbackId { InsertPrimitivesAsStringsCallbackId(self.imp.on_reducer::( - "insert_primitives_as_strings", + 87, Box::new(move |ctx: &super::EventContext, args: &InsertPrimitivesAsStrings| callback(ctx, &args.s)), )) } fn remove_on_insert_primitives_as_strings(&self, callback: InsertPrimitivesAsStringsCallbackId) { - self.imp - .remove_on_reducer::("insert_primitives_as_strings", callback.0) + self.imp.remove_on_reducer::(87, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_primitives_as_strings { impl set_flags_for_insert_primitives_as_strings for super::SetReducerFlags { fn insert_primitives_as_strings(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_primitives_as_strings", flags); + self.imp.set_call_reducer_flags(87, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs index 57e61923ae2..6d55c450ffe 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_table_holds_table_reducer.rs @@ -56,21 +56,19 @@ pub trait insert_table_holds_table { impl insert_table_holds_table for super::RemoteReducers { fn insert_table_holds_table(&self, a: OneU8, b: VecU8) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_table_holds_table", InsertTableHoldsTable { a, b }) + self.imp.call_reducer(88, InsertTableHoldsTable { a, b }) } fn on_insert_table_holds_table( &self, mut callback: impl FnMut(&super::EventContext, &OneU8, &VecU8) + Send + 'static, ) -> InsertTableHoldsTableCallbackId { InsertTableHoldsTableCallbackId(self.imp.on_reducer::( - "insert_table_holds_table", + 88, Box::new(move |ctx: &super::EventContext, args: &InsertTableHoldsTable| callback(ctx, &args.a, &args.b)), )) } fn remove_on_insert_table_holds_table(&self, callback: InsertTableHoldsTableCallbackId) { - self.imp - .remove_on_reducer::("insert_table_holds_table", callback.0) + self.imp.remove_on_reducer::(88, callback.0) } } @@ -90,6 +88,6 @@ pub trait set_flags_for_insert_table_holds_table { impl set_flags_for_insert_table_holds_table for super::SetReducerFlags { fn insert_table_holds_table(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_table_holds_table", flags); + self.imp.set_call_reducer_flags(88, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs index aae98d1d331..c7e43eba4e3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_address_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_address { impl insert_unique_address for super::RemoteReducers { fn insert_unique_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_address", InsertUniqueAddress { a, data }) + self.imp.call_reducer(89, InsertUniqueAddress { a, data }) } fn on_insert_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> InsertUniqueAddressCallbackId { InsertUniqueAddressCallbackId(self.imp.on_reducer::( - "insert_unique_address", + 89, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueAddress| callback(ctx, &args.a, &args.data)), )) } fn remove_on_insert_unique_address(&self, callback: InsertUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_address", callback.0) + self.imp.remove_on_reducer::(89, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_address { impl set_flags_for_insert_unique_address for super::SetReducerFlags { fn insert_unique_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_address", flags); + self.imp.set_call_reducer_flags(89, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs index b035dfd07b8..e8b78126c3f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_bool_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_bool { impl insert_unique_bool for super::RemoteReducers { fn insert_unique_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_bool", InsertUniqueBool { b, data }) + self.imp.call_reducer(90, InsertUniqueBool { b, data }) } fn on_insert_unique_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> InsertUniqueBoolCallbackId { InsertUniqueBoolCallbackId(self.imp.on_reducer::( - "insert_unique_bool", + 90, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueBool| callback(ctx, &args.b, &args.data)), )) } fn remove_on_insert_unique_bool(&self, callback: InsertUniqueBoolCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_bool", callback.0) + self.imp.remove_on_reducer::(90, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_bool { impl set_flags_for_insert_unique_bool for super::SetReducerFlags { fn insert_unique_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_bool", flags); + self.imp.set_call_reducer_flags(90, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs index e44e77f5a8c..f3474dbb200 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_128_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_i_128 { impl insert_unique_i_128 for super::RemoteReducers { fn insert_unique_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_i128", InsertUniqueI128 { n, data }) + self.imp.call_reducer(91, InsertUniqueI128 { n, data }) } fn on_insert_unique_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> InsertUniqueI128CallbackId { InsertUniqueI128CallbackId(self.imp.on_reducer::( - "insert_unique_i128", + 91, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_i_128(&self, callback: InsertUniqueI128CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i128", callback.0) + self.imp.remove_on_reducer::(91, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_i_128 { impl set_flags_for_insert_unique_i_128 for super::SetReducerFlags { fn insert_unique_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_i128", flags); + self.imp.set_call_reducer_flags(91, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs index 5bc6b4aba3a..0d9045884d3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_16_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_i_16 { impl insert_unique_i_16 for super::RemoteReducers { fn insert_unique_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i16", InsertUniqueI16 { n, data }) + self.imp.call_reducer(92, InsertUniqueI16 { n, data }) } fn on_insert_unique_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> InsertUniqueI16CallbackId { InsertUniqueI16CallbackId(self.imp.on_reducer::( - "insert_unique_i16", + 92, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_i_16(&self, callback: InsertUniqueI16CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i16", callback.0) + self.imp.remove_on_reducer::(92, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_i_16 { impl set_flags_for_insert_unique_i_16 for super::SetReducerFlags { fn insert_unique_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_i16", flags); + self.imp.set_call_reducer_flags(92, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs index bbbcce0c566..213eb303614 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_256_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_i_256 { impl insert_unique_i_256 for super::RemoteReducers { fn insert_unique_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_i256", InsertUniqueI256 { n, data }) + self.imp.call_reducer(93, InsertUniqueI256 { n, data }) } fn on_insert_unique_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> InsertUniqueI256CallbackId { InsertUniqueI256CallbackId(self.imp.on_reducer::( - "insert_unique_i256", + 93, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_i_256(&self, callback: InsertUniqueI256CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i256", callback.0) + self.imp.remove_on_reducer::(93, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_i_256 { impl set_flags_for_insert_unique_i_256 for super::SetReducerFlags { fn insert_unique_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_i256", flags); + self.imp.set_call_reducer_flags(93, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs index 9a797693ee8..e5fcfe8b3ac 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_32_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_i_32 { impl insert_unique_i_32 for super::RemoteReducers { fn insert_unique_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i32", InsertUniqueI32 { n, data }) + self.imp.call_reducer(94, InsertUniqueI32 { n, data }) } fn on_insert_unique_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> InsertUniqueI32CallbackId { InsertUniqueI32CallbackId(self.imp.on_reducer::( - "insert_unique_i32", + 94, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_i_32(&self, callback: InsertUniqueI32CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i32", callback.0) + self.imp.remove_on_reducer::(94, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_i_32 { impl set_flags_for_insert_unique_i_32 for super::SetReducerFlags { fn insert_unique_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_i32", flags); + self.imp.set_call_reducer_flags(94, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs index 3ec098e667e..4c353bc2341 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_64_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_i_64 { impl insert_unique_i_64 for super::RemoteReducers { fn insert_unique_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i64", InsertUniqueI64 { n, data }) + self.imp.call_reducer(95, InsertUniqueI64 { n, data }) } fn on_insert_unique_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> InsertUniqueI64CallbackId { InsertUniqueI64CallbackId(self.imp.on_reducer::( - "insert_unique_i64", + 95, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_i_64(&self, callback: InsertUniqueI64CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i64", callback.0) + self.imp.remove_on_reducer::(95, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_i_64 { impl set_flags_for_insert_unique_i_64 for super::SetReducerFlags { fn insert_unique_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_i64", flags); + self.imp.set_call_reducer_flags(95, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs index fca339652bf..553f7332ef6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_i_8_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_i_8 { impl insert_unique_i_8 for super::RemoteReducers { fn insert_unique_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_i8", InsertUniqueI8 { n, data }) + self.imp.call_reducer(96, InsertUniqueI8 { n, data }) } fn on_insert_unique_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> InsertUniqueI8CallbackId { InsertUniqueI8CallbackId(self.imp.on_reducer::( - "insert_unique_i8", + 96, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueI8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_i_8(&self, callback: InsertUniqueI8CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_i8", callback.0) + self.imp.remove_on_reducer::(96, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_i_8 { impl set_flags_for_insert_unique_i_8 for super::SetReducerFlags { fn insert_unique_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_i8", flags); + self.imp.set_call_reducer_flags(96, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs index cdea4a89483..b79b9f96bb4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_identity_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_identity { impl insert_unique_identity for super::RemoteReducers { fn insert_unique_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_identity", InsertUniqueIdentity { i, data }) + self.imp.call_reducer(97, InsertUniqueIdentity { i, data }) } fn on_insert_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> InsertUniqueIdentityCallbackId { InsertUniqueIdentityCallbackId(self.imp.on_reducer::( - "insert_unique_identity", + 97, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueIdentity| callback(ctx, &args.i, &args.data)), )) } fn remove_on_insert_unique_identity(&self, callback: InsertUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_identity", callback.0) + self.imp.remove_on_reducer::(97, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_identity { impl set_flags_for_insert_unique_identity for super::SetReducerFlags { fn insert_unique_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_identity", flags); + self.imp.set_call_reducer_flags(97, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs index 732ffcd8a09..de046db0d58 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_string_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_string { impl insert_unique_string for super::RemoteReducers { fn insert_unique_string(&self, s: String, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_string", InsertUniqueString { s, data }) + self.imp.call_reducer(98, InsertUniqueString { s, data }) } fn on_insert_unique_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> InsertUniqueStringCallbackId { InsertUniqueStringCallbackId(self.imp.on_reducer::( - "insert_unique_string", + 98, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueString| callback(ctx, &args.s, &args.data)), )) } fn remove_on_insert_unique_string(&self, callback: InsertUniqueStringCallbackId) { - self.imp - .remove_on_reducer::("insert_unique_string", callback.0) + self.imp.remove_on_reducer::(98, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_string { impl set_flags_for_insert_unique_string for super::SetReducerFlags { fn insert_unique_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_string", flags); + self.imp.set_call_reducer_flags(98, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs index 980b7f3a0c2..753adc12251 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_128_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_u_128 { impl insert_unique_u_128 for super::RemoteReducers { fn insert_unique_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_u128", InsertUniqueU128 { n, data }) + self.imp.call_reducer(99, InsertUniqueU128 { n, data }) } fn on_insert_unique_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> InsertUniqueU128CallbackId { InsertUniqueU128CallbackId(self.imp.on_reducer::( - "insert_unique_u128", + 99, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_u_128(&self, callback: InsertUniqueU128CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u128", callback.0) + self.imp.remove_on_reducer::(99, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_u_128 { impl set_flags_for_insert_unique_u_128 for super::SetReducerFlags { fn insert_unique_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_u128", flags); + self.imp.set_call_reducer_flags(99, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs index 7faf69e02a4..f6cd98ff90f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_16_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_u_16 { impl insert_unique_u_16 for super::RemoteReducers { fn insert_unique_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u16", InsertUniqueU16 { n, data }) + self.imp.call_reducer(100, InsertUniqueU16 { n, data }) } fn on_insert_unique_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> InsertUniqueU16CallbackId { InsertUniqueU16CallbackId(self.imp.on_reducer::( - "insert_unique_u16", + 100, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_u_16(&self, callback: InsertUniqueU16CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u16", callback.0) + self.imp.remove_on_reducer::(100, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_u_16 { impl set_flags_for_insert_unique_u_16 for super::SetReducerFlags { fn insert_unique_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_u16", flags); + self.imp.set_call_reducer_flags(100, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs index 9360698d6fc..8c6593bd561 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_256_reducer.rs @@ -53,21 +53,19 @@ pub trait insert_unique_u_256 { impl insert_unique_u_256 for super::RemoteReducers { fn insert_unique_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_unique_u256", InsertUniqueU256 { n, data }) + self.imp.call_reducer(101, InsertUniqueU256 { n, data }) } fn on_insert_unique_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> InsertUniqueU256CallbackId { InsertUniqueU256CallbackId(self.imp.on_reducer::( - "insert_unique_u256", + 101, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_u_256(&self, callback: InsertUniqueU256CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u256", callback.0) + self.imp.remove_on_reducer::(101, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_insert_unique_u_256 { impl set_flags_for_insert_unique_u_256 for super::SetReducerFlags { fn insert_unique_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_u256", flags); + self.imp.set_call_reducer_flags(101, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs index 6f12f882dee..1551ee578ab 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_32_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_u_32 { impl insert_unique_u_32 for super::RemoteReducers { fn insert_unique_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u32", InsertUniqueU32 { n, data }) + self.imp.call_reducer(102, InsertUniqueU32 { n, data }) } fn on_insert_unique_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> InsertUniqueU32CallbackId { InsertUniqueU32CallbackId(self.imp.on_reducer::( - "insert_unique_u32", + 102, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_u_32(&self, callback: InsertUniqueU32CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u32", callback.0) + self.imp.remove_on_reducer::(102, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_u_32 { impl set_flags_for_insert_unique_u_32 for super::SetReducerFlags { fn insert_unique_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_u32", flags); + self.imp.set_call_reducer_flags(102, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs index aedd948c1f5..27f47c49e78 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_64_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_u_64 { impl insert_unique_u_64 for super::RemoteReducers { fn insert_unique_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u64", InsertUniqueU64 { n, data }) + self.imp.call_reducer(103, InsertUniqueU64 { n, data }) } fn on_insert_unique_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> InsertUniqueU64CallbackId { InsertUniqueU64CallbackId(self.imp.on_reducer::( - "insert_unique_u64", + 103, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_u_64(&self, callback: InsertUniqueU64CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u64", callback.0) + self.imp.remove_on_reducer::(103, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_u_64 { impl set_flags_for_insert_unique_u_64 for super::SetReducerFlags { fn insert_unique_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_u64", flags); + self.imp.set_call_reducer_flags(103, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs index c7179a933a0..7ffc8e2ff14 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_unique_u_8_reducer.rs @@ -53,20 +53,19 @@ pub trait insert_unique_u_8 { impl insert_unique_u_8 for super::RemoteReducers { fn insert_unique_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_unique_u8", InsertUniqueU8 { n, data }) + self.imp.call_reducer(104, InsertUniqueU8 { n, data }) } fn on_insert_unique_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> InsertUniqueU8CallbackId { InsertUniqueU8CallbackId(self.imp.on_reducer::( - "insert_unique_u8", + 104, Box::new(move |ctx: &super::EventContext, args: &InsertUniqueU8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_insert_unique_u_8(&self, callback: InsertUniqueU8CallbackId) { - self.imp - .remove_on_reducer::("insert_unique_u8", callback.0) + self.imp.remove_on_reducer::(104, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_insert_unique_u_8 { impl set_flags_for_insert_unique_u_8 for super::SetReducerFlags { fn insert_unique_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_unique_u8", flags); + self.imp.set_call_reducer_flags(104, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs index 65ba4d7cb4e..a89284a84bf 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_address_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_address { impl insert_vec_address for super::RemoteReducers { fn insert_vec_address(&self, a: Vec<__sdk::Address>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_address", InsertVecAddress { a }) + self.imp.call_reducer(105, InsertVecAddress { a }) } fn on_insert_vec_address( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sdk::Address>) + Send + 'static, ) -> InsertVecAddressCallbackId { InsertVecAddressCallbackId(self.imp.on_reducer::( - "insert_vec_address", + 105, Box::new(move |ctx: &super::EventContext, args: &InsertVecAddress| callback(ctx, &args.a)), )) } fn remove_on_insert_vec_address(&self, callback: InsertVecAddressCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_address", callback.0) + self.imp.remove_on_reducer::(105, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_address { impl set_flags_for_insert_vec_address for super::SetReducerFlags { fn insert_vec_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_address", flags); + self.imp.set_call_reducer_flags(105, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs index 375fb8054c0..52465f9a03f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_bool_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_bool { impl insert_vec_bool for super::RemoteReducers { fn insert_vec_bool(&self, b: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_bool", InsertVecBool { b }) + self.imp.call_reducer(106, InsertVecBool { b }) } fn on_insert_vec_bool( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecBoolCallbackId { InsertVecBoolCallbackId(self.imp.on_reducer::( - "insert_vec_bool", + 106, Box::new(move |ctx: &super::EventContext, args: &InsertVecBool| callback(ctx, &args.b)), )) } fn remove_on_insert_vec_bool(&self, callback: InsertVecBoolCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_bool", callback.0) + self.imp.remove_on_reducer::(106, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_bool { impl set_flags_for_insert_vec_bool for super::SetReducerFlags { fn insert_vec_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_bool", flags); + self.imp.set_call_reducer_flags(106, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs index 05d89ba4491..93e2e33cec4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_byte_struct_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_vec_byte_struct { impl insert_vec_byte_struct for super::RemoteReducers { fn insert_vec_byte_struct(&self, s: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_byte_struct", InsertVecByteStruct { s }) + self.imp.call_reducer(107, InsertVecByteStruct { s }) } fn on_insert_vec_byte_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecByteStructCallbackId { InsertVecByteStructCallbackId(self.imp.on_reducer::( - "insert_vec_byte_struct", + 107, Box::new(move |ctx: &super::EventContext, args: &InsertVecByteStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_vec_byte_struct(&self, callback: InsertVecByteStructCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_byte_struct", callback.0) + self.imp.remove_on_reducer::(107, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_vec_byte_struct { impl set_flags_for_insert_vec_byte_struct for super::SetReducerFlags { fn insert_vec_byte_struct(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_byte_struct", flags); + self.imp.set_call_reducer_flags(107, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs index 30f786e2388..9ddf175df3e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_enum_with_payload_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_vec_enum_with_payload { impl insert_vec_enum_with_payload for super::RemoteReducers { fn insert_vec_enum_with_payload(&self, e: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_enum_with_payload", InsertVecEnumWithPayload { e }) + self.imp.call_reducer(108, InsertVecEnumWithPayload { e }) } fn on_insert_vec_enum_with_payload( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecEnumWithPayloadCallbackId { InsertVecEnumWithPayloadCallbackId(self.imp.on_reducer::( - "insert_vec_enum_with_payload", + 108, Box::new(move |ctx: &super::EventContext, args: &InsertVecEnumWithPayload| callback(ctx, &args.e)), )) } fn remove_on_insert_vec_enum_with_payload(&self, callback: InsertVecEnumWithPayloadCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_enum_with_payload", callback.0) + self.imp.remove_on_reducer::(108, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_vec_enum_with_payload { impl set_flags_for_insert_vec_enum_with_payload for super::SetReducerFlags { fn insert_vec_enum_with_payload(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_enum_with_payload", flags); + self.imp.set_call_reducer_flags(108, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs index 93bc294f3fa..7307f6e4f80 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_primitive_struct_reducer.rs @@ -54,21 +54,20 @@ pub trait insert_vec_every_primitive_struct { impl insert_vec_every_primitive_struct for super::RemoteReducers { fn insert_vec_every_primitive_struct(&self, s: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_every_primitive_struct", InsertVecEveryPrimitiveStruct { s }) + self.imp.call_reducer(109, InsertVecEveryPrimitiveStruct { s }) } fn on_insert_vec_every_primitive_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecEveryPrimitiveStructCallbackId { InsertVecEveryPrimitiveStructCallbackId(self.imp.on_reducer::( - "insert_vec_every_primitive_struct", + 109, Box::new(move |ctx: &super::EventContext, args: &InsertVecEveryPrimitiveStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_vec_every_primitive_struct(&self, callback: InsertVecEveryPrimitiveStructCallbackId) { self.imp - .remove_on_reducer::("insert_vec_every_primitive_struct", callback.0) + .remove_on_reducer::(109, callback.0) } } @@ -88,7 +87,6 @@ pub trait set_flags_for_insert_vec_every_primitive_struct { impl set_flags_for_insert_vec_every_primitive_struct for super::SetReducerFlags { fn insert_vec_every_primitive_struct(&self, flags: __ws::CallReducerFlags) { - self.imp - .set_call_reducer_flags("insert_vec_every_primitive_struct", flags); + self.imp.set_call_reducer_flags(109, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs index a230c84c5aa..f5e5f5bdc71 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_every_vec_struct_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_vec_every_vec_struct { impl insert_vec_every_vec_struct for super::RemoteReducers { fn insert_vec_every_vec_struct(&self, s: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_every_vec_struct", InsertVecEveryVecStruct { s }) + self.imp.call_reducer(110, InsertVecEveryVecStruct { s }) } fn on_insert_vec_every_vec_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecEveryVecStructCallbackId { InsertVecEveryVecStructCallbackId(self.imp.on_reducer::( - "insert_vec_every_vec_struct", + 110, Box::new(move |ctx: &super::EventContext, args: &InsertVecEveryVecStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_vec_every_vec_struct(&self, callback: InsertVecEveryVecStructCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_every_vec_struct", callback.0) + self.imp.remove_on_reducer::(110, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_vec_every_vec_struct { impl set_flags_for_insert_vec_every_vec_struct for super::SetReducerFlags { fn insert_vec_every_vec_struct(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_every_vec_struct", flags); + self.imp.set_call_reducer_flags(110, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs index c9d8fd540f8..8b719e2f0cb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_32_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_f_32 { impl insert_vec_f_32 for super::RemoteReducers { fn insert_vec_f_32(&self, f: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_f32", InsertVecF32 { f }) + self.imp.call_reducer(111, InsertVecF32 { f }) } fn on_insert_vec_f_32( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecF32CallbackId { InsertVecF32CallbackId(self.imp.on_reducer::( - "insert_vec_f32", + 111, Box::new(move |ctx: &super::EventContext, args: &InsertVecF32| callback(ctx, &args.f)), )) } fn remove_on_insert_vec_f_32(&self, callback: InsertVecF32CallbackId) { - self.imp.remove_on_reducer::("insert_vec_f32", callback.0) + self.imp.remove_on_reducer::(111, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_f_32 { impl set_flags_for_insert_vec_f_32 for super::SetReducerFlags { fn insert_vec_f_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_f32", flags); + self.imp.set_call_reducer_flags(111, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs index 2407b5266a8..7fb2d9df71c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_f_64_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_f_64 { impl insert_vec_f_64 for super::RemoteReducers { fn insert_vec_f_64(&self, f: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_f64", InsertVecF64 { f }) + self.imp.call_reducer(112, InsertVecF64 { f }) } fn on_insert_vec_f_64( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecF64CallbackId { InsertVecF64CallbackId(self.imp.on_reducer::( - "insert_vec_f64", + 112, Box::new(move |ctx: &super::EventContext, args: &InsertVecF64| callback(ctx, &args.f)), )) } fn remove_on_insert_vec_f_64(&self, callback: InsertVecF64CallbackId) { - self.imp.remove_on_reducer::("insert_vec_f64", callback.0) + self.imp.remove_on_reducer::(112, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_f_64 { impl set_flags_for_insert_vec_f_64 for super::SetReducerFlags { fn insert_vec_f_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_f64", flags); + self.imp.set_call_reducer_flags(112, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs index 90908728b9c..71afaf68bf4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_128_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_i_128 { impl insert_vec_i_128 for super::RemoteReducers { fn insert_vec_i_128(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i128", InsertVecI128 { n }) + self.imp.call_reducer(113, InsertVecI128 { n }) } fn on_insert_vec_i_128( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI128CallbackId { InsertVecI128CallbackId(self.imp.on_reducer::( - "insert_vec_i128", + 113, Box::new(move |ctx: &super::EventContext, args: &InsertVecI128| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_i_128(&self, callback: InsertVecI128CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_i128", callback.0) + self.imp.remove_on_reducer::(113, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_i_128 { impl set_flags_for_insert_vec_i_128 for super::SetReducerFlags { fn insert_vec_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_i128", flags); + self.imp.set_call_reducer_flags(113, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs index 72a7ff9ec0a..0c364623ff1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_16_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_i_16 { impl insert_vec_i_16 for super::RemoteReducers { fn insert_vec_i_16(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i16", InsertVecI16 { n }) + self.imp.call_reducer(114, InsertVecI16 { n }) } fn on_insert_vec_i_16( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI16CallbackId { InsertVecI16CallbackId(self.imp.on_reducer::( - "insert_vec_i16", + 114, Box::new(move |ctx: &super::EventContext, args: &InsertVecI16| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_i_16(&self, callback: InsertVecI16CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i16", callback.0) + self.imp.remove_on_reducer::(114, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_i_16 { impl set_flags_for_insert_vec_i_16 for super::SetReducerFlags { fn insert_vec_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_i16", flags); + self.imp.set_call_reducer_flags(114, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs index 7596e4121aa..1606ad29437 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_256_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_i_256 { impl insert_vec_i_256 for super::RemoteReducers { fn insert_vec_i_256(&self, n: Vec<__sats::i256>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i256", InsertVecI256 { n }) + self.imp.call_reducer(115, InsertVecI256 { n }) } fn on_insert_vec_i_256( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sats::i256>) + Send + 'static, ) -> InsertVecI256CallbackId { InsertVecI256CallbackId(self.imp.on_reducer::( - "insert_vec_i256", + 115, Box::new(move |ctx: &super::EventContext, args: &InsertVecI256| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_i_256(&self, callback: InsertVecI256CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_i256", callback.0) + self.imp.remove_on_reducer::(115, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_i_256 { impl set_flags_for_insert_vec_i_256 for super::SetReducerFlags { fn insert_vec_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_i256", flags); + self.imp.set_call_reducer_flags(115, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs index 625cb995737..7c6082b43e0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_32_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_i_32 { impl insert_vec_i_32 for super::RemoteReducers { fn insert_vec_i_32(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i32", InsertVecI32 { n }) + self.imp.call_reducer(116, InsertVecI32 { n }) } fn on_insert_vec_i_32( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI32CallbackId { InsertVecI32CallbackId(self.imp.on_reducer::( - "insert_vec_i32", + 116, Box::new(move |ctx: &super::EventContext, args: &InsertVecI32| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_i_32(&self, callback: InsertVecI32CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i32", callback.0) + self.imp.remove_on_reducer::(116, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_i_32 { impl set_flags_for_insert_vec_i_32 for super::SetReducerFlags { fn insert_vec_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_i32", flags); + self.imp.set_call_reducer_flags(116, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs index db04cdcd294..b35169b36d3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_64_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_i_64 { impl insert_vec_i_64 for super::RemoteReducers { fn insert_vec_i_64(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i64", InsertVecI64 { n }) + self.imp.call_reducer(117, InsertVecI64 { n }) } fn on_insert_vec_i_64( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI64CallbackId { InsertVecI64CallbackId(self.imp.on_reducer::( - "insert_vec_i64", + 117, Box::new(move |ctx: &super::EventContext, args: &InsertVecI64| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_i_64(&self, callback: InsertVecI64CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i64", callback.0) + self.imp.remove_on_reducer::(117, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_i_64 { impl set_flags_for_insert_vec_i_64 for super::SetReducerFlags { fn insert_vec_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_i64", flags); + self.imp.set_call_reducer_flags(117, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs index 2b1aaea964a..79957b23d92 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_i_8_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_i_8 { impl insert_vec_i_8 for super::RemoteReducers { fn insert_vec_i_8(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_i8", InsertVecI8 { n }) + self.imp.call_reducer(118, InsertVecI8 { n }) } fn on_insert_vec_i_8( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecI8CallbackId { InsertVecI8CallbackId(self.imp.on_reducer::( - "insert_vec_i8", + 118, Box::new(move |ctx: &super::EventContext, args: &InsertVecI8| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_i_8(&self, callback: InsertVecI8CallbackId) { - self.imp.remove_on_reducer::("insert_vec_i8", callback.0) + self.imp.remove_on_reducer::(118, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_i_8 { impl set_flags_for_insert_vec_i_8 for super::SetReducerFlags { fn insert_vec_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_i8", flags); + self.imp.set_call_reducer_flags(118, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs index 3d598bb5c74..dd50bbdc502 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_identity_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_identity { impl insert_vec_identity for super::RemoteReducers { fn insert_vec_identity(&self, i: Vec<__sdk::Identity>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_identity", InsertVecIdentity { i }) + self.imp.call_reducer(119, InsertVecIdentity { i }) } fn on_insert_vec_identity( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sdk::Identity>) + Send + 'static, ) -> InsertVecIdentityCallbackId { InsertVecIdentityCallbackId(self.imp.on_reducer::( - "insert_vec_identity", + 119, Box::new(move |ctx: &super::EventContext, args: &InsertVecIdentity| callback(ctx, &args.i)), )) } fn remove_on_insert_vec_identity(&self, callback: InsertVecIdentityCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_identity", callback.0) + self.imp.remove_on_reducer::(119, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_identity { impl set_flags_for_insert_vec_identity for super::SetReducerFlags { fn insert_vec_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_identity", flags); + self.imp.set_call_reducer_flags(119, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs index 0590f61e88e..68f58bcffb3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_simple_enum_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_vec_simple_enum { impl insert_vec_simple_enum for super::RemoteReducers { fn insert_vec_simple_enum(&self, e: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_simple_enum", InsertVecSimpleEnum { e }) + self.imp.call_reducer(120, InsertVecSimpleEnum { e }) } fn on_insert_vec_simple_enum( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecSimpleEnumCallbackId { InsertVecSimpleEnumCallbackId(self.imp.on_reducer::( - "insert_vec_simple_enum", + 120, Box::new(move |ctx: &super::EventContext, args: &InsertVecSimpleEnum| callback(ctx, &args.e)), )) } fn remove_on_insert_vec_simple_enum(&self, callback: InsertVecSimpleEnumCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_simple_enum", callback.0) + self.imp.remove_on_reducer::(120, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_vec_simple_enum { impl set_flags_for_insert_vec_simple_enum for super::SetReducerFlags { fn insert_vec_simple_enum(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_simple_enum", flags); + self.imp.set_call_reducer_flags(120, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs index 4f36a761871..e19e110cf4a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_string_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_string { impl insert_vec_string for super::RemoteReducers { fn insert_vec_string(&self, s: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_string", InsertVecString { s }) + self.imp.call_reducer(121, InsertVecString { s }) } fn on_insert_vec_string( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecStringCallbackId { InsertVecStringCallbackId(self.imp.on_reducer::( - "insert_vec_string", + 121, Box::new(move |ctx: &super::EventContext, args: &InsertVecString| callback(ctx, &args.s)), )) } fn remove_on_insert_vec_string(&self, callback: InsertVecStringCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_string", callback.0) + self.imp.remove_on_reducer::(121, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_string { impl set_flags_for_insert_vec_string for super::SetReducerFlags { fn insert_vec_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_string", flags); + self.imp.set_call_reducer_flags(121, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs index 0b5f19e7d07..4fdc4a2c3dd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_128_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_u_128 { impl insert_vec_u_128 for super::RemoteReducers { fn insert_vec_u_128(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u128", InsertVecU128 { n }) + self.imp.call_reducer(122, InsertVecU128 { n }) } fn on_insert_vec_u_128( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU128CallbackId { InsertVecU128CallbackId(self.imp.on_reducer::( - "insert_vec_u128", + 122, Box::new(move |ctx: &super::EventContext, args: &InsertVecU128| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_u_128(&self, callback: InsertVecU128CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_u128", callback.0) + self.imp.remove_on_reducer::(122, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_u_128 { impl set_flags_for_insert_vec_u_128 for super::SetReducerFlags { fn insert_vec_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_u128", flags); + self.imp.set_call_reducer_flags(122, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs index d5e35731f9e..bfd5dff6df6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_16_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_u_16 { impl insert_vec_u_16 for super::RemoteReducers { fn insert_vec_u_16(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u16", InsertVecU16 { n }) + self.imp.call_reducer(123, InsertVecU16 { n }) } fn on_insert_vec_u_16( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU16CallbackId { InsertVecU16CallbackId(self.imp.on_reducer::( - "insert_vec_u16", + 123, Box::new(move |ctx: &super::EventContext, args: &InsertVecU16| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_u_16(&self, callback: InsertVecU16CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u16", callback.0) + self.imp.remove_on_reducer::(123, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_u_16 { impl set_flags_for_insert_vec_u_16 for super::SetReducerFlags { fn insert_vec_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_u16", flags); + self.imp.set_call_reducer_flags(123, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs index e9039f664f0..6ad97fc4bb2 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_256_reducer.rs @@ -52,20 +52,19 @@ pub trait insert_vec_u_256 { impl insert_vec_u_256 for super::RemoteReducers { fn insert_vec_u_256(&self, n: Vec<__sats::u256>) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u256", InsertVecU256 { n }) + self.imp.call_reducer(124, InsertVecU256 { n }) } fn on_insert_vec_u_256( &self, mut callback: impl FnMut(&super::EventContext, &Vec<__sats::u256>) + Send + 'static, ) -> InsertVecU256CallbackId { InsertVecU256CallbackId(self.imp.on_reducer::( - "insert_vec_u256", + 124, Box::new(move |ctx: &super::EventContext, args: &InsertVecU256| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_u_256(&self, callback: InsertVecU256CallbackId) { - self.imp - .remove_on_reducer::("insert_vec_u256", callback.0) + self.imp.remove_on_reducer::(124, callback.0) } } @@ -85,6 +84,6 @@ pub trait set_flags_for_insert_vec_u_256 { impl set_flags_for_insert_vec_u_256 for super::SetReducerFlags { fn insert_vec_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_u256", flags); + self.imp.set_call_reducer_flags(124, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs index 805c4eb4527..84c3ba37d63 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_32_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_u_32 { impl insert_vec_u_32 for super::RemoteReducers { fn insert_vec_u_32(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u32", InsertVecU32 { n }) + self.imp.call_reducer(125, InsertVecU32 { n }) } fn on_insert_vec_u_32( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU32CallbackId { InsertVecU32CallbackId(self.imp.on_reducer::( - "insert_vec_u32", + 125, Box::new(move |ctx: &super::EventContext, args: &InsertVecU32| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_u_32(&self, callback: InsertVecU32CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u32", callback.0) + self.imp.remove_on_reducer::(125, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_u_32 { impl set_flags_for_insert_vec_u_32 for super::SetReducerFlags { fn insert_vec_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_u32", flags); + self.imp.set_call_reducer_flags(125, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs index 4576b20e6b8..3e127bee6be 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_64_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_u_64 { impl insert_vec_u_64 for super::RemoteReducers { fn insert_vec_u_64(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u64", InsertVecU64 { n }) + self.imp.call_reducer(126, InsertVecU64 { n }) } fn on_insert_vec_u_64( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU64CallbackId { InsertVecU64CallbackId(self.imp.on_reducer::( - "insert_vec_u64", + 126, Box::new(move |ctx: &super::EventContext, args: &InsertVecU64| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_u_64(&self, callback: InsertVecU64CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u64", callback.0) + self.imp.remove_on_reducer::(126, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_u_64 { impl set_flags_for_insert_vec_u_64 for super::SetReducerFlags { fn insert_vec_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_u64", flags); + self.imp.set_call_reducer_flags(126, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs index 6ba80949e11..51e029a2552 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_u_8_reducer.rs @@ -52,19 +52,19 @@ pub trait insert_vec_u_8 { impl insert_vec_u_8 for super::RemoteReducers { fn insert_vec_u_8(&self, n: Vec) -> __anyhow::Result<()> { - self.imp.call_reducer("insert_vec_u8", InsertVecU8 { n }) + self.imp.call_reducer(127, InsertVecU8 { n }) } fn on_insert_vec_u_8( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecU8CallbackId { InsertVecU8CallbackId(self.imp.on_reducer::( - "insert_vec_u8", + 127, Box::new(move |ctx: &super::EventContext, args: &InsertVecU8| callback(ctx, &args.n)), )) } fn remove_on_insert_vec_u_8(&self, callback: InsertVecU8CallbackId) { - self.imp.remove_on_reducer::("insert_vec_u8", callback.0) + self.imp.remove_on_reducer::(127, callback.0) } } @@ -84,6 +84,6 @@ pub trait set_flags_for_insert_vec_u_8 { impl set_flags_for_insert_vec_u_8 for super::SetReducerFlags { fn insert_vec_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_u8", flags); + self.imp.set_call_reducer_flags(127, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs index dfb499f11ed..399ade62a45 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/insert_vec_unit_struct_reducer.rs @@ -54,21 +54,19 @@ pub trait insert_vec_unit_struct { impl insert_vec_unit_struct for super::RemoteReducers { fn insert_vec_unit_struct(&self, s: Vec) -> __anyhow::Result<()> { - self.imp - .call_reducer("insert_vec_unit_struct", InsertVecUnitStruct { s }) + self.imp.call_reducer(128, InsertVecUnitStruct { s }) } fn on_insert_vec_unit_struct( &self, mut callback: impl FnMut(&super::EventContext, &Vec) + Send + 'static, ) -> InsertVecUnitStructCallbackId { InsertVecUnitStructCallbackId(self.imp.on_reducer::( - "insert_vec_unit_struct", + 128, Box::new(move |ctx: &super::EventContext, args: &InsertVecUnitStruct| callback(ctx, &args.s)), )) } fn remove_on_insert_vec_unit_struct(&self, callback: InsertVecUnitStructCallbackId) { - self.imp - .remove_on_reducer::("insert_vec_unit_struct", callback.0) + self.imp.remove_on_reducer::(128, callback.0) } } @@ -88,6 +86,6 @@ pub trait set_flags_for_insert_vec_unit_struct { impl set_flags_for_insert_vec_unit_struct for super::SetReducerFlags { fn insert_vec_unit_struct(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("insert_vec_unit_struct", flags); + self.imp.set_call_reducer_flags(128, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/large_table_table.rs b/crates/sdk/tests/test-client/src/module_bindings/large_table_table.rs index c93d404ac04..25cf9ea4dfd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/large_table_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/large_table_table.rs @@ -41,7 +41,7 @@ pub trait LargeTableTableAccess { impl LargeTableTableAccess for super::RemoteTables { fn large_table(&self) -> LargeTableTableHandle<'_> { LargeTableTableHandle { - imp: self.imp.get_table::("large_table"), + imp: self.imp.get_table::(0), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/mod.rs b/crates/sdk/tests/test-client/src/module_bindings/mod.rs index 02caa0e57fa..745678579b3 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/mod.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/mod.rs @@ -876,170 +876,170 @@ impl __sdk::spacetime_module::InModule for Reducer { } impl __sdk::spacetime_module::Reducer for Reducer { - fn reducer_name(&self) -> &'static str { + fn reducer_index(&self) -> u32 { match self { - Reducer::DeletePkAddress(_) => "delete_pk_address", - Reducer::DeletePkBool(_) => "delete_pk_bool", - Reducer::DeletePkI128(_) => "delete_pk_i128", - Reducer::DeletePkI16(_) => "delete_pk_i16", - Reducer::DeletePkI256(_) => "delete_pk_i256", - Reducer::DeletePkI32(_) => "delete_pk_i32", - Reducer::DeletePkI64(_) => "delete_pk_i64", - Reducer::DeletePkI8(_) => "delete_pk_i8", - Reducer::DeletePkIdentity(_) => "delete_pk_identity", - Reducer::DeletePkString(_) => "delete_pk_string", - Reducer::DeletePkU128(_) => "delete_pk_u128", - Reducer::DeletePkU16(_) => "delete_pk_u16", - Reducer::DeletePkU256(_) => "delete_pk_u256", - Reducer::DeletePkU32(_) => "delete_pk_u32", - Reducer::DeletePkU64(_) => "delete_pk_u64", - Reducer::DeletePkU8(_) => "delete_pk_u8", - Reducer::DeleteUniqueAddress(_) => "delete_unique_address", - Reducer::DeleteUniqueBool(_) => "delete_unique_bool", - Reducer::DeleteUniqueI128(_) => "delete_unique_i128", - Reducer::DeleteUniqueI16(_) => "delete_unique_i16", - Reducer::DeleteUniqueI256(_) => "delete_unique_i256", - Reducer::DeleteUniqueI32(_) => "delete_unique_i32", - Reducer::DeleteUniqueI64(_) => "delete_unique_i64", - Reducer::DeleteUniqueI8(_) => "delete_unique_i8", - Reducer::DeleteUniqueIdentity(_) => "delete_unique_identity", - Reducer::DeleteUniqueString(_) => "delete_unique_string", - Reducer::DeleteUniqueU128(_) => "delete_unique_u128", - Reducer::DeleteUniqueU16(_) => "delete_unique_u16", - Reducer::DeleteUniqueU256(_) => "delete_unique_u256", - Reducer::DeleteUniqueU32(_) => "delete_unique_u32", - Reducer::DeleteUniqueU64(_) => "delete_unique_u64", - Reducer::DeleteUniqueU8(_) => "delete_unique_u8", - Reducer::InsertCallerOneAddress(_) => "insert_caller_one_address", - Reducer::InsertCallerOneIdentity(_) => "insert_caller_one_identity", - Reducer::InsertCallerPkAddress(_) => "insert_caller_pk_address", - Reducer::InsertCallerPkIdentity(_) => "insert_caller_pk_identity", - Reducer::InsertCallerUniqueAddress(_) => "insert_caller_unique_address", - Reducer::InsertCallerUniqueIdentity(_) => "insert_caller_unique_identity", - Reducer::InsertCallerVecAddress(_) => "insert_caller_vec_address", - Reducer::InsertCallerVecIdentity(_) => "insert_caller_vec_identity", - Reducer::InsertLargeTable(_) => "insert_large_table", - Reducer::InsertOneAddress(_) => "insert_one_address", - Reducer::InsertOneBool(_) => "insert_one_bool", - Reducer::InsertOneByteStruct(_) => "insert_one_byte_struct", - Reducer::InsertOneEnumWithPayload(_) => "insert_one_enum_with_payload", - Reducer::InsertOneEveryPrimitiveStruct(_) => "insert_one_every_primitive_struct", - Reducer::InsertOneEveryVecStruct(_) => "insert_one_every_vec_struct", - Reducer::InsertOneF32(_) => "insert_one_f32", - Reducer::InsertOneF64(_) => "insert_one_f64", - Reducer::InsertOneI128(_) => "insert_one_i128", - Reducer::InsertOneI16(_) => "insert_one_i16", - Reducer::InsertOneI256(_) => "insert_one_i256", - Reducer::InsertOneI32(_) => "insert_one_i32", - Reducer::InsertOneI64(_) => "insert_one_i64", - Reducer::InsertOneI8(_) => "insert_one_i8", - Reducer::InsertOneIdentity(_) => "insert_one_identity", - Reducer::InsertOneSimpleEnum(_) => "insert_one_simple_enum", - Reducer::InsertOneString(_) => "insert_one_string", - Reducer::InsertOneU128(_) => "insert_one_u128", - Reducer::InsertOneU16(_) => "insert_one_u16", - Reducer::InsertOneU256(_) => "insert_one_u256", - Reducer::InsertOneU32(_) => "insert_one_u32", - Reducer::InsertOneU64(_) => "insert_one_u64", - Reducer::InsertOneU8(_) => "insert_one_u8", - Reducer::InsertOneUnitStruct(_) => "insert_one_unit_struct", - Reducer::InsertOptionEveryPrimitiveStruct(_) => "insert_option_every_primitive_struct", - Reducer::InsertOptionI32(_) => "insert_option_i32", - Reducer::InsertOptionIdentity(_) => "insert_option_identity", - Reducer::InsertOptionSimpleEnum(_) => "insert_option_simple_enum", - Reducer::InsertOptionString(_) => "insert_option_string", - Reducer::InsertOptionVecOptionI32(_) => "insert_option_vec_option_i32", - Reducer::InsertPkAddress(_) => "insert_pk_address", - Reducer::InsertPkBool(_) => "insert_pk_bool", - Reducer::InsertPkI128(_) => "insert_pk_i128", - Reducer::InsertPkI16(_) => "insert_pk_i16", - Reducer::InsertPkI256(_) => "insert_pk_i256", - Reducer::InsertPkI32(_) => "insert_pk_i32", - Reducer::InsertPkI64(_) => "insert_pk_i64", - Reducer::InsertPkI8(_) => "insert_pk_i8", - Reducer::InsertPkIdentity(_) => "insert_pk_identity", - Reducer::InsertPkString(_) => "insert_pk_string", - Reducer::InsertPkU128(_) => "insert_pk_u128", - Reducer::InsertPkU16(_) => "insert_pk_u16", - Reducer::InsertPkU256(_) => "insert_pk_u256", - Reducer::InsertPkU32(_) => "insert_pk_u32", - Reducer::InsertPkU64(_) => "insert_pk_u64", - Reducer::InsertPkU8(_) => "insert_pk_u8", - Reducer::InsertPrimitivesAsStrings(_) => "insert_primitives_as_strings", - Reducer::InsertTableHoldsTable(_) => "insert_table_holds_table", - Reducer::InsertUniqueAddress(_) => "insert_unique_address", - Reducer::InsertUniqueBool(_) => "insert_unique_bool", - Reducer::InsertUniqueI128(_) => "insert_unique_i128", - Reducer::InsertUniqueI16(_) => "insert_unique_i16", - Reducer::InsertUniqueI256(_) => "insert_unique_i256", - Reducer::InsertUniqueI32(_) => "insert_unique_i32", - Reducer::InsertUniqueI64(_) => "insert_unique_i64", - Reducer::InsertUniqueI8(_) => "insert_unique_i8", - Reducer::InsertUniqueIdentity(_) => "insert_unique_identity", - Reducer::InsertUniqueString(_) => "insert_unique_string", - Reducer::InsertUniqueU128(_) => "insert_unique_u128", - Reducer::InsertUniqueU16(_) => "insert_unique_u16", - Reducer::InsertUniqueU256(_) => "insert_unique_u256", - Reducer::InsertUniqueU32(_) => "insert_unique_u32", - Reducer::InsertUniqueU64(_) => "insert_unique_u64", - Reducer::InsertUniqueU8(_) => "insert_unique_u8", - Reducer::InsertVecAddress(_) => "insert_vec_address", - Reducer::InsertVecBool(_) => "insert_vec_bool", - Reducer::InsertVecByteStruct(_) => "insert_vec_byte_struct", - Reducer::InsertVecEnumWithPayload(_) => "insert_vec_enum_with_payload", - Reducer::InsertVecEveryPrimitiveStruct(_) => "insert_vec_every_primitive_struct", - Reducer::InsertVecEveryVecStruct(_) => "insert_vec_every_vec_struct", - Reducer::InsertVecF32(_) => "insert_vec_f32", - Reducer::InsertVecF64(_) => "insert_vec_f64", - Reducer::InsertVecI128(_) => "insert_vec_i128", - Reducer::InsertVecI16(_) => "insert_vec_i16", - Reducer::InsertVecI256(_) => "insert_vec_i256", - Reducer::InsertVecI32(_) => "insert_vec_i32", - Reducer::InsertVecI64(_) => "insert_vec_i64", - Reducer::InsertVecI8(_) => "insert_vec_i8", - Reducer::InsertVecIdentity(_) => "insert_vec_identity", - Reducer::InsertVecSimpleEnum(_) => "insert_vec_simple_enum", - Reducer::InsertVecString(_) => "insert_vec_string", - Reducer::InsertVecU128(_) => "insert_vec_u128", - Reducer::InsertVecU16(_) => "insert_vec_u16", - Reducer::InsertVecU256(_) => "insert_vec_u256", - Reducer::InsertVecU32(_) => "insert_vec_u32", - Reducer::InsertVecU64(_) => "insert_vec_u64", - Reducer::InsertVecU8(_) => "insert_vec_u8", - Reducer::InsertVecUnitStruct(_) => "insert_vec_unit_struct", - Reducer::NoOpSucceeds(_) => "no_op_succeeds", - Reducer::UpdatePkAddress(_) => "update_pk_address", - Reducer::UpdatePkBool(_) => "update_pk_bool", - Reducer::UpdatePkI128(_) => "update_pk_i128", - Reducer::UpdatePkI16(_) => "update_pk_i16", - Reducer::UpdatePkI256(_) => "update_pk_i256", - Reducer::UpdatePkI32(_) => "update_pk_i32", - Reducer::UpdatePkI64(_) => "update_pk_i64", - Reducer::UpdatePkI8(_) => "update_pk_i8", - Reducer::UpdatePkIdentity(_) => "update_pk_identity", - Reducer::UpdatePkString(_) => "update_pk_string", - Reducer::UpdatePkU128(_) => "update_pk_u128", - Reducer::UpdatePkU16(_) => "update_pk_u16", - Reducer::UpdatePkU256(_) => "update_pk_u256", - Reducer::UpdatePkU32(_) => "update_pk_u32", - Reducer::UpdatePkU64(_) => "update_pk_u64", - Reducer::UpdatePkU8(_) => "update_pk_u8", - Reducer::UpdateUniqueAddress(_) => "update_unique_address", - Reducer::UpdateUniqueBool(_) => "update_unique_bool", - Reducer::UpdateUniqueI128(_) => "update_unique_i128", - Reducer::UpdateUniqueI16(_) => "update_unique_i16", - Reducer::UpdateUniqueI256(_) => "update_unique_i256", - Reducer::UpdateUniqueI32(_) => "update_unique_i32", - Reducer::UpdateUniqueI64(_) => "update_unique_i64", - Reducer::UpdateUniqueI8(_) => "update_unique_i8", - Reducer::UpdateUniqueIdentity(_) => "update_unique_identity", - Reducer::UpdateUniqueString(_) => "update_unique_string", - Reducer::UpdateUniqueU128(_) => "update_unique_u128", - Reducer::UpdateUniqueU16(_) => "update_unique_u16", - Reducer::UpdateUniqueU256(_) => "update_unique_u256", - Reducer::UpdateUniqueU32(_) => "update_unique_u32", - Reducer::UpdateUniqueU64(_) => "update_unique_u64", - Reducer::UpdateUniqueU8(_) => "update_unique_u8", + Reducer::DeletePkAddress(_) => 0, + Reducer::DeletePkBool(_) => 1, + Reducer::DeletePkI128(_) => 2, + Reducer::DeletePkI16(_) => 3, + Reducer::DeletePkI256(_) => 4, + Reducer::DeletePkI32(_) => 5, + Reducer::DeletePkI64(_) => 6, + Reducer::DeletePkI8(_) => 7, + Reducer::DeletePkIdentity(_) => 8, + Reducer::DeletePkString(_) => 9, + Reducer::DeletePkU128(_) => 10, + Reducer::DeletePkU16(_) => 11, + Reducer::DeletePkU256(_) => 12, + Reducer::DeletePkU32(_) => 13, + Reducer::DeletePkU64(_) => 14, + Reducer::DeletePkU8(_) => 15, + Reducer::DeleteUniqueAddress(_) => 16, + Reducer::DeleteUniqueBool(_) => 17, + Reducer::DeleteUniqueI128(_) => 18, + Reducer::DeleteUniqueI16(_) => 19, + Reducer::DeleteUniqueI256(_) => 20, + Reducer::DeleteUniqueI32(_) => 21, + Reducer::DeleteUniqueI64(_) => 22, + Reducer::DeleteUniqueI8(_) => 23, + Reducer::DeleteUniqueIdentity(_) => 24, + Reducer::DeleteUniqueString(_) => 25, + Reducer::DeleteUniqueU128(_) => 26, + Reducer::DeleteUniqueU16(_) => 27, + Reducer::DeleteUniqueU256(_) => 28, + Reducer::DeleteUniqueU32(_) => 29, + Reducer::DeleteUniqueU64(_) => 30, + Reducer::DeleteUniqueU8(_) => 31, + Reducer::InsertCallerOneAddress(_) => 32, + Reducer::InsertCallerOneIdentity(_) => 33, + Reducer::InsertCallerPkAddress(_) => 34, + Reducer::InsertCallerPkIdentity(_) => 35, + Reducer::InsertCallerUniqueAddress(_) => 36, + Reducer::InsertCallerUniqueIdentity(_) => 37, + Reducer::InsertCallerVecAddress(_) => 38, + Reducer::InsertCallerVecIdentity(_) => 39, + Reducer::InsertLargeTable(_) => 40, + Reducer::InsertOneAddress(_) => 41, + Reducer::InsertOneBool(_) => 42, + Reducer::InsertOneByteStruct(_) => 43, + Reducer::InsertOneEnumWithPayload(_) => 44, + Reducer::InsertOneEveryPrimitiveStruct(_) => 45, + Reducer::InsertOneEveryVecStruct(_) => 46, + Reducer::InsertOneF32(_) => 47, + Reducer::InsertOneF64(_) => 48, + Reducer::InsertOneI128(_) => 49, + Reducer::InsertOneI16(_) => 50, + Reducer::InsertOneI256(_) => 51, + Reducer::InsertOneI32(_) => 52, + Reducer::InsertOneI64(_) => 53, + Reducer::InsertOneI8(_) => 54, + Reducer::InsertOneIdentity(_) => 55, + Reducer::InsertOneSimpleEnum(_) => 56, + Reducer::InsertOneString(_) => 57, + Reducer::InsertOneU128(_) => 58, + Reducer::InsertOneU16(_) => 59, + Reducer::InsertOneU256(_) => 60, + Reducer::InsertOneU32(_) => 61, + Reducer::InsertOneU64(_) => 62, + Reducer::InsertOneU8(_) => 63, + Reducer::InsertOneUnitStruct(_) => 64, + Reducer::InsertOptionEveryPrimitiveStruct(_) => 65, + Reducer::InsertOptionI32(_) => 66, + Reducer::InsertOptionIdentity(_) => 67, + Reducer::InsertOptionSimpleEnum(_) => 68, + Reducer::InsertOptionString(_) => 69, + Reducer::InsertOptionVecOptionI32(_) => 70, + Reducer::InsertPkAddress(_) => 71, + Reducer::InsertPkBool(_) => 72, + Reducer::InsertPkI128(_) => 73, + Reducer::InsertPkI16(_) => 74, + Reducer::InsertPkI256(_) => 75, + Reducer::InsertPkI32(_) => 76, + Reducer::InsertPkI64(_) => 77, + Reducer::InsertPkI8(_) => 78, + Reducer::InsertPkIdentity(_) => 79, + Reducer::InsertPkString(_) => 80, + Reducer::InsertPkU128(_) => 81, + Reducer::InsertPkU16(_) => 82, + Reducer::InsertPkU256(_) => 83, + Reducer::InsertPkU32(_) => 84, + Reducer::InsertPkU64(_) => 85, + Reducer::InsertPkU8(_) => 86, + Reducer::InsertPrimitivesAsStrings(_) => 87, + Reducer::InsertTableHoldsTable(_) => 88, + Reducer::InsertUniqueAddress(_) => 89, + Reducer::InsertUniqueBool(_) => 90, + Reducer::InsertUniqueI128(_) => 91, + Reducer::InsertUniqueI16(_) => 92, + Reducer::InsertUniqueI256(_) => 93, + Reducer::InsertUniqueI32(_) => 94, + Reducer::InsertUniqueI64(_) => 95, + Reducer::InsertUniqueI8(_) => 96, + Reducer::InsertUniqueIdentity(_) => 97, + Reducer::InsertUniqueString(_) => 98, + Reducer::InsertUniqueU128(_) => 99, + Reducer::InsertUniqueU16(_) => 100, + Reducer::InsertUniqueU256(_) => 101, + Reducer::InsertUniqueU32(_) => 102, + Reducer::InsertUniqueU64(_) => 103, + Reducer::InsertUniqueU8(_) => 104, + Reducer::InsertVecAddress(_) => 105, + Reducer::InsertVecBool(_) => 106, + Reducer::InsertVecByteStruct(_) => 107, + Reducer::InsertVecEnumWithPayload(_) => 108, + Reducer::InsertVecEveryPrimitiveStruct(_) => 109, + Reducer::InsertVecEveryVecStruct(_) => 110, + Reducer::InsertVecF32(_) => 111, + Reducer::InsertVecF64(_) => 112, + Reducer::InsertVecI128(_) => 113, + Reducer::InsertVecI16(_) => 114, + Reducer::InsertVecI256(_) => 115, + Reducer::InsertVecI32(_) => 116, + Reducer::InsertVecI64(_) => 117, + Reducer::InsertVecI8(_) => 118, + Reducer::InsertVecIdentity(_) => 119, + Reducer::InsertVecSimpleEnum(_) => 120, + Reducer::InsertVecString(_) => 121, + Reducer::InsertVecU128(_) => 122, + Reducer::InsertVecU16(_) => 123, + Reducer::InsertVecU256(_) => 124, + Reducer::InsertVecU32(_) => 125, + Reducer::InsertVecU64(_) => 126, + Reducer::InsertVecU8(_) => 127, + Reducer::InsertVecUnitStruct(_) => 128, + Reducer::NoOpSucceeds(_) => 129, + Reducer::UpdatePkAddress(_) => 130, + Reducer::UpdatePkBool(_) => 131, + Reducer::UpdatePkI128(_) => 132, + Reducer::UpdatePkI16(_) => 133, + Reducer::UpdatePkI256(_) => 134, + Reducer::UpdatePkI32(_) => 135, + Reducer::UpdatePkI64(_) => 136, + Reducer::UpdatePkI8(_) => 137, + Reducer::UpdatePkIdentity(_) => 138, + Reducer::UpdatePkString(_) => 139, + Reducer::UpdatePkU128(_) => 140, + Reducer::UpdatePkU16(_) => 141, + Reducer::UpdatePkU256(_) => 142, + Reducer::UpdatePkU32(_) => 143, + Reducer::UpdatePkU64(_) => 144, + Reducer::UpdatePkU8(_) => 145, + Reducer::UpdateUniqueAddress(_) => 146, + Reducer::UpdateUniqueBool(_) => 147, + Reducer::UpdateUniqueI128(_) => 148, + Reducer::UpdateUniqueI16(_) => 149, + Reducer::UpdateUniqueI256(_) => 150, + Reducer::UpdateUniqueI32(_) => 151, + Reducer::UpdateUniqueI64(_) => 152, + Reducer::UpdateUniqueI8(_) => 153, + Reducer::UpdateUniqueIdentity(_) => 154, + Reducer::UpdateUniqueString(_) => 155, + Reducer::UpdateUniqueU128(_) => 156, + Reducer::UpdateUniqueU16(_) => 157, + Reducer::UpdateUniqueU256(_) => 158, + Reducer::UpdateUniqueU32(_) => 159, + Reducer::UpdateUniqueU64(_) => 160, + Reducer::UpdateUniqueU8(_) => 161, } } fn reducer_args(&self) -> &dyn std::any::Any { @@ -1208,626 +1208,353 @@ impl __sdk::spacetime_module::Reducer for Reducer { Reducer::UpdateUniqueU8(args) => args, } } -} -impl TryFrom<__ws::ReducerCallInfo<__ws::BsatnFormat>> for Reducer { - type Error = __anyhow::Error; - fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __anyhow::Result { - match &value.reducer_name[..] { - "delete_pk_address" => Ok(Reducer::DeletePkAddress(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_address", - &value.args, - )?)), - "delete_pk_bool" => Ok(Reducer::DeletePkBool(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_bool", - &value.args, - )?)), - "delete_pk_i128" => Ok(Reducer::DeletePkI128(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_i128", - &value.args, - )?)), - "delete_pk_i16" => Ok(Reducer::DeletePkI16(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_i16", - &value.args, - )?)), - "delete_pk_i256" => Ok(Reducer::DeletePkI256(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_i256", - &value.args, - )?)), - "delete_pk_i32" => Ok(Reducer::DeletePkI32(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_i32", - &value.args, - )?)), - "delete_pk_i64" => Ok(Reducer::DeletePkI64(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_i64", - &value.args, - )?)), - "delete_pk_i8" => Ok(Reducer::DeletePkI8(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_i8", - &value.args, - )?)), - "delete_pk_identity" => Ok(Reducer::DeletePkIdentity(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_identity", - &value.args, - )?)), - "delete_pk_string" => Ok(Reducer::DeletePkString(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_string", - &value.args, - )?)), - "delete_pk_u128" => Ok(Reducer::DeletePkU128(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_u128", - &value.args, - )?)), - "delete_pk_u16" => Ok(Reducer::DeletePkU16(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_u16", - &value.args, - )?)), - "delete_pk_u256" => Ok(Reducer::DeletePkU256(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_u256", - &value.args, - )?)), - "delete_pk_u32" => Ok(Reducer::DeletePkU32(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_u32", - &value.args, - )?)), - "delete_pk_u64" => Ok(Reducer::DeletePkU64(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_u64", - &value.args, - )?)), - "delete_pk_u8" => Ok(Reducer::DeletePkU8(__sdk::spacetime_module::parse_reducer_args( - "delete_pk_u8", - &value.args, - )?)), - "delete_unique_address" => Ok(Reducer::DeleteUniqueAddress( - __sdk::spacetime_module::parse_reducer_args("delete_unique_address", &value.args)?, - )), - "delete_unique_bool" => Ok(Reducer::DeleteUniqueBool(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_bool", - &value.args, - )?)), - "delete_unique_i128" => Ok(Reducer::DeleteUniqueI128(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_i128", - &value.args, - )?)), - "delete_unique_i16" => Ok(Reducer::DeleteUniqueI16(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_i16", - &value.args, - )?)), - "delete_unique_i256" => Ok(Reducer::DeleteUniqueI256(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_i256", - &value.args, - )?)), - "delete_unique_i32" => Ok(Reducer::DeleteUniqueI32(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_i32", - &value.args, - )?)), - "delete_unique_i64" => Ok(Reducer::DeleteUniqueI64(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_i64", - &value.args, - )?)), - "delete_unique_i8" => Ok(Reducer::DeleteUniqueI8(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_i8", - &value.args, - )?)), - "delete_unique_identity" => Ok(Reducer::DeleteUniqueIdentity( - __sdk::spacetime_module::parse_reducer_args("delete_unique_identity", &value.args)?, - )), - "delete_unique_string" => Ok(Reducer::DeleteUniqueString( - __sdk::spacetime_module::parse_reducer_args("delete_unique_string", &value.args)?, - )), - "delete_unique_u128" => Ok(Reducer::DeleteUniqueU128(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_u128", - &value.args, - )?)), - "delete_unique_u16" => Ok(Reducer::DeleteUniqueU16(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_u16", - &value.args, - )?)), - "delete_unique_u256" => Ok(Reducer::DeleteUniqueU256(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_u256", - &value.args, - )?)), - "delete_unique_u32" => Ok(Reducer::DeleteUniqueU32(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_u32", - &value.args, - )?)), - "delete_unique_u64" => Ok(Reducer::DeleteUniqueU64(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_u64", - &value.args, - )?)), - "delete_unique_u8" => Ok(Reducer::DeleteUniqueU8(__sdk::spacetime_module::parse_reducer_args( - "delete_unique_u8", - &value.args, - )?)), - "insert_caller_one_address" => Ok(Reducer::InsertCallerOneAddress( - __sdk::spacetime_module::parse_reducer_args("insert_caller_one_address", &value.args)?, - )), - "insert_caller_one_identity" => Ok(Reducer::InsertCallerOneIdentity( - __sdk::spacetime_module::parse_reducer_args("insert_caller_one_identity", &value.args)?, - )), - "insert_caller_pk_address" => Ok(Reducer::InsertCallerPkAddress( - __sdk::spacetime_module::parse_reducer_args("insert_caller_pk_address", &value.args)?, - )), - "insert_caller_pk_identity" => Ok(Reducer::InsertCallerPkIdentity( - __sdk::spacetime_module::parse_reducer_args("insert_caller_pk_identity", &value.args)?, - )), - "insert_caller_unique_address" => Ok(Reducer::InsertCallerUniqueAddress( - __sdk::spacetime_module::parse_reducer_args("insert_caller_unique_address", &value.args)?, - )), - "insert_caller_unique_identity" => Ok(Reducer::InsertCallerUniqueIdentity( - __sdk::spacetime_module::parse_reducer_args("insert_caller_unique_identity", &value.args)?, - )), - "insert_caller_vec_address" => Ok(Reducer::InsertCallerVecAddress( - __sdk::spacetime_module::parse_reducer_args("insert_caller_vec_address", &value.args)?, - )), - "insert_caller_vec_identity" => Ok(Reducer::InsertCallerVecIdentity( - __sdk::spacetime_module::parse_reducer_args("insert_caller_vec_identity", &value.args)?, - )), - "insert_large_table" => Ok(Reducer::InsertLargeTable(__sdk::spacetime_module::parse_reducer_args( - "insert_large_table", - &value.args, - )?)), - "insert_one_address" => Ok(Reducer::InsertOneAddress(__sdk::spacetime_module::parse_reducer_args( - "insert_one_address", - &value.args, - )?)), - "insert_one_bool" => Ok(Reducer::InsertOneBool(__sdk::spacetime_module::parse_reducer_args( - "insert_one_bool", - &value.args, - )?)), - "insert_one_byte_struct" => Ok(Reducer::InsertOneByteStruct( - __sdk::spacetime_module::parse_reducer_args("insert_one_byte_struct", &value.args)?, - )), - "insert_one_enum_with_payload" => Ok(Reducer::InsertOneEnumWithPayload( - __sdk::spacetime_module::parse_reducer_args("insert_one_enum_with_payload", &value.args)?, - )), - "insert_one_every_primitive_struct" => Ok(Reducer::InsertOneEveryPrimitiveStruct( - __sdk::spacetime_module::parse_reducer_args("insert_one_every_primitive_struct", &value.args)?, - )), - "insert_one_every_vec_struct" => Ok(Reducer::InsertOneEveryVecStruct( - __sdk::spacetime_module::parse_reducer_args("insert_one_every_vec_struct", &value.args)?, - )), - "insert_one_f32" => Ok(Reducer::InsertOneF32(__sdk::spacetime_module::parse_reducer_args( - "insert_one_f32", - &value.args, - )?)), - "insert_one_f64" => Ok(Reducer::InsertOneF64(__sdk::spacetime_module::parse_reducer_args( - "insert_one_f64", - &value.args, - )?)), - "insert_one_i128" => Ok(Reducer::InsertOneI128(__sdk::spacetime_module::parse_reducer_args( - "insert_one_i128", - &value.args, - )?)), - "insert_one_i16" => Ok(Reducer::InsertOneI16(__sdk::spacetime_module::parse_reducer_args( - "insert_one_i16", - &value.args, - )?)), - "insert_one_i256" => Ok(Reducer::InsertOneI256(__sdk::spacetime_module::parse_reducer_args( - "insert_one_i256", - &value.args, - )?)), - "insert_one_i32" => Ok(Reducer::InsertOneI32(__sdk::spacetime_module::parse_reducer_args( - "insert_one_i32", - &value.args, - )?)), - "insert_one_i64" => Ok(Reducer::InsertOneI64(__sdk::spacetime_module::parse_reducer_args( - "insert_one_i64", - &value.args, - )?)), - "insert_one_i8" => Ok(Reducer::InsertOneI8(__sdk::spacetime_module::parse_reducer_args( - "insert_one_i8", - &value.args, - )?)), - "insert_one_identity" => Ok(Reducer::InsertOneIdentity(__sdk::spacetime_module::parse_reducer_args( - "insert_one_identity", - &value.args, - )?)), - "insert_one_simple_enum" => Ok(Reducer::InsertOneSimpleEnum( - __sdk::spacetime_module::parse_reducer_args("insert_one_simple_enum", &value.args)?, - )), - "insert_one_string" => Ok(Reducer::InsertOneString(__sdk::spacetime_module::parse_reducer_args( - "insert_one_string", - &value.args, - )?)), - "insert_one_u128" => Ok(Reducer::InsertOneU128(__sdk::spacetime_module::parse_reducer_args( - "insert_one_u128", - &value.args, - )?)), - "insert_one_u16" => Ok(Reducer::InsertOneU16(__sdk::spacetime_module::parse_reducer_args( - "insert_one_u16", - &value.args, - )?)), - "insert_one_u256" => Ok(Reducer::InsertOneU256(__sdk::spacetime_module::parse_reducer_args( - "insert_one_u256", - &value.args, - )?)), - "insert_one_u32" => Ok(Reducer::InsertOneU32(__sdk::spacetime_module::parse_reducer_args( - "insert_one_u32", - &value.args, - )?)), - "insert_one_u64" => Ok(Reducer::InsertOneU64(__sdk::spacetime_module::parse_reducer_args( - "insert_one_u64", - &value.args, - )?)), - "insert_one_u8" => Ok(Reducer::InsertOneU8(__sdk::spacetime_module::parse_reducer_args( - "insert_one_u8", - &value.args, - )?)), - "insert_one_unit_struct" => Ok(Reducer::InsertOneUnitStruct( - __sdk::spacetime_module::parse_reducer_args("insert_one_unit_struct", &value.args)?, - )), - "insert_option_every_primitive_struct" => Ok(Reducer::InsertOptionEveryPrimitiveStruct( - __sdk::spacetime_module::parse_reducer_args("insert_option_every_primitive_struct", &value.args)?, - )), - "insert_option_i32" => Ok(Reducer::InsertOptionI32(__sdk::spacetime_module::parse_reducer_args( - "insert_option_i32", - &value.args, - )?)), - "insert_option_identity" => Ok(Reducer::InsertOptionIdentity( - __sdk::spacetime_module::parse_reducer_args("insert_option_identity", &value.args)?, - )), - "insert_option_simple_enum" => Ok(Reducer::InsertOptionSimpleEnum( - __sdk::spacetime_module::parse_reducer_args("insert_option_simple_enum", &value.args)?, - )), - "insert_option_string" => Ok(Reducer::InsertOptionString( - __sdk::spacetime_module::parse_reducer_args("insert_option_string", &value.args)?, - )), - "insert_option_vec_option_i32" => Ok(Reducer::InsertOptionVecOptionI32( - __sdk::spacetime_module::parse_reducer_args("insert_option_vec_option_i32", &value.args)?, - )), - "insert_pk_address" => Ok(Reducer::InsertPkAddress(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_address", - &value.args, - )?)), - "insert_pk_bool" => Ok(Reducer::InsertPkBool(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_bool", - &value.args, - )?)), - "insert_pk_i128" => Ok(Reducer::InsertPkI128(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_i128", - &value.args, - )?)), - "insert_pk_i16" => Ok(Reducer::InsertPkI16(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_i16", - &value.args, - )?)), - "insert_pk_i256" => Ok(Reducer::InsertPkI256(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_i256", - &value.args, - )?)), - "insert_pk_i32" => Ok(Reducer::InsertPkI32(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_i32", - &value.args, - )?)), - "insert_pk_i64" => Ok(Reducer::InsertPkI64(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_i64", - &value.args, - )?)), - "insert_pk_i8" => Ok(Reducer::InsertPkI8(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_i8", - &value.args, - )?)), - "insert_pk_identity" => Ok(Reducer::InsertPkIdentity(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_identity", - &value.args, - )?)), - "insert_pk_string" => Ok(Reducer::InsertPkString(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_string", - &value.args, - )?)), - "insert_pk_u128" => Ok(Reducer::InsertPkU128(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_u128", - &value.args, - )?)), - "insert_pk_u16" => Ok(Reducer::InsertPkU16(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_u16", - &value.args, - )?)), - "insert_pk_u256" => Ok(Reducer::InsertPkU256(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_u256", - &value.args, - )?)), - "insert_pk_u32" => Ok(Reducer::InsertPkU32(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_u32", - &value.args, - )?)), - "insert_pk_u64" => Ok(Reducer::InsertPkU64(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_u64", - &value.args, - )?)), - "insert_pk_u8" => Ok(Reducer::InsertPkU8(__sdk::spacetime_module::parse_reducer_args( - "insert_pk_u8", - &value.args, - )?)), - "insert_primitives_as_strings" => Ok(Reducer::InsertPrimitivesAsStrings( - __sdk::spacetime_module::parse_reducer_args("insert_primitives_as_strings", &value.args)?, - )), - "insert_table_holds_table" => Ok(Reducer::InsertTableHoldsTable( - __sdk::spacetime_module::parse_reducer_args("insert_table_holds_table", &value.args)?, - )), - "insert_unique_address" => Ok(Reducer::InsertUniqueAddress( - __sdk::spacetime_module::parse_reducer_args("insert_unique_address", &value.args)?, - )), - "insert_unique_bool" => Ok(Reducer::InsertUniqueBool(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_bool", - &value.args, - )?)), - "insert_unique_i128" => Ok(Reducer::InsertUniqueI128(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_i128", - &value.args, - )?)), - "insert_unique_i16" => Ok(Reducer::InsertUniqueI16(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_i16", - &value.args, - )?)), - "insert_unique_i256" => Ok(Reducer::InsertUniqueI256(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_i256", - &value.args, - )?)), - "insert_unique_i32" => Ok(Reducer::InsertUniqueI32(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_i32", - &value.args, - )?)), - "insert_unique_i64" => Ok(Reducer::InsertUniqueI64(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_i64", - &value.args, - )?)), - "insert_unique_i8" => Ok(Reducer::InsertUniqueI8(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_i8", - &value.args, - )?)), - "insert_unique_identity" => Ok(Reducer::InsertUniqueIdentity( - __sdk::spacetime_module::parse_reducer_args("insert_unique_identity", &value.args)?, - )), - "insert_unique_string" => Ok(Reducer::InsertUniqueString( - __sdk::spacetime_module::parse_reducer_args("insert_unique_string", &value.args)?, - )), - "insert_unique_u128" => Ok(Reducer::InsertUniqueU128(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_u128", - &value.args, - )?)), - "insert_unique_u16" => Ok(Reducer::InsertUniqueU16(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_u16", - &value.args, - )?)), - "insert_unique_u256" => Ok(Reducer::InsertUniqueU256(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_u256", - &value.args, - )?)), - "insert_unique_u32" => Ok(Reducer::InsertUniqueU32(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_u32", - &value.args, - )?)), - "insert_unique_u64" => Ok(Reducer::InsertUniqueU64(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_u64", - &value.args, - )?)), - "insert_unique_u8" => Ok(Reducer::InsertUniqueU8(__sdk::spacetime_module::parse_reducer_args( - "insert_unique_u8", - &value.args, - )?)), - "insert_vec_address" => Ok(Reducer::InsertVecAddress(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_address", - &value.args, - )?)), - "insert_vec_bool" => Ok(Reducer::InsertVecBool(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_bool", - &value.args, - )?)), - "insert_vec_byte_struct" => Ok(Reducer::InsertVecByteStruct( - __sdk::spacetime_module::parse_reducer_args("insert_vec_byte_struct", &value.args)?, - )), - "insert_vec_enum_with_payload" => Ok(Reducer::InsertVecEnumWithPayload( - __sdk::spacetime_module::parse_reducer_args("insert_vec_enum_with_payload", &value.args)?, - )), - "insert_vec_every_primitive_struct" => Ok(Reducer::InsertVecEveryPrimitiveStruct( - __sdk::spacetime_module::parse_reducer_args("insert_vec_every_primitive_struct", &value.args)?, - )), - "insert_vec_every_vec_struct" => Ok(Reducer::InsertVecEveryVecStruct( - __sdk::spacetime_module::parse_reducer_args("insert_vec_every_vec_struct", &value.args)?, - )), - "insert_vec_f32" => Ok(Reducer::InsertVecF32(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_f32", - &value.args, - )?)), - "insert_vec_f64" => Ok(Reducer::InsertVecF64(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_f64", - &value.args, - )?)), - "insert_vec_i128" => Ok(Reducer::InsertVecI128(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_i128", - &value.args, - )?)), - "insert_vec_i16" => Ok(Reducer::InsertVecI16(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_i16", - &value.args, - )?)), - "insert_vec_i256" => Ok(Reducer::InsertVecI256(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_i256", - &value.args, - )?)), - "insert_vec_i32" => Ok(Reducer::InsertVecI32(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_i32", - &value.args, - )?)), - "insert_vec_i64" => Ok(Reducer::InsertVecI64(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_i64", - &value.args, - )?)), - "insert_vec_i8" => Ok(Reducer::InsertVecI8(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_i8", - &value.args, - )?)), - "insert_vec_identity" => Ok(Reducer::InsertVecIdentity(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_identity", - &value.args, - )?)), - "insert_vec_simple_enum" => Ok(Reducer::InsertVecSimpleEnum( - __sdk::spacetime_module::parse_reducer_args("insert_vec_simple_enum", &value.args)?, - )), - "insert_vec_string" => Ok(Reducer::InsertVecString(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_string", - &value.args, - )?)), - "insert_vec_u128" => Ok(Reducer::InsertVecU128(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_u128", - &value.args, - )?)), - "insert_vec_u16" => Ok(Reducer::InsertVecU16(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_u16", - &value.args, - )?)), - "insert_vec_u256" => Ok(Reducer::InsertVecU256(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_u256", - &value.args, - )?)), - "insert_vec_u32" => Ok(Reducer::InsertVecU32(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_u32", - &value.args, - )?)), - "insert_vec_u64" => Ok(Reducer::InsertVecU64(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_u64", - &value.args, - )?)), - "insert_vec_u8" => Ok(Reducer::InsertVecU8(__sdk::spacetime_module::parse_reducer_args( - "insert_vec_u8", - &value.args, - )?)), - "insert_vec_unit_struct" => Ok(Reducer::InsertVecUnitStruct( - __sdk::spacetime_module::parse_reducer_args("insert_vec_unit_struct", &value.args)?, - )), - "no_op_succeeds" => Ok(Reducer::NoOpSucceeds(__sdk::spacetime_module::parse_reducer_args( - "no_op_succeeds", - &value.args, - )?)), - "update_pk_address" => Ok(Reducer::UpdatePkAddress(__sdk::spacetime_module::parse_reducer_args( - "update_pk_address", - &value.args, - )?)), - "update_pk_bool" => Ok(Reducer::UpdatePkBool(__sdk::spacetime_module::parse_reducer_args( - "update_pk_bool", - &value.args, - )?)), - "update_pk_i128" => Ok(Reducer::UpdatePkI128(__sdk::spacetime_module::parse_reducer_args( - "update_pk_i128", - &value.args, - )?)), - "update_pk_i16" => Ok(Reducer::UpdatePkI16(__sdk::spacetime_module::parse_reducer_args( - "update_pk_i16", - &value.args, - )?)), - "update_pk_i256" => Ok(Reducer::UpdatePkI256(__sdk::spacetime_module::parse_reducer_args( - "update_pk_i256", - &value.args, - )?)), - "update_pk_i32" => Ok(Reducer::UpdatePkI32(__sdk::spacetime_module::parse_reducer_args( - "update_pk_i32", - &value.args, - )?)), - "update_pk_i64" => Ok(Reducer::UpdatePkI64(__sdk::spacetime_module::parse_reducer_args( - "update_pk_i64", - &value.args, - )?)), - "update_pk_i8" => Ok(Reducer::UpdatePkI8(__sdk::spacetime_module::parse_reducer_args( - "update_pk_i8", - &value.args, - )?)), - "update_pk_identity" => Ok(Reducer::UpdatePkIdentity(__sdk::spacetime_module::parse_reducer_args( - "update_pk_identity", - &value.args, - )?)), - "update_pk_string" => Ok(Reducer::UpdatePkString(__sdk::spacetime_module::parse_reducer_args( - "update_pk_string", - &value.args, - )?)), - "update_pk_u128" => Ok(Reducer::UpdatePkU128(__sdk::spacetime_module::parse_reducer_args( - "update_pk_u128", - &value.args, - )?)), - "update_pk_u16" => Ok(Reducer::UpdatePkU16(__sdk::spacetime_module::parse_reducer_args( - "update_pk_u16", - &value.args, - )?)), - "update_pk_u256" => Ok(Reducer::UpdatePkU256(__sdk::spacetime_module::parse_reducer_args( - "update_pk_u256", - &value.args, - )?)), - "update_pk_u32" => Ok(Reducer::UpdatePkU32(__sdk::spacetime_module::parse_reducer_args( - "update_pk_u32", - &value.args, - )?)), - "update_pk_u64" => Ok(Reducer::UpdatePkU64(__sdk::spacetime_module::parse_reducer_args( - "update_pk_u64", - &value.args, - )?)), - "update_pk_u8" => Ok(Reducer::UpdatePkU8(__sdk::spacetime_module::parse_reducer_args( - "update_pk_u8", - &value.args, - )?)), - "update_unique_address" => Ok(Reducer::UpdateUniqueAddress( - __sdk::spacetime_module::parse_reducer_args("update_unique_address", &value.args)?, - )), - "update_unique_bool" => Ok(Reducer::UpdateUniqueBool(__sdk::spacetime_module::parse_reducer_args( - "update_unique_bool", - &value.args, - )?)), - "update_unique_i128" => Ok(Reducer::UpdateUniqueI128(__sdk::spacetime_module::parse_reducer_args( - "update_unique_i128", - &value.args, - )?)), - "update_unique_i16" => Ok(Reducer::UpdateUniqueI16(__sdk::spacetime_module::parse_reducer_args( - "update_unique_i16", - &value.args, - )?)), - "update_unique_i256" => Ok(Reducer::UpdateUniqueI256(__sdk::spacetime_module::parse_reducer_args( - "update_unique_i256", - &value.args, - )?)), - "update_unique_i32" => Ok(Reducer::UpdateUniqueI32(__sdk::spacetime_module::parse_reducer_args( - "update_unique_i32", - &value.args, - )?)), - "update_unique_i64" => Ok(Reducer::UpdateUniqueI64(__sdk::spacetime_module::parse_reducer_args( - "update_unique_i64", - &value.args, - )?)), - "update_unique_i8" => Ok(Reducer::UpdateUniqueI8(__sdk::spacetime_module::parse_reducer_args( - "update_unique_i8", - &value.args, - )?)), - "update_unique_identity" => Ok(Reducer::UpdateUniqueIdentity( - __sdk::spacetime_module::parse_reducer_args("update_unique_identity", &value.args)?, - )), - "update_unique_string" => Ok(Reducer::UpdateUniqueString( - __sdk::spacetime_module::parse_reducer_args("update_unique_string", &value.args)?, - )), - "update_unique_u128" => Ok(Reducer::UpdateUniqueU128(__sdk::spacetime_module::parse_reducer_args( - "update_unique_u128", - &value.args, - )?)), - "update_unique_u16" => Ok(Reducer::UpdateUniqueU16(__sdk::spacetime_module::parse_reducer_args( - "update_unique_u16", - &value.args, - )?)), - "update_unique_u256" => Ok(Reducer::UpdateUniqueU256(__sdk::spacetime_module::parse_reducer_args( - "update_unique_u256", - &value.args, - )?)), - "update_unique_u32" => Ok(Reducer::UpdateUniqueU32(__sdk::spacetime_module::parse_reducer_args( - "update_unique_u32", - &value.args, - )?)), - "update_unique_u64" => Ok(Reducer::UpdateUniqueU64(__sdk::spacetime_module::parse_reducer_args( - "update_unique_u64", - &value.args, - )?)), - "update_unique_u8" => Ok(Reducer::UpdateUniqueU8(__sdk::spacetime_module::parse_reducer_args( - "update_unique_u8", - &value.args, - )?)), - _ => Err(__anyhow::anyhow!("Unknown reducer {:?}", value.reducer_name)), + fn parse_call_info( + reducer_id_to_idx: &impl Fn(__ws::ReducerId) -> anyhow::Result, + raw: __ws::ReducerCallInfo<__ws::BsatnFormat>, + ) -> anyhow::Result { + use __sdk::spacetime_module::parse_reducer_args; + let reducer_idx = reducer_id_to_idx(raw.reducer_id)?; + let name = Self::reducer_names()[reducer_idx as usize]; + match reducer_id_to_idx(raw.reducer_id)? { + 0 => Ok(Reducer::DeletePkAddress(parse_reducer_args(name, &raw.args)?)), + 1 => Ok(Reducer::DeletePkBool(parse_reducer_args(name, &raw.args)?)), + 2 => Ok(Reducer::DeletePkI128(parse_reducer_args(name, &raw.args)?)), + 3 => Ok(Reducer::DeletePkI16(parse_reducer_args(name, &raw.args)?)), + 4 => Ok(Reducer::DeletePkI256(parse_reducer_args(name, &raw.args)?)), + 5 => Ok(Reducer::DeletePkI32(parse_reducer_args(name, &raw.args)?)), + 6 => Ok(Reducer::DeletePkI64(parse_reducer_args(name, &raw.args)?)), + 7 => Ok(Reducer::DeletePkI8(parse_reducer_args(name, &raw.args)?)), + 8 => Ok(Reducer::DeletePkIdentity(parse_reducer_args(name, &raw.args)?)), + 9 => Ok(Reducer::DeletePkString(parse_reducer_args(name, &raw.args)?)), + 10 => Ok(Reducer::DeletePkU128(parse_reducer_args(name, &raw.args)?)), + 11 => Ok(Reducer::DeletePkU16(parse_reducer_args(name, &raw.args)?)), + 12 => Ok(Reducer::DeletePkU256(parse_reducer_args(name, &raw.args)?)), + 13 => Ok(Reducer::DeletePkU32(parse_reducer_args(name, &raw.args)?)), + 14 => Ok(Reducer::DeletePkU64(parse_reducer_args(name, &raw.args)?)), + 15 => Ok(Reducer::DeletePkU8(parse_reducer_args(name, &raw.args)?)), + 16 => Ok(Reducer::DeleteUniqueAddress(parse_reducer_args(name, &raw.args)?)), + 17 => Ok(Reducer::DeleteUniqueBool(parse_reducer_args(name, &raw.args)?)), + 18 => Ok(Reducer::DeleteUniqueI128(parse_reducer_args(name, &raw.args)?)), + 19 => Ok(Reducer::DeleteUniqueI16(parse_reducer_args(name, &raw.args)?)), + 20 => Ok(Reducer::DeleteUniqueI256(parse_reducer_args(name, &raw.args)?)), + 21 => Ok(Reducer::DeleteUniqueI32(parse_reducer_args(name, &raw.args)?)), + 22 => Ok(Reducer::DeleteUniqueI64(parse_reducer_args(name, &raw.args)?)), + 23 => Ok(Reducer::DeleteUniqueI8(parse_reducer_args(name, &raw.args)?)), + 24 => Ok(Reducer::DeleteUniqueIdentity(parse_reducer_args(name, &raw.args)?)), + 25 => Ok(Reducer::DeleteUniqueString(parse_reducer_args(name, &raw.args)?)), + 26 => Ok(Reducer::DeleteUniqueU128(parse_reducer_args(name, &raw.args)?)), + 27 => Ok(Reducer::DeleteUniqueU16(parse_reducer_args(name, &raw.args)?)), + 28 => Ok(Reducer::DeleteUniqueU256(parse_reducer_args(name, &raw.args)?)), + 29 => Ok(Reducer::DeleteUniqueU32(parse_reducer_args(name, &raw.args)?)), + 30 => Ok(Reducer::DeleteUniqueU64(parse_reducer_args(name, &raw.args)?)), + 31 => Ok(Reducer::DeleteUniqueU8(parse_reducer_args(name, &raw.args)?)), + 32 => Ok(Reducer::InsertCallerOneAddress(parse_reducer_args(name, &raw.args)?)), + 33 => Ok(Reducer::InsertCallerOneIdentity(parse_reducer_args(name, &raw.args)?)), + 34 => Ok(Reducer::InsertCallerPkAddress(parse_reducer_args(name, &raw.args)?)), + 35 => Ok(Reducer::InsertCallerPkIdentity(parse_reducer_args(name, &raw.args)?)), + 36 => Ok(Reducer::InsertCallerUniqueAddress(parse_reducer_args(name, &raw.args)?)), + 37 => Ok(Reducer::InsertCallerUniqueIdentity(parse_reducer_args( + name, &raw.args, + )?)), + 38 => Ok(Reducer::InsertCallerVecAddress(parse_reducer_args(name, &raw.args)?)), + 39 => Ok(Reducer::InsertCallerVecIdentity(parse_reducer_args(name, &raw.args)?)), + 40 => Ok(Reducer::InsertLargeTable(parse_reducer_args(name, &raw.args)?)), + 41 => Ok(Reducer::InsertOneAddress(parse_reducer_args(name, &raw.args)?)), + 42 => Ok(Reducer::InsertOneBool(parse_reducer_args(name, &raw.args)?)), + 43 => Ok(Reducer::InsertOneByteStruct(parse_reducer_args(name, &raw.args)?)), + 44 => Ok(Reducer::InsertOneEnumWithPayload(parse_reducer_args(name, &raw.args)?)), + 45 => Ok(Reducer::InsertOneEveryPrimitiveStruct(parse_reducer_args( + name, &raw.args, + )?)), + 46 => Ok(Reducer::InsertOneEveryVecStruct(parse_reducer_args(name, &raw.args)?)), + 47 => Ok(Reducer::InsertOneF32(parse_reducer_args(name, &raw.args)?)), + 48 => Ok(Reducer::InsertOneF64(parse_reducer_args(name, &raw.args)?)), + 49 => Ok(Reducer::InsertOneI128(parse_reducer_args(name, &raw.args)?)), + 50 => Ok(Reducer::InsertOneI16(parse_reducer_args(name, &raw.args)?)), + 51 => Ok(Reducer::InsertOneI256(parse_reducer_args(name, &raw.args)?)), + 52 => Ok(Reducer::InsertOneI32(parse_reducer_args(name, &raw.args)?)), + 53 => Ok(Reducer::InsertOneI64(parse_reducer_args(name, &raw.args)?)), + 54 => Ok(Reducer::InsertOneI8(parse_reducer_args(name, &raw.args)?)), + 55 => Ok(Reducer::InsertOneIdentity(parse_reducer_args(name, &raw.args)?)), + 56 => Ok(Reducer::InsertOneSimpleEnum(parse_reducer_args(name, &raw.args)?)), + 57 => Ok(Reducer::InsertOneString(parse_reducer_args(name, &raw.args)?)), + 58 => Ok(Reducer::InsertOneU128(parse_reducer_args(name, &raw.args)?)), + 59 => Ok(Reducer::InsertOneU16(parse_reducer_args(name, &raw.args)?)), + 60 => Ok(Reducer::InsertOneU256(parse_reducer_args(name, &raw.args)?)), + 61 => Ok(Reducer::InsertOneU32(parse_reducer_args(name, &raw.args)?)), + 62 => Ok(Reducer::InsertOneU64(parse_reducer_args(name, &raw.args)?)), + 63 => Ok(Reducer::InsertOneU8(parse_reducer_args(name, &raw.args)?)), + 64 => Ok(Reducer::InsertOneUnitStruct(parse_reducer_args(name, &raw.args)?)), + 65 => Ok(Reducer::InsertOptionEveryPrimitiveStruct(parse_reducer_args( + name, &raw.args, + )?)), + 66 => Ok(Reducer::InsertOptionI32(parse_reducer_args(name, &raw.args)?)), + 67 => Ok(Reducer::InsertOptionIdentity(parse_reducer_args(name, &raw.args)?)), + 68 => Ok(Reducer::InsertOptionSimpleEnum(parse_reducer_args(name, &raw.args)?)), + 69 => Ok(Reducer::InsertOptionString(parse_reducer_args(name, &raw.args)?)), + 70 => Ok(Reducer::InsertOptionVecOptionI32(parse_reducer_args(name, &raw.args)?)), + 71 => Ok(Reducer::InsertPkAddress(parse_reducer_args(name, &raw.args)?)), + 72 => Ok(Reducer::InsertPkBool(parse_reducer_args(name, &raw.args)?)), + 73 => Ok(Reducer::InsertPkI128(parse_reducer_args(name, &raw.args)?)), + 74 => Ok(Reducer::InsertPkI16(parse_reducer_args(name, &raw.args)?)), + 75 => Ok(Reducer::InsertPkI256(parse_reducer_args(name, &raw.args)?)), + 76 => Ok(Reducer::InsertPkI32(parse_reducer_args(name, &raw.args)?)), + 77 => Ok(Reducer::InsertPkI64(parse_reducer_args(name, &raw.args)?)), + 78 => Ok(Reducer::InsertPkI8(parse_reducer_args(name, &raw.args)?)), + 79 => Ok(Reducer::InsertPkIdentity(parse_reducer_args(name, &raw.args)?)), + 80 => Ok(Reducer::InsertPkString(parse_reducer_args(name, &raw.args)?)), + 81 => Ok(Reducer::InsertPkU128(parse_reducer_args(name, &raw.args)?)), + 82 => Ok(Reducer::InsertPkU16(parse_reducer_args(name, &raw.args)?)), + 83 => Ok(Reducer::InsertPkU256(parse_reducer_args(name, &raw.args)?)), + 84 => Ok(Reducer::InsertPkU32(parse_reducer_args(name, &raw.args)?)), + 85 => Ok(Reducer::InsertPkU64(parse_reducer_args(name, &raw.args)?)), + 86 => Ok(Reducer::InsertPkU8(parse_reducer_args(name, &raw.args)?)), + 87 => Ok(Reducer::InsertPrimitivesAsStrings(parse_reducer_args(name, &raw.args)?)), + 88 => Ok(Reducer::InsertTableHoldsTable(parse_reducer_args(name, &raw.args)?)), + 89 => Ok(Reducer::InsertUniqueAddress(parse_reducer_args(name, &raw.args)?)), + 90 => Ok(Reducer::InsertUniqueBool(parse_reducer_args(name, &raw.args)?)), + 91 => Ok(Reducer::InsertUniqueI128(parse_reducer_args(name, &raw.args)?)), + 92 => Ok(Reducer::InsertUniqueI16(parse_reducer_args(name, &raw.args)?)), + 93 => Ok(Reducer::InsertUniqueI256(parse_reducer_args(name, &raw.args)?)), + 94 => Ok(Reducer::InsertUniqueI32(parse_reducer_args(name, &raw.args)?)), + 95 => Ok(Reducer::InsertUniqueI64(parse_reducer_args(name, &raw.args)?)), + 96 => Ok(Reducer::InsertUniqueI8(parse_reducer_args(name, &raw.args)?)), + 97 => Ok(Reducer::InsertUniqueIdentity(parse_reducer_args(name, &raw.args)?)), + 98 => Ok(Reducer::InsertUniqueString(parse_reducer_args(name, &raw.args)?)), + 99 => Ok(Reducer::InsertUniqueU128(parse_reducer_args(name, &raw.args)?)), + 100 => Ok(Reducer::InsertUniqueU16(parse_reducer_args(name, &raw.args)?)), + 101 => Ok(Reducer::InsertUniqueU256(parse_reducer_args(name, &raw.args)?)), + 102 => Ok(Reducer::InsertUniqueU32(parse_reducer_args(name, &raw.args)?)), + 103 => Ok(Reducer::InsertUniqueU64(parse_reducer_args(name, &raw.args)?)), + 104 => Ok(Reducer::InsertUniqueU8(parse_reducer_args(name, &raw.args)?)), + 105 => Ok(Reducer::InsertVecAddress(parse_reducer_args(name, &raw.args)?)), + 106 => Ok(Reducer::InsertVecBool(parse_reducer_args(name, &raw.args)?)), + 107 => Ok(Reducer::InsertVecByteStruct(parse_reducer_args(name, &raw.args)?)), + 108 => Ok(Reducer::InsertVecEnumWithPayload(parse_reducer_args(name, &raw.args)?)), + 109 => Ok(Reducer::InsertVecEveryPrimitiveStruct(parse_reducer_args( + name, &raw.args, + )?)), + 110 => Ok(Reducer::InsertVecEveryVecStruct(parse_reducer_args(name, &raw.args)?)), + 111 => Ok(Reducer::InsertVecF32(parse_reducer_args(name, &raw.args)?)), + 112 => Ok(Reducer::InsertVecF64(parse_reducer_args(name, &raw.args)?)), + 113 => Ok(Reducer::InsertVecI128(parse_reducer_args(name, &raw.args)?)), + 114 => Ok(Reducer::InsertVecI16(parse_reducer_args(name, &raw.args)?)), + 115 => Ok(Reducer::InsertVecI256(parse_reducer_args(name, &raw.args)?)), + 116 => Ok(Reducer::InsertVecI32(parse_reducer_args(name, &raw.args)?)), + 117 => Ok(Reducer::InsertVecI64(parse_reducer_args(name, &raw.args)?)), + 118 => Ok(Reducer::InsertVecI8(parse_reducer_args(name, &raw.args)?)), + 119 => Ok(Reducer::InsertVecIdentity(parse_reducer_args(name, &raw.args)?)), + 120 => Ok(Reducer::InsertVecSimpleEnum(parse_reducer_args(name, &raw.args)?)), + 121 => Ok(Reducer::InsertVecString(parse_reducer_args(name, &raw.args)?)), + 122 => Ok(Reducer::InsertVecU128(parse_reducer_args(name, &raw.args)?)), + 123 => Ok(Reducer::InsertVecU16(parse_reducer_args(name, &raw.args)?)), + 124 => Ok(Reducer::InsertVecU256(parse_reducer_args(name, &raw.args)?)), + 125 => Ok(Reducer::InsertVecU32(parse_reducer_args(name, &raw.args)?)), + 126 => Ok(Reducer::InsertVecU64(parse_reducer_args(name, &raw.args)?)), + 127 => Ok(Reducer::InsertVecU8(parse_reducer_args(name, &raw.args)?)), + 128 => Ok(Reducer::InsertVecUnitStruct(parse_reducer_args(name, &raw.args)?)), + 129 => Ok(Reducer::NoOpSucceeds(parse_reducer_args(name, &raw.args)?)), + 130 => Ok(Reducer::UpdatePkAddress(parse_reducer_args(name, &raw.args)?)), + 131 => Ok(Reducer::UpdatePkBool(parse_reducer_args(name, &raw.args)?)), + 132 => Ok(Reducer::UpdatePkI128(parse_reducer_args(name, &raw.args)?)), + 133 => Ok(Reducer::UpdatePkI16(parse_reducer_args(name, &raw.args)?)), + 134 => Ok(Reducer::UpdatePkI256(parse_reducer_args(name, &raw.args)?)), + 135 => Ok(Reducer::UpdatePkI32(parse_reducer_args(name, &raw.args)?)), + 136 => Ok(Reducer::UpdatePkI64(parse_reducer_args(name, &raw.args)?)), + 137 => Ok(Reducer::UpdatePkI8(parse_reducer_args(name, &raw.args)?)), + 138 => Ok(Reducer::UpdatePkIdentity(parse_reducer_args(name, &raw.args)?)), + 139 => Ok(Reducer::UpdatePkString(parse_reducer_args(name, &raw.args)?)), + 140 => Ok(Reducer::UpdatePkU128(parse_reducer_args(name, &raw.args)?)), + 141 => Ok(Reducer::UpdatePkU16(parse_reducer_args(name, &raw.args)?)), + 142 => Ok(Reducer::UpdatePkU256(parse_reducer_args(name, &raw.args)?)), + 143 => Ok(Reducer::UpdatePkU32(parse_reducer_args(name, &raw.args)?)), + 144 => Ok(Reducer::UpdatePkU64(parse_reducer_args(name, &raw.args)?)), + 145 => Ok(Reducer::UpdatePkU8(parse_reducer_args(name, &raw.args)?)), + 146 => Ok(Reducer::UpdateUniqueAddress(parse_reducer_args(name, &raw.args)?)), + 147 => Ok(Reducer::UpdateUniqueBool(parse_reducer_args(name, &raw.args)?)), + 148 => Ok(Reducer::UpdateUniqueI128(parse_reducer_args(name, &raw.args)?)), + 149 => Ok(Reducer::UpdateUniqueI16(parse_reducer_args(name, &raw.args)?)), + 150 => Ok(Reducer::UpdateUniqueI256(parse_reducer_args(name, &raw.args)?)), + 151 => Ok(Reducer::UpdateUniqueI32(parse_reducer_args(name, &raw.args)?)), + 152 => Ok(Reducer::UpdateUniqueI64(parse_reducer_args(name, &raw.args)?)), + 153 => Ok(Reducer::UpdateUniqueI8(parse_reducer_args(name, &raw.args)?)), + 154 => Ok(Reducer::UpdateUniqueIdentity(parse_reducer_args(name, &raw.args)?)), + 155 => Ok(Reducer::UpdateUniqueString(parse_reducer_args(name, &raw.args)?)), + 156 => Ok(Reducer::UpdateUniqueU128(parse_reducer_args(name, &raw.args)?)), + 157 => Ok(Reducer::UpdateUniqueU16(parse_reducer_args(name, &raw.args)?)), + 158 => Ok(Reducer::UpdateUniqueU256(parse_reducer_args(name, &raw.args)?)), + 159 => Ok(Reducer::UpdateUniqueU32(parse_reducer_args(name, &raw.args)?)), + 160 => Ok(Reducer::UpdateUniqueU64(parse_reducer_args(name, &raw.args)?)), + 161 => Ok(Reducer::UpdateUniqueU8(parse_reducer_args(name, &raw.args)?)), + _ => unreachable!(), } } + fn reducer_names() -> &'static [&'static str] { + &[ + "delete_pk_address", + "delete_pk_bool", + "delete_pk_i128", + "delete_pk_i16", + "delete_pk_i256", + "delete_pk_i32", + "delete_pk_i64", + "delete_pk_i8", + "delete_pk_identity", + "delete_pk_string", + "delete_pk_u128", + "delete_pk_u16", + "delete_pk_u256", + "delete_pk_u32", + "delete_pk_u64", + "delete_pk_u8", + "delete_unique_address", + "delete_unique_bool", + "delete_unique_i128", + "delete_unique_i16", + "delete_unique_i256", + "delete_unique_i32", + "delete_unique_i64", + "delete_unique_i8", + "delete_unique_identity", + "delete_unique_string", + "delete_unique_u128", + "delete_unique_u16", + "delete_unique_u256", + "delete_unique_u32", + "delete_unique_u64", + "delete_unique_u8", + "insert_caller_one_address", + "insert_caller_one_identity", + "insert_caller_pk_address", + "insert_caller_pk_identity", + "insert_caller_unique_address", + "insert_caller_unique_identity", + "insert_caller_vec_address", + "insert_caller_vec_identity", + "insert_large_table", + "insert_one_address", + "insert_one_bool", + "insert_one_byte_struct", + "insert_one_enum_with_payload", + "insert_one_every_primitive_struct", + "insert_one_every_vec_struct", + "insert_one_f32", + "insert_one_f64", + "insert_one_i128", + "insert_one_i16", + "insert_one_i256", + "insert_one_i32", + "insert_one_i64", + "insert_one_i8", + "insert_one_identity", + "insert_one_simple_enum", + "insert_one_string", + "insert_one_u128", + "insert_one_u16", + "insert_one_u256", + "insert_one_u32", + "insert_one_u64", + "insert_one_u8", + "insert_one_unit_struct", + "insert_option_every_primitive_struct", + "insert_option_i32", + "insert_option_identity", + "insert_option_simple_enum", + "insert_option_string", + "insert_option_vec_option_i32", + "insert_pk_address", + "insert_pk_bool", + "insert_pk_i128", + "insert_pk_i16", + "insert_pk_i256", + "insert_pk_i32", + "insert_pk_i64", + "insert_pk_i8", + "insert_pk_identity", + "insert_pk_string", + "insert_pk_u128", + "insert_pk_u16", + "insert_pk_u256", + "insert_pk_u32", + "insert_pk_u64", + "insert_pk_u8", + "insert_primitives_as_strings", + "insert_table_holds_table", + "insert_unique_address", + "insert_unique_bool", + "insert_unique_i128", + "insert_unique_i16", + "insert_unique_i256", + "insert_unique_i32", + "insert_unique_i64", + "insert_unique_i8", + "insert_unique_identity", + "insert_unique_string", + "insert_unique_u128", + "insert_unique_u16", + "insert_unique_u256", + "insert_unique_u32", + "insert_unique_u64", + "insert_unique_u8", + "insert_vec_address", + "insert_vec_bool", + "insert_vec_byte_struct", + "insert_vec_enum_with_payload", + "insert_vec_every_primitive_struct", + "insert_vec_every_vec_struct", + "insert_vec_f32", + "insert_vec_f64", + "insert_vec_i128", + "insert_vec_i16", + "insert_vec_i256", + "insert_vec_i32", + "insert_vec_i64", + "insert_vec_i8", + "insert_vec_identity", + "insert_vec_simple_enum", + "insert_vec_string", + "insert_vec_u128", + "insert_vec_u16", + "insert_vec_u256", + "insert_vec_u32", + "insert_vec_u64", + "insert_vec_u8", + "insert_vec_unit_struct", + "no_op_succeeds", + "update_pk_address", + "update_pk_bool", + "update_pk_i128", + "update_pk_i16", + "update_pk_i256", + "update_pk_i32", + "update_pk_i64", + "update_pk_i8", + "update_pk_identity", + "update_pk_string", + "update_pk_u128", + "update_pk_u16", + "update_pk_u256", + "update_pk_u32", + "update_pk_u64", + "update_pk_u8", + "update_unique_address", + "update_unique_bool", + "update_unique_i128", + "update_unique_i16", + "update_unique_i256", + "update_unique_i32", + "update_unique_i64", + "update_unique_i8", + "update_unique_identity", + "update_unique_string", + "update_unique_u128", + "update_unique_u16", + "update_unique_u256", + "update_unique_u32", + "update_unique_u64", + "update_unique_u8", + ] + } } #[derive(Default)] @@ -1924,372 +1651,398 @@ pub struct DbUpdate { vec_unit_struct: __sdk::spacetime_module::TableUpdate, } -impl TryFrom<__ws::DatabaseUpdate<__ws::BsatnFormat>> for DbUpdate { - type Error = __anyhow::Error; - fn try_from(raw: __ws::DatabaseUpdate<__ws::BsatnFormat>) -> Result { +impl __sdk::spacetime_module::InModule for DbUpdate { + type Module = RemoteModule; +} + +impl __sdk::spacetime_module::DbUpdate for DbUpdate { + fn apply_to_client_cache(&self, cache: &mut __sdk::client_cache::ClientCache) { + cache.apply_diff_to_table::(0, &self.large_table); + cache.apply_diff_to_table::(1, &self.one_address); + cache.apply_diff_to_table::(2, &self.one_bool); + cache.apply_diff_to_table::(3, &self.one_byte_struct); + cache.apply_diff_to_table::(4, &self.one_enum_with_payload); + cache.apply_diff_to_table::(5, &self.one_every_primitive_struct); + cache.apply_diff_to_table::(6, &self.one_every_vec_struct); + cache.apply_diff_to_table::(7, &self.one_f_32); + cache.apply_diff_to_table::(8, &self.one_f_64); + cache.apply_diff_to_table::(9, &self.one_i_128); + cache.apply_diff_to_table::(10, &self.one_i_16); + cache.apply_diff_to_table::(11, &self.one_i_256); + cache.apply_diff_to_table::(12, &self.one_i_32); + cache.apply_diff_to_table::(13, &self.one_i_64); + cache.apply_diff_to_table::(14, &self.one_i_8); + cache.apply_diff_to_table::(15, &self.one_identity); + cache.apply_diff_to_table::(16, &self.one_simple_enum); + cache.apply_diff_to_table::(17, &self.one_string); + cache.apply_diff_to_table::(18, &self.one_u_128); + cache.apply_diff_to_table::(19, &self.one_u_16); + cache.apply_diff_to_table::(20, &self.one_u_256); + cache.apply_diff_to_table::(21, &self.one_u_32); + cache.apply_diff_to_table::(22, &self.one_u_64); + cache.apply_diff_to_table::(23, &self.one_u_8); + cache.apply_diff_to_table::(24, &self.one_unit_struct); + cache.apply_diff_to_table::(25, &self.option_every_primitive_struct); + cache.apply_diff_to_table::(26, &self.option_i_32); + cache.apply_diff_to_table::(27, &self.option_identity); + cache.apply_diff_to_table::(28, &self.option_simple_enum); + cache.apply_diff_to_table::(29, &self.option_string); + cache.apply_diff_to_table::(30, &self.option_vec_option_i_32); + cache.apply_diff_to_table::(31, &self.pk_address); + cache.apply_diff_to_table::(32, &self.pk_bool); + cache.apply_diff_to_table::(33, &self.pk_i_128); + cache.apply_diff_to_table::(34, &self.pk_i_16); + cache.apply_diff_to_table::(35, &self.pk_i_256); + cache.apply_diff_to_table::(36, &self.pk_i_32); + cache.apply_diff_to_table::(37, &self.pk_i_64); + cache.apply_diff_to_table::(38, &self.pk_i_8); + cache.apply_diff_to_table::(39, &self.pk_identity); + cache.apply_diff_to_table::(40, &self.pk_string); + cache.apply_diff_to_table::(41, &self.pk_u_128); + cache.apply_diff_to_table::(42, &self.pk_u_16); + cache.apply_diff_to_table::(43, &self.pk_u_256); + cache.apply_diff_to_table::(44, &self.pk_u_32); + cache.apply_diff_to_table::(45, &self.pk_u_64); + cache.apply_diff_to_table::(46, &self.pk_u_8); + cache.apply_diff_to_table::(47, &self.table_holds_table); + cache.apply_diff_to_table::(48, &self.unique_address); + cache.apply_diff_to_table::(49, &self.unique_bool); + cache.apply_diff_to_table::(50, &self.unique_i_128); + cache.apply_diff_to_table::(51, &self.unique_i_16); + cache.apply_diff_to_table::(52, &self.unique_i_256); + cache.apply_diff_to_table::(53, &self.unique_i_32); + cache.apply_diff_to_table::(54, &self.unique_i_64); + cache.apply_diff_to_table::(55, &self.unique_i_8); + cache.apply_diff_to_table::(56, &self.unique_identity); + cache.apply_diff_to_table::(57, &self.unique_string); + cache.apply_diff_to_table::(58, &self.unique_u_128); + cache.apply_diff_to_table::(59, &self.unique_u_16); + cache.apply_diff_to_table::(60, &self.unique_u_256); + cache.apply_diff_to_table::(61, &self.unique_u_32); + cache.apply_diff_to_table::(62, &self.unique_u_64); + cache.apply_diff_to_table::(63, &self.unique_u_8); + cache.apply_diff_to_table::(64, &self.vec_address); + cache.apply_diff_to_table::(65, &self.vec_bool); + cache.apply_diff_to_table::(66, &self.vec_byte_struct); + cache.apply_diff_to_table::(67, &self.vec_enum_with_payload); + cache.apply_diff_to_table::(68, &self.vec_every_primitive_struct); + cache.apply_diff_to_table::(69, &self.vec_every_vec_struct); + cache.apply_diff_to_table::(70, &self.vec_f_32); + cache.apply_diff_to_table::(71, &self.vec_f_64); + cache.apply_diff_to_table::(72, &self.vec_i_128); + cache.apply_diff_to_table::(73, &self.vec_i_16); + cache.apply_diff_to_table::(74, &self.vec_i_256); + cache.apply_diff_to_table::(75, &self.vec_i_32); + cache.apply_diff_to_table::(76, &self.vec_i_64); + cache.apply_diff_to_table::(77, &self.vec_i_8); + cache.apply_diff_to_table::(78, &self.vec_identity); + cache.apply_diff_to_table::(79, &self.vec_simple_enum); + cache.apply_diff_to_table::(80, &self.vec_string); + cache.apply_diff_to_table::(81, &self.vec_u_128); + cache.apply_diff_to_table::(82, &self.vec_u_16); + cache.apply_diff_to_table::(83, &self.vec_u_256); + cache.apply_diff_to_table::(84, &self.vec_u_32); + cache.apply_diff_to_table::(85, &self.vec_u_64); + cache.apply_diff_to_table::(86, &self.vec_u_8); + cache.apply_diff_to_table::(87, &self.vec_unit_struct); + } + fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::callbacks::DbCallbacks) { + callbacks.invoke_table_row_callbacks::(0, &self.large_table, event); + callbacks.invoke_table_row_callbacks::(1, &self.one_address, event); + callbacks.invoke_table_row_callbacks::(2, &self.one_bool, event); + callbacks.invoke_table_row_callbacks::(3, &self.one_byte_struct, event); + callbacks.invoke_table_row_callbacks::(4, &self.one_enum_with_payload, event); + callbacks.invoke_table_row_callbacks::(5, &self.one_every_primitive_struct, event); + callbacks.invoke_table_row_callbacks::(6, &self.one_every_vec_struct, event); + callbacks.invoke_table_row_callbacks::(7, &self.one_f_32, event); + callbacks.invoke_table_row_callbacks::(8, &self.one_f_64, event); + callbacks.invoke_table_row_callbacks::(9, &self.one_i_128, event); + callbacks.invoke_table_row_callbacks::(10, &self.one_i_16, event); + callbacks.invoke_table_row_callbacks::(11, &self.one_i_256, event); + callbacks.invoke_table_row_callbacks::(12, &self.one_i_32, event); + callbacks.invoke_table_row_callbacks::(13, &self.one_i_64, event); + callbacks.invoke_table_row_callbacks::(14, &self.one_i_8, event); + callbacks.invoke_table_row_callbacks::(15, &self.one_identity, event); + callbacks.invoke_table_row_callbacks::(16, &self.one_simple_enum, event); + callbacks.invoke_table_row_callbacks::(17, &self.one_string, event); + callbacks.invoke_table_row_callbacks::(18, &self.one_u_128, event); + callbacks.invoke_table_row_callbacks::(19, &self.one_u_16, event); + callbacks.invoke_table_row_callbacks::(20, &self.one_u_256, event); + callbacks.invoke_table_row_callbacks::(21, &self.one_u_32, event); + callbacks.invoke_table_row_callbacks::(22, &self.one_u_64, event); + callbacks.invoke_table_row_callbacks::(23, &self.one_u_8, event); + callbacks.invoke_table_row_callbacks::(24, &self.one_unit_struct, event); + callbacks.invoke_table_row_callbacks::( + 25, + &self.option_every_primitive_struct, + event, + ); + callbacks.invoke_table_row_callbacks::(26, &self.option_i_32, event); + callbacks.invoke_table_row_callbacks::(27, &self.option_identity, event); + callbacks.invoke_table_row_callbacks::(28, &self.option_simple_enum, event); + callbacks.invoke_table_row_callbacks::(29, &self.option_string, event); + callbacks.invoke_table_row_callbacks::(30, &self.option_vec_option_i_32, event); + callbacks.invoke_table_row_callbacks::(31, &self.pk_address, event); + callbacks.invoke_table_row_callbacks::(32, &self.pk_bool, event); + callbacks.invoke_table_row_callbacks::(33, &self.pk_i_128, event); + callbacks.invoke_table_row_callbacks::(34, &self.pk_i_16, event); + callbacks.invoke_table_row_callbacks::(35, &self.pk_i_256, event); + callbacks.invoke_table_row_callbacks::(36, &self.pk_i_32, event); + callbacks.invoke_table_row_callbacks::(37, &self.pk_i_64, event); + callbacks.invoke_table_row_callbacks::(38, &self.pk_i_8, event); + callbacks.invoke_table_row_callbacks::(39, &self.pk_identity, event); + callbacks.invoke_table_row_callbacks::(40, &self.pk_string, event); + callbacks.invoke_table_row_callbacks::(41, &self.pk_u_128, event); + callbacks.invoke_table_row_callbacks::(42, &self.pk_u_16, event); + callbacks.invoke_table_row_callbacks::(43, &self.pk_u_256, event); + callbacks.invoke_table_row_callbacks::(44, &self.pk_u_32, event); + callbacks.invoke_table_row_callbacks::(45, &self.pk_u_64, event); + callbacks.invoke_table_row_callbacks::(46, &self.pk_u_8, event); + callbacks.invoke_table_row_callbacks::(47, &self.table_holds_table, event); + callbacks.invoke_table_row_callbacks::(48, &self.unique_address, event); + callbacks.invoke_table_row_callbacks::(49, &self.unique_bool, event); + callbacks.invoke_table_row_callbacks::(50, &self.unique_i_128, event); + callbacks.invoke_table_row_callbacks::(51, &self.unique_i_16, event); + callbacks.invoke_table_row_callbacks::(52, &self.unique_i_256, event); + callbacks.invoke_table_row_callbacks::(53, &self.unique_i_32, event); + callbacks.invoke_table_row_callbacks::(54, &self.unique_i_64, event); + callbacks.invoke_table_row_callbacks::(55, &self.unique_i_8, event); + callbacks.invoke_table_row_callbacks::(56, &self.unique_identity, event); + callbacks.invoke_table_row_callbacks::(57, &self.unique_string, event); + callbacks.invoke_table_row_callbacks::(58, &self.unique_u_128, event); + callbacks.invoke_table_row_callbacks::(59, &self.unique_u_16, event); + callbacks.invoke_table_row_callbacks::(60, &self.unique_u_256, event); + callbacks.invoke_table_row_callbacks::(61, &self.unique_u_32, event); + callbacks.invoke_table_row_callbacks::(62, &self.unique_u_64, event); + callbacks.invoke_table_row_callbacks::(63, &self.unique_u_8, event); + callbacks.invoke_table_row_callbacks::(64, &self.vec_address, event); + callbacks.invoke_table_row_callbacks::(65, &self.vec_bool, event); + callbacks.invoke_table_row_callbacks::(66, &self.vec_byte_struct, event); + callbacks.invoke_table_row_callbacks::(67, &self.vec_enum_with_payload, event); + callbacks.invoke_table_row_callbacks::(68, &self.vec_every_primitive_struct, event); + callbacks.invoke_table_row_callbacks::(69, &self.vec_every_vec_struct, event); + callbacks.invoke_table_row_callbacks::(70, &self.vec_f_32, event); + callbacks.invoke_table_row_callbacks::(71, &self.vec_f_64, event); + callbacks.invoke_table_row_callbacks::(72, &self.vec_i_128, event); + callbacks.invoke_table_row_callbacks::(73, &self.vec_i_16, event); + callbacks.invoke_table_row_callbacks::(74, &self.vec_i_256, event); + callbacks.invoke_table_row_callbacks::(75, &self.vec_i_32, event); + callbacks.invoke_table_row_callbacks::(76, &self.vec_i_64, event); + callbacks.invoke_table_row_callbacks::(77, &self.vec_i_8, event); + callbacks.invoke_table_row_callbacks::(78, &self.vec_identity, event); + callbacks.invoke_table_row_callbacks::(79, &self.vec_simple_enum, event); + callbacks.invoke_table_row_callbacks::(80, &self.vec_string, event); + callbacks.invoke_table_row_callbacks::(81, &self.vec_u_128, event); + callbacks.invoke_table_row_callbacks::(82, &self.vec_u_16, event); + callbacks.invoke_table_row_callbacks::(83, &self.vec_u_256, event); + callbacks.invoke_table_row_callbacks::(84, &self.vec_u_32, event); + callbacks.invoke_table_row_callbacks::(85, &self.vec_u_64, event); + callbacks.invoke_table_row_callbacks::(86, &self.vec_u_8, event); + callbacks.invoke_table_row_callbacks::(87, &self.vec_unit_struct, event); + } + fn parse_update( + table_id_to_idx: &impl Fn(__ws::TableId) -> anyhow::Result, + raw: __ws::DatabaseUpdate<__ws::BsatnFormat>, + ) -> anyhow::Result { let mut db_update = DbUpdate::default(); for table_update in raw.tables { - match &table_update.table_name[..] { - "large_table" => db_update.large_table = large_table_table::parse_table_update(table_update)?, - "one_address" => db_update.one_address = one_address_table::parse_table_update(table_update)?, - "one_bool" => db_update.one_bool = one_bool_table::parse_table_update(table_update)?, - "one_byte_struct" => { - db_update.one_byte_struct = one_byte_struct_table::parse_table_update(table_update)? - } - "one_enum_with_payload" => { - db_update.one_enum_with_payload = one_enum_with_payload_table::parse_table_update(table_update)? - } - "one_every_primitive_struct" => { + match table_id_to_idx(table_update.table_id)? { + 0 => db_update.large_table = large_table_table::parse_table_update(table_update)?, + 1 => db_update.one_address = one_address_table::parse_table_update(table_update)?, + 2 => db_update.one_bool = one_bool_table::parse_table_update(table_update)?, + 3 => db_update.one_byte_struct = one_byte_struct_table::parse_table_update(table_update)?, + 4 => db_update.one_enum_with_payload = one_enum_with_payload_table::parse_table_update(table_update)?, + 5 => { db_update.one_every_primitive_struct = one_every_primitive_struct_table::parse_table_update(table_update)? } - "one_every_vec_struct" => { - db_update.one_every_vec_struct = one_every_vec_struct_table::parse_table_update(table_update)? - } - "one_f32" => db_update.one_f_32 = one_f_32_table::parse_table_update(table_update)?, - "one_f64" => db_update.one_f_64 = one_f_64_table::parse_table_update(table_update)?, - "one_i128" => db_update.one_i_128 = one_i_128_table::parse_table_update(table_update)?, - "one_i16" => db_update.one_i_16 = one_i_16_table::parse_table_update(table_update)?, - "one_i256" => db_update.one_i_256 = one_i_256_table::parse_table_update(table_update)?, - "one_i32" => db_update.one_i_32 = one_i_32_table::parse_table_update(table_update)?, - "one_i64" => db_update.one_i_64 = one_i_64_table::parse_table_update(table_update)?, - "one_i8" => db_update.one_i_8 = one_i_8_table::parse_table_update(table_update)?, - "one_identity" => db_update.one_identity = one_identity_table::parse_table_update(table_update)?, - "one_simple_enum" => { - db_update.one_simple_enum = one_simple_enum_table::parse_table_update(table_update)? - } - "one_string" => db_update.one_string = one_string_table::parse_table_update(table_update)?, - "one_u128" => db_update.one_u_128 = one_u_128_table::parse_table_update(table_update)?, - "one_u16" => db_update.one_u_16 = one_u_16_table::parse_table_update(table_update)?, - "one_u256" => db_update.one_u_256 = one_u_256_table::parse_table_update(table_update)?, - "one_u32" => db_update.one_u_32 = one_u_32_table::parse_table_update(table_update)?, - "one_u64" => db_update.one_u_64 = one_u_64_table::parse_table_update(table_update)?, - "one_u8" => db_update.one_u_8 = one_u_8_table::parse_table_update(table_update)?, - "one_unit_struct" => { - db_update.one_unit_struct = one_unit_struct_table::parse_table_update(table_update)? - } - "option_every_primitive_struct" => { + 6 => db_update.one_every_vec_struct = one_every_vec_struct_table::parse_table_update(table_update)?, + 7 => db_update.one_f_32 = one_f_32_table::parse_table_update(table_update)?, + 8 => db_update.one_f_64 = one_f_64_table::parse_table_update(table_update)?, + 9 => db_update.one_i_128 = one_i_128_table::parse_table_update(table_update)?, + 10 => db_update.one_i_16 = one_i_16_table::parse_table_update(table_update)?, + 11 => db_update.one_i_256 = one_i_256_table::parse_table_update(table_update)?, + 12 => db_update.one_i_32 = one_i_32_table::parse_table_update(table_update)?, + 13 => db_update.one_i_64 = one_i_64_table::parse_table_update(table_update)?, + 14 => db_update.one_i_8 = one_i_8_table::parse_table_update(table_update)?, + 15 => db_update.one_identity = one_identity_table::parse_table_update(table_update)?, + 16 => db_update.one_simple_enum = one_simple_enum_table::parse_table_update(table_update)?, + 17 => db_update.one_string = one_string_table::parse_table_update(table_update)?, + 18 => db_update.one_u_128 = one_u_128_table::parse_table_update(table_update)?, + 19 => db_update.one_u_16 = one_u_16_table::parse_table_update(table_update)?, + 20 => db_update.one_u_256 = one_u_256_table::parse_table_update(table_update)?, + 21 => db_update.one_u_32 = one_u_32_table::parse_table_update(table_update)?, + 22 => db_update.one_u_64 = one_u_64_table::parse_table_update(table_update)?, + 23 => db_update.one_u_8 = one_u_8_table::parse_table_update(table_update)?, + 24 => db_update.one_unit_struct = one_unit_struct_table::parse_table_update(table_update)?, + 25 => { db_update.option_every_primitive_struct = option_every_primitive_struct_table::parse_table_update(table_update)? } - "option_i32" => db_update.option_i_32 = option_i_32_table::parse_table_update(table_update)?, - "option_identity" => { - db_update.option_identity = option_identity_table::parse_table_update(table_update)? - } - "option_simple_enum" => { - db_update.option_simple_enum = option_simple_enum_table::parse_table_update(table_update)? - } - "option_string" => db_update.option_string = option_string_table::parse_table_update(table_update)?, - "option_vec_option_i32" => { + 26 => db_update.option_i_32 = option_i_32_table::parse_table_update(table_update)?, + 27 => db_update.option_identity = option_identity_table::parse_table_update(table_update)?, + 28 => db_update.option_simple_enum = option_simple_enum_table::parse_table_update(table_update)?, + 29 => db_update.option_string = option_string_table::parse_table_update(table_update)?, + 30 => { db_update.option_vec_option_i_32 = option_vec_option_i_32_table::parse_table_update(table_update)? } - "pk_address" => db_update.pk_address = pk_address_table::parse_table_update(table_update)?, - "pk_bool" => db_update.pk_bool = pk_bool_table::parse_table_update(table_update)?, - "pk_i128" => db_update.pk_i_128 = pk_i_128_table::parse_table_update(table_update)?, - "pk_i16" => db_update.pk_i_16 = pk_i_16_table::parse_table_update(table_update)?, - "pk_i256" => db_update.pk_i_256 = pk_i_256_table::parse_table_update(table_update)?, - "pk_i32" => db_update.pk_i_32 = pk_i_32_table::parse_table_update(table_update)?, - "pk_i64" => db_update.pk_i_64 = pk_i_64_table::parse_table_update(table_update)?, - "pk_i8" => db_update.pk_i_8 = pk_i_8_table::parse_table_update(table_update)?, - "pk_identity" => db_update.pk_identity = pk_identity_table::parse_table_update(table_update)?, - "pk_string" => db_update.pk_string = pk_string_table::parse_table_update(table_update)?, - "pk_u128" => db_update.pk_u_128 = pk_u_128_table::parse_table_update(table_update)?, - "pk_u16" => db_update.pk_u_16 = pk_u_16_table::parse_table_update(table_update)?, - "pk_u256" => db_update.pk_u_256 = pk_u_256_table::parse_table_update(table_update)?, - "pk_u32" => db_update.pk_u_32 = pk_u_32_table::parse_table_update(table_update)?, - "pk_u64" => db_update.pk_u_64 = pk_u_64_table::parse_table_update(table_update)?, - "pk_u8" => db_update.pk_u_8 = pk_u_8_table::parse_table_update(table_update)?, - "table_holds_table" => { - db_update.table_holds_table = table_holds_table_table::parse_table_update(table_update)? - } - "unique_address" => db_update.unique_address = unique_address_table::parse_table_update(table_update)?, - "unique_bool" => db_update.unique_bool = unique_bool_table::parse_table_update(table_update)?, - "unique_i128" => db_update.unique_i_128 = unique_i_128_table::parse_table_update(table_update)?, - "unique_i16" => db_update.unique_i_16 = unique_i_16_table::parse_table_update(table_update)?, - "unique_i256" => db_update.unique_i_256 = unique_i_256_table::parse_table_update(table_update)?, - "unique_i32" => db_update.unique_i_32 = unique_i_32_table::parse_table_update(table_update)?, - "unique_i64" => db_update.unique_i_64 = unique_i_64_table::parse_table_update(table_update)?, - "unique_i8" => db_update.unique_i_8 = unique_i_8_table::parse_table_update(table_update)?, - "unique_identity" => { - db_update.unique_identity = unique_identity_table::parse_table_update(table_update)? - } - "unique_string" => db_update.unique_string = unique_string_table::parse_table_update(table_update)?, - "unique_u128" => db_update.unique_u_128 = unique_u_128_table::parse_table_update(table_update)?, - "unique_u16" => db_update.unique_u_16 = unique_u_16_table::parse_table_update(table_update)?, - "unique_u256" => db_update.unique_u_256 = unique_u_256_table::parse_table_update(table_update)?, - "unique_u32" => db_update.unique_u_32 = unique_u_32_table::parse_table_update(table_update)?, - "unique_u64" => db_update.unique_u_64 = unique_u_64_table::parse_table_update(table_update)?, - "unique_u8" => db_update.unique_u_8 = unique_u_8_table::parse_table_update(table_update)?, - "vec_address" => db_update.vec_address = vec_address_table::parse_table_update(table_update)?, - "vec_bool" => db_update.vec_bool = vec_bool_table::parse_table_update(table_update)?, - "vec_byte_struct" => { - db_update.vec_byte_struct = vec_byte_struct_table::parse_table_update(table_update)? - } - "vec_enum_with_payload" => { - db_update.vec_enum_with_payload = vec_enum_with_payload_table::parse_table_update(table_update)? - } - "vec_every_primitive_struct" => { + 31 => db_update.pk_address = pk_address_table::parse_table_update(table_update)?, + 32 => db_update.pk_bool = pk_bool_table::parse_table_update(table_update)?, + 33 => db_update.pk_i_128 = pk_i_128_table::parse_table_update(table_update)?, + 34 => db_update.pk_i_16 = pk_i_16_table::parse_table_update(table_update)?, + 35 => db_update.pk_i_256 = pk_i_256_table::parse_table_update(table_update)?, + 36 => db_update.pk_i_32 = pk_i_32_table::parse_table_update(table_update)?, + 37 => db_update.pk_i_64 = pk_i_64_table::parse_table_update(table_update)?, + 38 => db_update.pk_i_8 = pk_i_8_table::parse_table_update(table_update)?, + 39 => db_update.pk_identity = pk_identity_table::parse_table_update(table_update)?, + 40 => db_update.pk_string = pk_string_table::parse_table_update(table_update)?, + 41 => db_update.pk_u_128 = pk_u_128_table::parse_table_update(table_update)?, + 42 => db_update.pk_u_16 = pk_u_16_table::parse_table_update(table_update)?, + 43 => db_update.pk_u_256 = pk_u_256_table::parse_table_update(table_update)?, + 44 => db_update.pk_u_32 = pk_u_32_table::parse_table_update(table_update)?, + 45 => db_update.pk_u_64 = pk_u_64_table::parse_table_update(table_update)?, + 46 => db_update.pk_u_8 = pk_u_8_table::parse_table_update(table_update)?, + 47 => db_update.table_holds_table = table_holds_table_table::parse_table_update(table_update)?, + 48 => db_update.unique_address = unique_address_table::parse_table_update(table_update)?, + 49 => db_update.unique_bool = unique_bool_table::parse_table_update(table_update)?, + 50 => db_update.unique_i_128 = unique_i_128_table::parse_table_update(table_update)?, + 51 => db_update.unique_i_16 = unique_i_16_table::parse_table_update(table_update)?, + 52 => db_update.unique_i_256 = unique_i_256_table::parse_table_update(table_update)?, + 53 => db_update.unique_i_32 = unique_i_32_table::parse_table_update(table_update)?, + 54 => db_update.unique_i_64 = unique_i_64_table::parse_table_update(table_update)?, + 55 => db_update.unique_i_8 = unique_i_8_table::parse_table_update(table_update)?, + 56 => db_update.unique_identity = unique_identity_table::parse_table_update(table_update)?, + 57 => db_update.unique_string = unique_string_table::parse_table_update(table_update)?, + 58 => db_update.unique_u_128 = unique_u_128_table::parse_table_update(table_update)?, + 59 => db_update.unique_u_16 = unique_u_16_table::parse_table_update(table_update)?, + 60 => db_update.unique_u_256 = unique_u_256_table::parse_table_update(table_update)?, + 61 => db_update.unique_u_32 = unique_u_32_table::parse_table_update(table_update)?, + 62 => db_update.unique_u_64 = unique_u_64_table::parse_table_update(table_update)?, + 63 => db_update.unique_u_8 = unique_u_8_table::parse_table_update(table_update)?, + 64 => db_update.vec_address = vec_address_table::parse_table_update(table_update)?, + 65 => db_update.vec_bool = vec_bool_table::parse_table_update(table_update)?, + 66 => db_update.vec_byte_struct = vec_byte_struct_table::parse_table_update(table_update)?, + 67 => db_update.vec_enum_with_payload = vec_enum_with_payload_table::parse_table_update(table_update)?, + 68 => { db_update.vec_every_primitive_struct = vec_every_primitive_struct_table::parse_table_update(table_update)? } - "vec_every_vec_struct" => { - db_update.vec_every_vec_struct = vec_every_vec_struct_table::parse_table_update(table_update)? - } - "vec_f32" => db_update.vec_f_32 = vec_f_32_table::parse_table_update(table_update)?, - "vec_f64" => db_update.vec_f_64 = vec_f_64_table::parse_table_update(table_update)?, - "vec_i128" => db_update.vec_i_128 = vec_i_128_table::parse_table_update(table_update)?, - "vec_i16" => db_update.vec_i_16 = vec_i_16_table::parse_table_update(table_update)?, - "vec_i256" => db_update.vec_i_256 = vec_i_256_table::parse_table_update(table_update)?, - "vec_i32" => db_update.vec_i_32 = vec_i_32_table::parse_table_update(table_update)?, - "vec_i64" => db_update.vec_i_64 = vec_i_64_table::parse_table_update(table_update)?, - "vec_i8" => db_update.vec_i_8 = vec_i_8_table::parse_table_update(table_update)?, - "vec_identity" => db_update.vec_identity = vec_identity_table::parse_table_update(table_update)?, - "vec_simple_enum" => { - db_update.vec_simple_enum = vec_simple_enum_table::parse_table_update(table_update)? - } - "vec_string" => db_update.vec_string = vec_string_table::parse_table_update(table_update)?, - "vec_u128" => db_update.vec_u_128 = vec_u_128_table::parse_table_update(table_update)?, - "vec_u16" => db_update.vec_u_16 = vec_u_16_table::parse_table_update(table_update)?, - "vec_u256" => db_update.vec_u_256 = vec_u_256_table::parse_table_update(table_update)?, - "vec_u32" => db_update.vec_u_32 = vec_u_32_table::parse_table_update(table_update)?, - "vec_u64" => db_update.vec_u_64 = vec_u_64_table::parse_table_update(table_update)?, - "vec_u8" => db_update.vec_u_8 = vec_u_8_table::parse_table_update(table_update)?, - "vec_unit_struct" => { - db_update.vec_unit_struct = vec_unit_struct_table::parse_table_update(table_update)? - } + 69 => db_update.vec_every_vec_struct = vec_every_vec_struct_table::parse_table_update(table_update)?, + 70 => db_update.vec_f_32 = vec_f_32_table::parse_table_update(table_update)?, + 71 => db_update.vec_f_64 = vec_f_64_table::parse_table_update(table_update)?, + 72 => db_update.vec_i_128 = vec_i_128_table::parse_table_update(table_update)?, + 73 => db_update.vec_i_16 = vec_i_16_table::parse_table_update(table_update)?, + 74 => db_update.vec_i_256 = vec_i_256_table::parse_table_update(table_update)?, + 75 => db_update.vec_i_32 = vec_i_32_table::parse_table_update(table_update)?, + 76 => db_update.vec_i_64 = vec_i_64_table::parse_table_update(table_update)?, + 77 => db_update.vec_i_8 = vec_i_8_table::parse_table_update(table_update)?, + 78 => db_update.vec_identity = vec_identity_table::parse_table_update(table_update)?, + 79 => db_update.vec_simple_enum = vec_simple_enum_table::parse_table_update(table_update)?, + 80 => db_update.vec_string = vec_string_table::parse_table_update(table_update)?, + 81 => db_update.vec_u_128 = vec_u_128_table::parse_table_update(table_update)?, + 82 => db_update.vec_u_16 = vec_u_16_table::parse_table_update(table_update)?, + 83 => db_update.vec_u_256 = vec_u_256_table::parse_table_update(table_update)?, + 84 => db_update.vec_u_32 = vec_u_32_table::parse_table_update(table_update)?, + 85 => db_update.vec_u_64 = vec_u_64_table::parse_table_update(table_update)?, + 86 => db_update.vec_u_8 = vec_u_8_table::parse_table_update(table_update)?, + 87 => db_update.vec_unit_struct = vec_unit_struct_table::parse_table_update(table_update)?, - unknown => __anyhow::bail!("Unknown table {unknown:?} in DatabaseUpdate"), + _ => unreachable!(), } } Ok(db_update) } -} - -impl __sdk::spacetime_module::InModule for DbUpdate { - type Module = RemoteModule; -} - -impl __sdk::spacetime_module::DbUpdate for DbUpdate { - fn apply_to_client_cache(&self, cache: &mut __sdk::client_cache::ClientCache) { - cache.apply_diff_to_table::("large_table", &self.large_table); - cache.apply_diff_to_table::("one_address", &self.one_address); - cache.apply_diff_to_table::("one_bool", &self.one_bool); - cache.apply_diff_to_table::("one_byte_struct", &self.one_byte_struct); - cache.apply_diff_to_table::("one_enum_with_payload", &self.one_enum_with_payload); - cache.apply_diff_to_table::( - "one_every_primitive_struct", - &self.one_every_primitive_struct, - ); - cache.apply_diff_to_table::("one_every_vec_struct", &self.one_every_vec_struct); - cache.apply_diff_to_table::("one_f32", &self.one_f_32); - cache.apply_diff_to_table::("one_f64", &self.one_f_64); - cache.apply_diff_to_table::("one_i128", &self.one_i_128); - cache.apply_diff_to_table::("one_i16", &self.one_i_16); - cache.apply_diff_to_table::("one_i256", &self.one_i_256); - cache.apply_diff_to_table::("one_i32", &self.one_i_32); - cache.apply_diff_to_table::("one_i64", &self.one_i_64); - cache.apply_diff_to_table::("one_i8", &self.one_i_8); - cache.apply_diff_to_table::("one_identity", &self.one_identity); - cache.apply_diff_to_table::("one_simple_enum", &self.one_simple_enum); - cache.apply_diff_to_table::("one_string", &self.one_string); - cache.apply_diff_to_table::("one_u128", &self.one_u_128); - cache.apply_diff_to_table::("one_u16", &self.one_u_16); - cache.apply_diff_to_table::("one_u256", &self.one_u_256); - cache.apply_diff_to_table::("one_u32", &self.one_u_32); - cache.apply_diff_to_table::("one_u64", &self.one_u_64); - cache.apply_diff_to_table::("one_u8", &self.one_u_8); - cache.apply_diff_to_table::("one_unit_struct", &self.one_unit_struct); - cache.apply_diff_to_table::( - "option_every_primitive_struct", - &self.option_every_primitive_struct, - ); - cache.apply_diff_to_table::("option_i32", &self.option_i_32); - cache.apply_diff_to_table::("option_identity", &self.option_identity); - cache.apply_diff_to_table::("option_simple_enum", &self.option_simple_enum); - cache.apply_diff_to_table::("option_string", &self.option_string); - cache.apply_diff_to_table::("option_vec_option_i32", &self.option_vec_option_i_32); - cache.apply_diff_to_table::("pk_address", &self.pk_address); - cache.apply_diff_to_table::("pk_bool", &self.pk_bool); - cache.apply_diff_to_table::("pk_i128", &self.pk_i_128); - cache.apply_diff_to_table::("pk_i16", &self.pk_i_16); - cache.apply_diff_to_table::("pk_i256", &self.pk_i_256); - cache.apply_diff_to_table::("pk_i32", &self.pk_i_32); - cache.apply_diff_to_table::("pk_i64", &self.pk_i_64); - cache.apply_diff_to_table::("pk_i8", &self.pk_i_8); - cache.apply_diff_to_table::("pk_identity", &self.pk_identity); - cache.apply_diff_to_table::("pk_string", &self.pk_string); - cache.apply_diff_to_table::("pk_u128", &self.pk_u_128); - cache.apply_diff_to_table::("pk_u16", &self.pk_u_16); - cache.apply_diff_to_table::("pk_u256", &self.pk_u_256); - cache.apply_diff_to_table::("pk_u32", &self.pk_u_32); - cache.apply_diff_to_table::("pk_u64", &self.pk_u_64); - cache.apply_diff_to_table::("pk_u8", &self.pk_u_8); - cache.apply_diff_to_table::("table_holds_table", &self.table_holds_table); - cache.apply_diff_to_table::("unique_address", &self.unique_address); - cache.apply_diff_to_table::("unique_bool", &self.unique_bool); - cache.apply_diff_to_table::("unique_i128", &self.unique_i_128); - cache.apply_diff_to_table::("unique_i16", &self.unique_i_16); - cache.apply_diff_to_table::("unique_i256", &self.unique_i_256); - cache.apply_diff_to_table::("unique_i32", &self.unique_i_32); - cache.apply_diff_to_table::("unique_i64", &self.unique_i_64); - cache.apply_diff_to_table::("unique_i8", &self.unique_i_8); - cache.apply_diff_to_table::("unique_identity", &self.unique_identity); - cache.apply_diff_to_table::("unique_string", &self.unique_string); - cache.apply_diff_to_table::("unique_u128", &self.unique_u_128); - cache.apply_diff_to_table::("unique_u16", &self.unique_u_16); - cache.apply_diff_to_table::("unique_u256", &self.unique_u_256); - cache.apply_diff_to_table::("unique_u32", &self.unique_u_32); - cache.apply_diff_to_table::("unique_u64", &self.unique_u_64); - cache.apply_diff_to_table::("unique_u8", &self.unique_u_8); - cache.apply_diff_to_table::("vec_address", &self.vec_address); - cache.apply_diff_to_table::("vec_bool", &self.vec_bool); - cache.apply_diff_to_table::("vec_byte_struct", &self.vec_byte_struct); - cache.apply_diff_to_table::("vec_enum_with_payload", &self.vec_enum_with_payload); - cache.apply_diff_to_table::( - "vec_every_primitive_struct", - &self.vec_every_primitive_struct, - ); - cache.apply_diff_to_table::("vec_every_vec_struct", &self.vec_every_vec_struct); - cache.apply_diff_to_table::("vec_f32", &self.vec_f_32); - cache.apply_diff_to_table::("vec_f64", &self.vec_f_64); - cache.apply_diff_to_table::("vec_i128", &self.vec_i_128); - cache.apply_diff_to_table::("vec_i16", &self.vec_i_16); - cache.apply_diff_to_table::("vec_i256", &self.vec_i_256); - cache.apply_diff_to_table::("vec_i32", &self.vec_i_32); - cache.apply_diff_to_table::("vec_i64", &self.vec_i_64); - cache.apply_diff_to_table::("vec_i8", &self.vec_i_8); - cache.apply_diff_to_table::("vec_identity", &self.vec_identity); - cache.apply_diff_to_table::("vec_simple_enum", &self.vec_simple_enum); - cache.apply_diff_to_table::("vec_string", &self.vec_string); - cache.apply_diff_to_table::("vec_u128", &self.vec_u_128); - cache.apply_diff_to_table::("vec_u16", &self.vec_u_16); - cache.apply_diff_to_table::("vec_u256", &self.vec_u_256); - cache.apply_diff_to_table::("vec_u32", &self.vec_u_32); - cache.apply_diff_to_table::("vec_u64", &self.vec_u_64); - cache.apply_diff_to_table::("vec_u8", &self.vec_u_8); - cache.apply_diff_to_table::("vec_unit_struct", &self.vec_unit_struct); - } - fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::callbacks::DbCallbacks) { - callbacks.invoke_table_row_callbacks::("large_table", &self.large_table, event); - callbacks.invoke_table_row_callbacks::("one_address", &self.one_address, event); - callbacks.invoke_table_row_callbacks::("one_bool", &self.one_bool, event); - callbacks.invoke_table_row_callbacks::("one_byte_struct", &self.one_byte_struct, event); - callbacks.invoke_table_row_callbacks::( + fn table_names() -> &'static [&'static str] { + &[ + "large_table", + "one_address", + "one_bool", + "one_byte_struct", "one_enum_with_payload", - &self.one_enum_with_payload, - event, - ); - callbacks.invoke_table_row_callbacks::( "one_every_primitive_struct", - &self.one_every_primitive_struct, - event, - ); - callbacks.invoke_table_row_callbacks::( "one_every_vec_struct", - &self.one_every_vec_struct, - event, - ); - callbacks.invoke_table_row_callbacks::("one_f32", &self.one_f_32, event); - callbacks.invoke_table_row_callbacks::("one_f64", &self.one_f_64, event); - callbacks.invoke_table_row_callbacks::("one_i128", &self.one_i_128, event); - callbacks.invoke_table_row_callbacks::("one_i16", &self.one_i_16, event); - callbacks.invoke_table_row_callbacks::("one_i256", &self.one_i_256, event); - callbacks.invoke_table_row_callbacks::("one_i32", &self.one_i_32, event); - callbacks.invoke_table_row_callbacks::("one_i64", &self.one_i_64, event); - callbacks.invoke_table_row_callbacks::("one_i8", &self.one_i_8, event); - callbacks.invoke_table_row_callbacks::("one_identity", &self.one_identity, event); - callbacks.invoke_table_row_callbacks::("one_simple_enum", &self.one_simple_enum, event); - callbacks.invoke_table_row_callbacks::("one_string", &self.one_string, event); - callbacks.invoke_table_row_callbacks::("one_u128", &self.one_u_128, event); - callbacks.invoke_table_row_callbacks::("one_u16", &self.one_u_16, event); - callbacks.invoke_table_row_callbacks::("one_u256", &self.one_u_256, event); - callbacks.invoke_table_row_callbacks::("one_u32", &self.one_u_32, event); - callbacks.invoke_table_row_callbacks::("one_u64", &self.one_u_64, event); - callbacks.invoke_table_row_callbacks::("one_u8", &self.one_u_8, event); - callbacks.invoke_table_row_callbacks::("one_unit_struct", &self.one_unit_struct, event); - callbacks.invoke_table_row_callbacks::( + "one_f32", + "one_f64", + "one_i128", + "one_i16", + "one_i256", + "one_i32", + "one_i64", + "one_i8", + "one_identity", + "one_simple_enum", + "one_string", + "one_u128", + "one_u16", + "one_u256", + "one_u32", + "one_u64", + "one_u8", + "one_unit_struct", "option_every_primitive_struct", - &self.option_every_primitive_struct, - event, - ); - callbacks.invoke_table_row_callbacks::("option_i32", &self.option_i_32, event); - callbacks.invoke_table_row_callbacks::("option_identity", &self.option_identity, event); - callbacks.invoke_table_row_callbacks::("option_simple_enum", &self.option_simple_enum, event); - callbacks.invoke_table_row_callbacks::("option_string", &self.option_string, event); - callbacks.invoke_table_row_callbacks::( + "option_i32", + "option_identity", + "option_simple_enum", + "option_string", "option_vec_option_i32", - &self.option_vec_option_i_32, - event, - ); - callbacks.invoke_table_row_callbacks::("pk_address", &self.pk_address, event); - callbacks.invoke_table_row_callbacks::("pk_bool", &self.pk_bool, event); - callbacks.invoke_table_row_callbacks::("pk_i128", &self.pk_i_128, event); - callbacks.invoke_table_row_callbacks::("pk_i16", &self.pk_i_16, event); - callbacks.invoke_table_row_callbacks::("pk_i256", &self.pk_i_256, event); - callbacks.invoke_table_row_callbacks::("pk_i32", &self.pk_i_32, event); - callbacks.invoke_table_row_callbacks::("pk_i64", &self.pk_i_64, event); - callbacks.invoke_table_row_callbacks::("pk_i8", &self.pk_i_8, event); - callbacks.invoke_table_row_callbacks::("pk_identity", &self.pk_identity, event); - callbacks.invoke_table_row_callbacks::("pk_string", &self.pk_string, event); - callbacks.invoke_table_row_callbacks::("pk_u128", &self.pk_u_128, event); - callbacks.invoke_table_row_callbacks::("pk_u16", &self.pk_u_16, event); - callbacks.invoke_table_row_callbacks::("pk_u256", &self.pk_u_256, event); - callbacks.invoke_table_row_callbacks::("pk_u32", &self.pk_u_32, event); - callbacks.invoke_table_row_callbacks::("pk_u64", &self.pk_u_64, event); - callbacks.invoke_table_row_callbacks::("pk_u8", &self.pk_u_8, event); - callbacks.invoke_table_row_callbacks::("table_holds_table", &self.table_holds_table, event); - callbacks.invoke_table_row_callbacks::("unique_address", &self.unique_address, event); - callbacks.invoke_table_row_callbacks::("unique_bool", &self.unique_bool, event); - callbacks.invoke_table_row_callbacks::("unique_i128", &self.unique_i_128, event); - callbacks.invoke_table_row_callbacks::("unique_i16", &self.unique_i_16, event); - callbacks.invoke_table_row_callbacks::("unique_i256", &self.unique_i_256, event); - callbacks.invoke_table_row_callbacks::("unique_i32", &self.unique_i_32, event); - callbacks.invoke_table_row_callbacks::("unique_i64", &self.unique_i_64, event); - callbacks.invoke_table_row_callbacks::("unique_i8", &self.unique_i_8, event); - callbacks.invoke_table_row_callbacks::("unique_identity", &self.unique_identity, event); - callbacks.invoke_table_row_callbacks::("unique_string", &self.unique_string, event); - callbacks.invoke_table_row_callbacks::("unique_u128", &self.unique_u_128, event); - callbacks.invoke_table_row_callbacks::("unique_u16", &self.unique_u_16, event); - callbacks.invoke_table_row_callbacks::("unique_u256", &self.unique_u_256, event); - callbacks.invoke_table_row_callbacks::("unique_u32", &self.unique_u_32, event); - callbacks.invoke_table_row_callbacks::("unique_u64", &self.unique_u_64, event); - callbacks.invoke_table_row_callbacks::("unique_u8", &self.unique_u_8, event); - callbacks.invoke_table_row_callbacks::("vec_address", &self.vec_address, event); - callbacks.invoke_table_row_callbacks::("vec_bool", &self.vec_bool, event); - callbacks.invoke_table_row_callbacks::("vec_byte_struct", &self.vec_byte_struct, event); - callbacks.invoke_table_row_callbacks::( + "pk_address", + "pk_bool", + "pk_i128", + "pk_i16", + "pk_i256", + "pk_i32", + "pk_i64", + "pk_i8", + "pk_identity", + "pk_string", + "pk_u128", + "pk_u16", + "pk_u256", + "pk_u32", + "pk_u64", + "pk_u8", + "table_holds_table", + "unique_address", + "unique_bool", + "unique_i128", + "unique_i16", + "unique_i256", + "unique_i32", + "unique_i64", + "unique_i8", + "unique_identity", + "unique_string", + "unique_u128", + "unique_u16", + "unique_u256", + "unique_u32", + "unique_u64", + "unique_u8", + "vec_address", + "vec_bool", + "vec_byte_struct", "vec_enum_with_payload", - &self.vec_enum_with_payload, - event, - ); - callbacks.invoke_table_row_callbacks::( "vec_every_primitive_struct", - &self.vec_every_primitive_struct, - event, - ); - callbacks.invoke_table_row_callbacks::( "vec_every_vec_struct", - &self.vec_every_vec_struct, - event, - ); - callbacks.invoke_table_row_callbacks::("vec_f32", &self.vec_f_32, event); - callbacks.invoke_table_row_callbacks::("vec_f64", &self.vec_f_64, event); - callbacks.invoke_table_row_callbacks::("vec_i128", &self.vec_i_128, event); - callbacks.invoke_table_row_callbacks::("vec_i16", &self.vec_i_16, event); - callbacks.invoke_table_row_callbacks::("vec_i256", &self.vec_i_256, event); - callbacks.invoke_table_row_callbacks::("vec_i32", &self.vec_i_32, event); - callbacks.invoke_table_row_callbacks::("vec_i64", &self.vec_i_64, event); - callbacks.invoke_table_row_callbacks::("vec_i8", &self.vec_i_8, event); - callbacks.invoke_table_row_callbacks::("vec_identity", &self.vec_identity, event); - callbacks.invoke_table_row_callbacks::("vec_simple_enum", &self.vec_simple_enum, event); - callbacks.invoke_table_row_callbacks::("vec_string", &self.vec_string, event); - callbacks.invoke_table_row_callbacks::("vec_u128", &self.vec_u_128, event); - callbacks.invoke_table_row_callbacks::("vec_u16", &self.vec_u_16, event); - callbacks.invoke_table_row_callbacks::("vec_u256", &self.vec_u_256, event); - callbacks.invoke_table_row_callbacks::("vec_u32", &self.vec_u_32, event); - callbacks.invoke_table_row_callbacks::("vec_u64", &self.vec_u_64, event); - callbacks.invoke_table_row_callbacks::("vec_u8", &self.vec_u_8, event); - callbacks.invoke_table_row_callbacks::("vec_unit_struct", &self.vec_unit_struct, event); + "vec_f32", + "vec_f64", + "vec_i128", + "vec_i16", + "vec_i256", + "vec_i32", + "vec_i64", + "vec_i8", + "vec_identity", + "vec_simple_enum", + "vec_string", + "vec_u128", + "vec_u16", + "vec_u256", + "vec_u32", + "vec_u64", + "vec_u8", + "vec_unit_struct", + ] } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs index a73357f3506..8ecd25aafa7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/no_op_succeeds_reducer.rs @@ -47,19 +47,19 @@ pub trait no_op_succeeds { impl no_op_succeeds for super::RemoteReducers { fn no_op_succeeds(&self) -> __anyhow::Result<()> { - self.imp.call_reducer("no_op_succeeds", NoOpSucceeds {}) + self.imp.call_reducer(129, NoOpSucceeds {}) } fn on_no_op_succeeds( &self, mut callback: impl FnMut(&super::EventContext) + Send + 'static, ) -> NoOpSucceedsCallbackId { NoOpSucceedsCallbackId(self.imp.on_reducer::( - "no_op_succeeds", + 129, Box::new(move |ctx: &super::EventContext, args: &NoOpSucceeds| callback(ctx)), )) } fn remove_on_no_op_succeeds(&self, callback: NoOpSucceedsCallbackId) { - self.imp.remove_on_reducer::("no_op_succeeds", callback.0) + self.imp.remove_on_reducer::(129, callback.0) } } @@ -79,6 +79,6 @@ pub trait set_flags_for_no_op_succeeds { impl set_flags_for_no_op_succeeds for super::SetReducerFlags { fn no_op_succeeds(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("no_op_succeeds", flags); + self.imp.set_call_reducer_flags(129, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_address_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_address_table.rs index 8ffe10b8b7f..ec1fe41a332 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_address_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_address_table.rs @@ -35,7 +35,7 @@ pub trait OneAddressTableAccess { impl OneAddressTableAccess for super::RemoteTables { fn one_address(&self) -> OneAddressTableHandle<'_> { OneAddressTableHandle { - imp: self.imp.get_table::("one_address"), + imp: self.imp.get_table::(1), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_bool_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_bool_table.rs index 96b0df62268..b19bccf3ff0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_bool_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_bool_table.rs @@ -35,7 +35,7 @@ pub trait OneBoolTableAccess { impl OneBoolTableAccess for super::RemoteTables { fn one_bool(&self) -> OneBoolTableHandle<'_> { OneBoolTableHandle { - imp: self.imp.get_table::("one_bool"), + imp: self.imp.get_table::(2), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_byte_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_byte_struct_table.rs index 0207fbb9226..2cac3a86419 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_byte_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_byte_struct_table.rs @@ -36,7 +36,7 @@ pub trait OneByteStructTableAccess { impl OneByteStructTableAccess for super::RemoteTables { fn one_byte_struct(&self) -> OneByteStructTableHandle<'_> { OneByteStructTableHandle { - imp: self.imp.get_table::("one_byte_struct"), + imp: self.imp.get_table::(3), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_enum_with_payload_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_enum_with_payload_table.rs index a2e394dd423..50142ae9e1e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_enum_with_payload_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_enum_with_payload_table.rs @@ -36,7 +36,7 @@ pub trait OneEnumWithPayloadTableAccess { impl OneEnumWithPayloadTableAccess for super::RemoteTables { fn one_enum_with_payload(&self) -> OneEnumWithPayloadTableHandle<'_> { OneEnumWithPayloadTableHandle { - imp: self.imp.get_table::("one_enum_with_payload"), + imp: self.imp.get_table::(4), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_every_primitive_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_every_primitive_struct_table.rs index 5a3ad06666f..eaa6b54c981 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_every_primitive_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_every_primitive_struct_table.rs @@ -36,9 +36,7 @@ pub trait OneEveryPrimitiveStructTableAccess { impl OneEveryPrimitiveStructTableAccess for super::RemoteTables { fn one_every_primitive_struct(&self) -> OneEveryPrimitiveStructTableHandle<'_> { OneEveryPrimitiveStructTableHandle { - imp: self - .imp - .get_table::("one_every_primitive_struct"), + imp: self.imp.get_table::(5), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_every_vec_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_every_vec_struct_table.rs index 8d81e12c580..c7b7f2ce1d1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_every_vec_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_every_vec_struct_table.rs @@ -36,7 +36,7 @@ pub trait OneEveryVecStructTableAccess { impl OneEveryVecStructTableAccess for super::RemoteTables { fn one_every_vec_struct(&self) -> OneEveryVecStructTableHandle<'_> { OneEveryVecStructTableHandle { - imp: self.imp.get_table::("one_every_vec_struct"), + imp: self.imp.get_table::(6), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_f_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_f_32_table.rs index 26fde871750..60c0b9d3a8f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_f_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_f_32_table.rs @@ -35,7 +35,7 @@ pub trait OneF32TableAccess { impl OneF32TableAccess for super::RemoteTables { fn one_f_32(&self) -> OneF32TableHandle<'_> { OneF32TableHandle { - imp: self.imp.get_table::("one_f32"), + imp: self.imp.get_table::(7), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_f_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_f_64_table.rs index 0faedf0e2e1..3cab6e20d65 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_f_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_f_64_table.rs @@ -35,7 +35,7 @@ pub trait OneF64TableAccess { impl OneF64TableAccess for super::RemoteTables { fn one_f_64(&self) -> OneF64TableHandle<'_> { OneF64TableHandle { - imp: self.imp.get_table::("one_f64"), + imp: self.imp.get_table::(8), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_i_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_i_128_table.rs index c2df488aab7..1ac3fc8b478 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_i_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_i_128_table.rs @@ -35,7 +35,7 @@ pub trait OneI128TableAccess { impl OneI128TableAccess for super::RemoteTables { fn one_i_128(&self) -> OneI128TableHandle<'_> { OneI128TableHandle { - imp: self.imp.get_table::("one_i128"), + imp: self.imp.get_table::(9), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_i_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_i_16_table.rs index 97bcc8b8718..de15bab261d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_i_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_i_16_table.rs @@ -35,7 +35,7 @@ pub trait OneI16TableAccess { impl OneI16TableAccess for super::RemoteTables { fn one_i_16(&self) -> OneI16TableHandle<'_> { OneI16TableHandle { - imp: self.imp.get_table::("one_i16"), + imp: self.imp.get_table::(10), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_i_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_i_256_table.rs index d6324fa9925..293df7f3bcf 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_i_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_i_256_table.rs @@ -35,7 +35,7 @@ pub trait OneI256TableAccess { impl OneI256TableAccess for super::RemoteTables { fn one_i_256(&self) -> OneI256TableHandle<'_> { OneI256TableHandle { - imp: self.imp.get_table::("one_i256"), + imp: self.imp.get_table::(11), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_i_32_table.rs index fd9faa963b6..c3c1b7af0c9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_i_32_table.rs @@ -35,7 +35,7 @@ pub trait OneI32TableAccess { impl OneI32TableAccess for super::RemoteTables { fn one_i_32(&self) -> OneI32TableHandle<'_> { OneI32TableHandle { - imp: self.imp.get_table::("one_i32"), + imp: self.imp.get_table::(12), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_i_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_i_64_table.rs index 48848e16067..5b86d29faa7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_i_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_i_64_table.rs @@ -35,7 +35,7 @@ pub trait OneI64TableAccess { impl OneI64TableAccess for super::RemoteTables { fn one_i_64(&self) -> OneI64TableHandle<'_> { OneI64TableHandle { - imp: self.imp.get_table::("one_i64"), + imp: self.imp.get_table::(13), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_i_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_i_8_table.rs index 5cf171ebeee..a10025084f0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_i_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_i_8_table.rs @@ -35,7 +35,7 @@ pub trait OneI8TableAccess { impl OneI8TableAccess for super::RemoteTables { fn one_i_8(&self) -> OneI8TableHandle<'_> { OneI8TableHandle { - imp: self.imp.get_table::("one_i8"), + imp: self.imp.get_table::(14), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_identity_table.rs index ebc48489897..a09ca5471ee 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_identity_table.rs @@ -35,7 +35,7 @@ pub trait OneIdentityTableAccess { impl OneIdentityTableAccess for super::RemoteTables { fn one_identity(&self) -> OneIdentityTableHandle<'_> { OneIdentityTableHandle { - imp: self.imp.get_table::("one_identity"), + imp: self.imp.get_table::(15), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_simple_enum_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_simple_enum_table.rs index 0bd9641621f..36907d1554f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_simple_enum_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_simple_enum_table.rs @@ -36,7 +36,7 @@ pub trait OneSimpleEnumTableAccess { impl OneSimpleEnumTableAccess for super::RemoteTables { fn one_simple_enum(&self) -> OneSimpleEnumTableHandle<'_> { OneSimpleEnumTableHandle { - imp: self.imp.get_table::("one_simple_enum"), + imp: self.imp.get_table::(16), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_string_table.rs index 2e814b11fb0..79a6b558ab9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_string_table.rs @@ -35,7 +35,7 @@ pub trait OneStringTableAccess { impl OneStringTableAccess for super::RemoteTables { fn one_string(&self) -> OneStringTableHandle<'_> { OneStringTableHandle { - imp: self.imp.get_table::("one_string"), + imp: self.imp.get_table::(17), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_u_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_u_128_table.rs index fa297175ef3..a0a6981244e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_u_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_u_128_table.rs @@ -35,7 +35,7 @@ pub trait OneU128TableAccess { impl OneU128TableAccess for super::RemoteTables { fn one_u_128(&self) -> OneU128TableHandle<'_> { OneU128TableHandle { - imp: self.imp.get_table::("one_u128"), + imp: self.imp.get_table::(18), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_u_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_u_16_table.rs index 0837ef2464b..8221fc70d68 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_u_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_u_16_table.rs @@ -35,7 +35,7 @@ pub trait OneU16TableAccess { impl OneU16TableAccess for super::RemoteTables { fn one_u_16(&self) -> OneU16TableHandle<'_> { OneU16TableHandle { - imp: self.imp.get_table::("one_u16"), + imp: self.imp.get_table::(19), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_u_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_u_256_table.rs index 6e52f5391c3..1647b954318 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_u_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_u_256_table.rs @@ -35,7 +35,7 @@ pub trait OneU256TableAccess { impl OneU256TableAccess for super::RemoteTables { fn one_u_256(&self) -> OneU256TableHandle<'_> { OneU256TableHandle { - imp: self.imp.get_table::("one_u256"), + imp: self.imp.get_table::(20), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_u_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_u_32_table.rs index 9f52581069e..94d69a7f5a5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_u_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_u_32_table.rs @@ -35,7 +35,7 @@ pub trait OneU32TableAccess { impl OneU32TableAccess for super::RemoteTables { fn one_u_32(&self) -> OneU32TableHandle<'_> { OneU32TableHandle { - imp: self.imp.get_table::("one_u32"), + imp: self.imp.get_table::(21), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_u_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_u_64_table.rs index 6e6af7251f9..e740075234e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_u_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_u_64_table.rs @@ -35,7 +35,7 @@ pub trait OneU64TableAccess { impl OneU64TableAccess for super::RemoteTables { fn one_u_64(&self) -> OneU64TableHandle<'_> { OneU64TableHandle { - imp: self.imp.get_table::("one_u64"), + imp: self.imp.get_table::(22), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_u_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_u_8_table.rs index ef4b642c361..1bf898e73dc 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_u_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_u_8_table.rs @@ -35,7 +35,7 @@ pub trait OneU8TableAccess { impl OneU8TableAccess for super::RemoteTables { fn one_u_8(&self) -> OneU8TableHandle<'_> { OneU8TableHandle { - imp: self.imp.get_table::("one_u8"), + imp: self.imp.get_table::(23), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/one_unit_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/one_unit_struct_table.rs index 8fb41e77296..2c24574dfc4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/one_unit_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/one_unit_struct_table.rs @@ -36,7 +36,7 @@ pub trait OneUnitStructTableAccess { impl OneUnitStructTableAccess for super::RemoteTables { fn one_unit_struct(&self) -> OneUnitStructTableHandle<'_> { OneUnitStructTableHandle { - imp: self.imp.get_table::("one_unit_struct"), + imp: self.imp.get_table::(24), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/option_every_primitive_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/option_every_primitive_struct_table.rs index 5c84712ea82..3bb2568c3b4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/option_every_primitive_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/option_every_primitive_struct_table.rs @@ -36,9 +36,7 @@ pub trait OptionEveryPrimitiveStructTableAccess { impl OptionEveryPrimitiveStructTableAccess for super::RemoteTables { fn option_every_primitive_struct(&self) -> OptionEveryPrimitiveStructTableHandle<'_> { OptionEveryPrimitiveStructTableHandle { - imp: self - .imp - .get_table::("option_every_primitive_struct"), + imp: self.imp.get_table::(25), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/option_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/option_i_32_table.rs index 12124867e24..28ae9210441 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/option_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/option_i_32_table.rs @@ -35,7 +35,7 @@ pub trait OptionI32TableAccess { impl OptionI32TableAccess for super::RemoteTables { fn option_i_32(&self) -> OptionI32TableHandle<'_> { OptionI32TableHandle { - imp: self.imp.get_table::("option_i32"), + imp: self.imp.get_table::(26), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/option_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/option_identity_table.rs index 2647083952a..0eb935fcffa 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/option_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/option_identity_table.rs @@ -35,7 +35,7 @@ pub trait OptionIdentityTableAccess { impl OptionIdentityTableAccess for super::RemoteTables { fn option_identity(&self) -> OptionIdentityTableHandle<'_> { OptionIdentityTableHandle { - imp: self.imp.get_table::("option_identity"), + imp: self.imp.get_table::(27), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/option_simple_enum_table.rs b/crates/sdk/tests/test-client/src/module_bindings/option_simple_enum_table.rs index 73a78ff2826..be980060174 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/option_simple_enum_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/option_simple_enum_table.rs @@ -36,7 +36,7 @@ pub trait OptionSimpleEnumTableAccess { impl OptionSimpleEnumTableAccess for super::RemoteTables { fn option_simple_enum(&self) -> OptionSimpleEnumTableHandle<'_> { OptionSimpleEnumTableHandle { - imp: self.imp.get_table::("option_simple_enum"), + imp: self.imp.get_table::(28), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/option_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/option_string_table.rs index 836b50224df..2d8c000d10f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/option_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/option_string_table.rs @@ -35,7 +35,7 @@ pub trait OptionStringTableAccess { impl OptionStringTableAccess for super::RemoteTables { fn option_string(&self) -> OptionStringTableHandle<'_> { OptionStringTableHandle { - imp: self.imp.get_table::("option_string"), + imp: self.imp.get_table::(29), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/option_vec_option_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/option_vec_option_i_32_table.rs index 9dd2783ebab..7f1e46460a6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/option_vec_option_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/option_vec_option_i_32_table.rs @@ -35,7 +35,7 @@ pub trait OptionVecOptionI32TableAccess { impl OptionVecOptionI32TableAccess for super::RemoteTables { fn option_vec_option_i_32(&self) -> OptionVecOptionI32TableHandle<'_> { OptionVecOptionI32TableHandle { - imp: self.imp.get_table::("option_vec_option_i32"), + imp: self.imp.get_table::(30), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs index 7fb6c2fa765..105366306f4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_address_table.rs @@ -35,7 +35,7 @@ pub trait PkAddressTableAccess { impl PkAddressTableAccess for super::RemoteTables { fn pk_address(&self) -> PkAddressTableHandle<'_> { PkAddressTableHandle { - imp: self.imp.get_table::("pk_address"), + imp: self.imp.get_table::(31), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs index dcc9e768682..df75261ceb6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_bool_table.rs @@ -35,7 +35,7 @@ pub trait PkBoolTableAccess { impl PkBoolTableAccess for super::RemoteTables { fn pk_bool(&self) -> PkBoolTableHandle<'_> { PkBoolTableHandle { - imp: self.imp.get_table::("pk_bool"), + imp: self.imp.get_table::(32), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs index 8671f277b40..f628f778fd4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_128_table.rs @@ -35,7 +35,7 @@ pub trait PkI128TableAccess { impl PkI128TableAccess for super::RemoteTables { fn pk_i_128(&self) -> PkI128TableHandle<'_> { PkI128TableHandle { - imp: self.imp.get_table::("pk_i128"), + imp: self.imp.get_table::(33), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs index 2ceadb322bd..0db49e39ff6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_16_table.rs @@ -35,7 +35,7 @@ pub trait PkI16TableAccess { impl PkI16TableAccess for super::RemoteTables { fn pk_i_16(&self) -> PkI16TableHandle<'_> { PkI16TableHandle { - imp: self.imp.get_table::("pk_i16"), + imp: self.imp.get_table::(34), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs index ea6dbdf16b4..c00c2607262 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_256_table.rs @@ -35,7 +35,7 @@ pub trait PkI256TableAccess { impl PkI256TableAccess for super::RemoteTables { fn pk_i_256(&self) -> PkI256TableHandle<'_> { PkI256TableHandle { - imp: self.imp.get_table::("pk_i256"), + imp: self.imp.get_table::(35), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs index 51895754ca8..616770c7713 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_32_table.rs @@ -35,7 +35,7 @@ pub trait PkI32TableAccess { impl PkI32TableAccess for super::RemoteTables { fn pk_i_32(&self) -> PkI32TableHandle<'_> { PkI32TableHandle { - imp: self.imp.get_table::("pk_i32"), + imp: self.imp.get_table::(36), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs index f7ab21b7098..2c316f96f25 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_64_table.rs @@ -35,7 +35,7 @@ pub trait PkI64TableAccess { impl PkI64TableAccess for super::RemoteTables { fn pk_i_64(&self) -> PkI64TableHandle<'_> { PkI64TableHandle { - imp: self.imp.get_table::("pk_i64"), + imp: self.imp.get_table::(37), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs index 691e56d7d1d..33f1e97af52 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_i_8_table.rs @@ -35,7 +35,7 @@ pub trait PkI8TableAccess { impl PkI8TableAccess for super::RemoteTables { fn pk_i_8(&self) -> PkI8TableHandle<'_> { PkI8TableHandle { - imp: self.imp.get_table::("pk_i8"), + imp: self.imp.get_table::(38), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs index a25fe782ad6..4d36b1bab39 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_identity_table.rs @@ -35,7 +35,7 @@ pub trait PkIdentityTableAccess { impl PkIdentityTableAccess for super::RemoteTables { fn pk_identity(&self) -> PkIdentityTableHandle<'_> { PkIdentityTableHandle { - imp: self.imp.get_table::("pk_identity"), + imp: self.imp.get_table::(39), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs index 91f9cc7f2d7..8465d9e5353 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_string_table.rs @@ -35,7 +35,7 @@ pub trait PkStringTableAccess { impl PkStringTableAccess for super::RemoteTables { fn pk_string(&self) -> PkStringTableHandle<'_> { PkStringTableHandle { - imp: self.imp.get_table::("pk_string"), + imp: self.imp.get_table::(40), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs index b8425759a75..a8bbb459262 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_128_table.rs @@ -35,7 +35,7 @@ pub trait PkU128TableAccess { impl PkU128TableAccess for super::RemoteTables { fn pk_u_128(&self) -> PkU128TableHandle<'_> { PkU128TableHandle { - imp: self.imp.get_table::("pk_u128"), + imp: self.imp.get_table::(41), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs index 1efb9d500be..931ef27947e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_16_table.rs @@ -35,7 +35,7 @@ pub trait PkU16TableAccess { impl PkU16TableAccess for super::RemoteTables { fn pk_u_16(&self) -> PkU16TableHandle<'_> { PkU16TableHandle { - imp: self.imp.get_table::("pk_u16"), + imp: self.imp.get_table::(42), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs index e07c92156c4..04a7c765c12 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_256_table.rs @@ -35,7 +35,7 @@ pub trait PkU256TableAccess { impl PkU256TableAccess for super::RemoteTables { fn pk_u_256(&self) -> PkU256TableHandle<'_> { PkU256TableHandle { - imp: self.imp.get_table::("pk_u256"), + imp: self.imp.get_table::(43), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs index 1f995680e8e..58aba504812 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_32_table.rs @@ -35,7 +35,7 @@ pub trait PkU32TableAccess { impl PkU32TableAccess for super::RemoteTables { fn pk_u_32(&self) -> PkU32TableHandle<'_> { PkU32TableHandle { - imp: self.imp.get_table::("pk_u32"), + imp: self.imp.get_table::(44), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs index edafc0348ce..72a1124d30a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_64_table.rs @@ -35,7 +35,7 @@ pub trait PkU64TableAccess { impl PkU64TableAccess for super::RemoteTables { fn pk_u_64(&self) -> PkU64TableHandle<'_> { PkU64TableHandle { - imp: self.imp.get_table::("pk_u64"), + imp: self.imp.get_table::(45), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs index ad9341838ce..18d7e437201 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/pk_u_8_table.rs @@ -35,7 +35,7 @@ pub trait PkU8TableAccess { impl PkU8TableAccess for super::RemoteTables { fn pk_u_8(&self) -> PkU8TableHandle<'_> { PkU8TableHandle { - imp: self.imp.get_table::("pk_u8"), + imp: self.imp.get_table::(46), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/table_holds_table_table.rs b/crates/sdk/tests/test-client/src/module_bindings/table_holds_table_table.rs index 5338a65e5ba..921fc54ccd7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/table_holds_table_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/table_holds_table_table.rs @@ -37,7 +37,7 @@ pub trait TableHoldsTableTableAccess { impl TableHoldsTableTableAccess for super::RemoteTables { fn table_holds_table(&self) -> TableHoldsTableTableHandle<'_> { TableHoldsTableTableHandle { - imp: self.imp.get_table::("table_holds_table"), + imp: self.imp.get_table::(47), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs index 01c586a33aa..200bf7f76a1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_address_table.rs @@ -35,7 +35,7 @@ pub trait UniqueAddressTableAccess { impl UniqueAddressTableAccess for super::RemoteTables { fn unique_address(&self) -> UniqueAddressTableHandle<'_> { UniqueAddressTableHandle { - imp: self.imp.get_table::("unique_address"), + imp: self.imp.get_table::(48), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs index 9da44544da4..b2a9fded08b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_bool_table.rs @@ -35,7 +35,7 @@ pub trait UniqueBoolTableAccess { impl UniqueBoolTableAccess for super::RemoteTables { fn unique_bool(&self) -> UniqueBoolTableHandle<'_> { UniqueBoolTableHandle { - imp: self.imp.get_table::("unique_bool"), + imp: self.imp.get_table::(49), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs index 1952c45b080..600265fdb08 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_128_table.rs @@ -35,7 +35,7 @@ pub trait UniqueI128TableAccess { impl UniqueI128TableAccess for super::RemoteTables { fn unique_i_128(&self) -> UniqueI128TableHandle<'_> { UniqueI128TableHandle { - imp: self.imp.get_table::("unique_i128"), + imp: self.imp.get_table::(50), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs index 2ae85224ab5..c0532ac601b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_16_table.rs @@ -35,7 +35,7 @@ pub trait UniqueI16TableAccess { impl UniqueI16TableAccess for super::RemoteTables { fn unique_i_16(&self) -> UniqueI16TableHandle<'_> { UniqueI16TableHandle { - imp: self.imp.get_table::("unique_i16"), + imp: self.imp.get_table::(51), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs index 9b4b070dfd7..a5d8ba59973 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_256_table.rs @@ -35,7 +35,7 @@ pub trait UniqueI256TableAccess { impl UniqueI256TableAccess for super::RemoteTables { fn unique_i_256(&self) -> UniqueI256TableHandle<'_> { UniqueI256TableHandle { - imp: self.imp.get_table::("unique_i256"), + imp: self.imp.get_table::(52), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs index 14d5427a75b..ba018c510b9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_32_table.rs @@ -35,7 +35,7 @@ pub trait UniqueI32TableAccess { impl UniqueI32TableAccess for super::RemoteTables { fn unique_i_32(&self) -> UniqueI32TableHandle<'_> { UniqueI32TableHandle { - imp: self.imp.get_table::("unique_i32"), + imp: self.imp.get_table::(53), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs index 6eb8b35855b..57aed1cd715 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_64_table.rs @@ -35,7 +35,7 @@ pub trait UniqueI64TableAccess { impl UniqueI64TableAccess for super::RemoteTables { fn unique_i_64(&self) -> UniqueI64TableHandle<'_> { UniqueI64TableHandle { - imp: self.imp.get_table::("unique_i64"), + imp: self.imp.get_table::(54), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs index 7a26c27d7fa..62c752890e6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_i_8_table.rs @@ -35,7 +35,7 @@ pub trait UniqueI8TableAccess { impl UniqueI8TableAccess for super::RemoteTables { fn unique_i_8(&self) -> UniqueI8TableHandle<'_> { UniqueI8TableHandle { - imp: self.imp.get_table::("unique_i8"), + imp: self.imp.get_table::(55), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs index 54988ef2790..0159fcdc26a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_identity_table.rs @@ -35,7 +35,7 @@ pub trait UniqueIdentityTableAccess { impl UniqueIdentityTableAccess for super::RemoteTables { fn unique_identity(&self) -> UniqueIdentityTableHandle<'_> { UniqueIdentityTableHandle { - imp: self.imp.get_table::("unique_identity"), + imp: self.imp.get_table::(56), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs index 4b47857172c..20efec981e0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_string_table.rs @@ -35,7 +35,7 @@ pub trait UniqueStringTableAccess { impl UniqueStringTableAccess for super::RemoteTables { fn unique_string(&self) -> UniqueStringTableHandle<'_> { UniqueStringTableHandle { - imp: self.imp.get_table::("unique_string"), + imp: self.imp.get_table::(57), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs index 63b568ee3ef..830b0e93016 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_128_table.rs @@ -35,7 +35,7 @@ pub trait UniqueU128TableAccess { impl UniqueU128TableAccess for super::RemoteTables { fn unique_u_128(&self) -> UniqueU128TableHandle<'_> { UniqueU128TableHandle { - imp: self.imp.get_table::("unique_u128"), + imp: self.imp.get_table::(58), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs index fb545de33b2..79ad8b83259 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_16_table.rs @@ -35,7 +35,7 @@ pub trait UniqueU16TableAccess { impl UniqueU16TableAccess for super::RemoteTables { fn unique_u_16(&self) -> UniqueU16TableHandle<'_> { UniqueU16TableHandle { - imp: self.imp.get_table::("unique_u16"), + imp: self.imp.get_table::(59), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs index 0bf15128245..d8a022ca551 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_256_table.rs @@ -35,7 +35,7 @@ pub trait UniqueU256TableAccess { impl UniqueU256TableAccess for super::RemoteTables { fn unique_u_256(&self) -> UniqueU256TableHandle<'_> { UniqueU256TableHandle { - imp: self.imp.get_table::("unique_u256"), + imp: self.imp.get_table::(60), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs index ad2b997b57e..370ef8c6c72 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_32_table.rs @@ -35,7 +35,7 @@ pub trait UniqueU32TableAccess { impl UniqueU32TableAccess for super::RemoteTables { fn unique_u_32(&self) -> UniqueU32TableHandle<'_> { UniqueU32TableHandle { - imp: self.imp.get_table::("unique_u32"), + imp: self.imp.get_table::(61), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs index 10b3a652a5f..3cf9507a4b8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_64_table.rs @@ -35,7 +35,7 @@ pub trait UniqueU64TableAccess { impl UniqueU64TableAccess for super::RemoteTables { fn unique_u_64(&self) -> UniqueU64TableHandle<'_> { UniqueU64TableHandle { - imp: self.imp.get_table::("unique_u64"), + imp: self.imp.get_table::(62), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs index 18f9d78c2a8..45f0961bf7f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/unique_u_8_table.rs @@ -35,7 +35,7 @@ pub trait UniqueU8TableAccess { impl UniqueU8TableAccess for super::RemoteTables { fn unique_u_8(&self) -> UniqueU8TableHandle<'_> { UniqueU8TableHandle { - imp: self.imp.get_table::("unique_u8"), + imp: self.imp.get_table::(63), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs index eaa5ef67c19..81441d783d8 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_address_reducer.rs @@ -53,20 +53,19 @@ pub trait update_pk_address { impl update_pk_address for super::RemoteReducers { fn update_pk_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_address", UpdatePkAddress { a, data }) + self.imp.call_reducer(130, UpdatePkAddress { a, data }) } fn on_update_pk_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> UpdatePkAddressCallbackId { UpdatePkAddressCallbackId(self.imp.on_reducer::( - "update_pk_address", + 130, Box::new(move |ctx: &super::EventContext, args: &UpdatePkAddress| callback(ctx, &args.a, &args.data)), )) } fn remove_on_update_pk_address(&self, callback: UpdatePkAddressCallbackId) { - self.imp - .remove_on_reducer::("update_pk_address", callback.0) + self.imp.remove_on_reducer::(130, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_pk_address { impl set_flags_for_update_pk_address for super::SetReducerFlags { fn update_pk_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_address", flags); + self.imp.set_call_reducer_flags(130, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs index 98060ce67d5..b7085e5c97f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_bool_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_bool { impl update_pk_bool for super::RemoteReducers { fn update_pk_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_bool", UpdatePkBool { b, data }) + self.imp.call_reducer(131, UpdatePkBool { b, data }) } fn on_update_pk_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> UpdatePkBoolCallbackId { UpdatePkBoolCallbackId(self.imp.on_reducer::( - "update_pk_bool", + 131, Box::new(move |ctx: &super::EventContext, args: &UpdatePkBool| callback(ctx, &args.b, &args.data)), )) } fn remove_on_update_pk_bool(&self, callback: UpdatePkBoolCallbackId) { - self.imp.remove_on_reducer::("update_pk_bool", callback.0) + self.imp.remove_on_reducer::(131, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_bool { impl set_flags_for_update_pk_bool for super::SetReducerFlags { fn update_pk_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_bool", flags); + self.imp.set_call_reducer_flags(131, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs index 57507dc1a03..dd1341c878a 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_128_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_i_128 { impl update_pk_i_128 for super::RemoteReducers { fn update_pk_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i128", UpdatePkI128 { n, data }) + self.imp.call_reducer(132, UpdatePkI128 { n, data }) } fn on_update_pk_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> UpdatePkI128CallbackId { UpdatePkI128CallbackId(self.imp.on_reducer::( - "update_pk_i128", + 132, Box::new(move |ctx: &super::EventContext, args: &UpdatePkI128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_i_128(&self, callback: UpdatePkI128CallbackId) { - self.imp.remove_on_reducer::("update_pk_i128", callback.0) + self.imp.remove_on_reducer::(132, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_i_128 { impl set_flags_for_update_pk_i_128 for super::SetReducerFlags { fn update_pk_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_i128", flags); + self.imp.set_call_reducer_flags(132, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs index 19d068bf77c..dd6f2dce1b5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_16_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_i_16 { impl update_pk_i_16 for super::RemoteReducers { fn update_pk_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i16", UpdatePkI16 { n, data }) + self.imp.call_reducer(133, UpdatePkI16 { n, data }) } fn on_update_pk_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> UpdatePkI16CallbackId { UpdatePkI16CallbackId(self.imp.on_reducer::( - "update_pk_i16", + 133, Box::new(move |ctx: &super::EventContext, args: &UpdatePkI16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_i_16(&self, callback: UpdatePkI16CallbackId) { - self.imp.remove_on_reducer::("update_pk_i16", callback.0) + self.imp.remove_on_reducer::(133, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_i_16 { impl set_flags_for_update_pk_i_16 for super::SetReducerFlags { fn update_pk_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_i16", flags); + self.imp.set_call_reducer_flags(133, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs index 3172fe37607..8863c732888 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_256_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_i_256 { impl update_pk_i_256 for super::RemoteReducers { fn update_pk_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i256", UpdatePkI256 { n, data }) + self.imp.call_reducer(134, UpdatePkI256 { n, data }) } fn on_update_pk_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> UpdatePkI256CallbackId { UpdatePkI256CallbackId(self.imp.on_reducer::( - "update_pk_i256", + 134, Box::new(move |ctx: &super::EventContext, args: &UpdatePkI256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_i_256(&self, callback: UpdatePkI256CallbackId) { - self.imp.remove_on_reducer::("update_pk_i256", callback.0) + self.imp.remove_on_reducer::(134, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_i_256 { impl set_flags_for_update_pk_i_256 for super::SetReducerFlags { fn update_pk_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_i256", flags); + self.imp.set_call_reducer_flags(134, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs index 2087c38d060..9767fa76624 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_32_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_i_32 { impl update_pk_i_32 for super::RemoteReducers { fn update_pk_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i32", UpdatePkI32 { n, data }) + self.imp.call_reducer(135, UpdatePkI32 { n, data }) } fn on_update_pk_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> UpdatePkI32CallbackId { UpdatePkI32CallbackId(self.imp.on_reducer::( - "update_pk_i32", + 135, Box::new(move |ctx: &super::EventContext, args: &UpdatePkI32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_i_32(&self, callback: UpdatePkI32CallbackId) { - self.imp.remove_on_reducer::("update_pk_i32", callback.0) + self.imp.remove_on_reducer::(135, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_i_32 { impl set_flags_for_update_pk_i_32 for super::SetReducerFlags { fn update_pk_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_i32", flags); + self.imp.set_call_reducer_flags(135, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs index 746c92a6ca0..eed2f5387fb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_64_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_i_64 { impl update_pk_i_64 for super::RemoteReducers { fn update_pk_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i64", UpdatePkI64 { n, data }) + self.imp.call_reducer(136, UpdatePkI64 { n, data }) } fn on_update_pk_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> UpdatePkI64CallbackId { UpdatePkI64CallbackId(self.imp.on_reducer::( - "update_pk_i64", + 136, Box::new(move |ctx: &super::EventContext, args: &UpdatePkI64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_i_64(&self, callback: UpdatePkI64CallbackId) { - self.imp.remove_on_reducer::("update_pk_i64", callback.0) + self.imp.remove_on_reducer::(136, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_i_64 { impl set_flags_for_update_pk_i_64 for super::SetReducerFlags { fn update_pk_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_i64", flags); + self.imp.set_call_reducer_flags(136, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs index 5f145137717..64f4e68f78c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_i_8_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_i_8 { impl update_pk_i_8 for super::RemoteReducers { fn update_pk_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_i8", UpdatePkI8 { n, data }) + self.imp.call_reducer(137, UpdatePkI8 { n, data }) } fn on_update_pk_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> UpdatePkI8CallbackId { UpdatePkI8CallbackId(self.imp.on_reducer::( - "update_pk_i8", + 137, Box::new(move |ctx: &super::EventContext, args: &UpdatePkI8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_i_8(&self, callback: UpdatePkI8CallbackId) { - self.imp.remove_on_reducer::("update_pk_i8", callback.0) + self.imp.remove_on_reducer::(137, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_i_8 { impl set_flags_for_update_pk_i_8 for super::SetReducerFlags { fn update_pk_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_i8", flags); + self.imp.set_call_reducer_flags(137, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs index 833e49a00de..bfa399afceb 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_identity_reducer.rs @@ -53,21 +53,19 @@ pub trait update_pk_identity { impl update_pk_identity for super::RemoteReducers { fn update_pk_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_pk_identity", UpdatePkIdentity { i, data }) + self.imp.call_reducer(138, UpdatePkIdentity { i, data }) } fn on_update_pk_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> UpdatePkIdentityCallbackId { UpdatePkIdentityCallbackId(self.imp.on_reducer::( - "update_pk_identity", + 138, Box::new(move |ctx: &super::EventContext, args: &UpdatePkIdentity| callback(ctx, &args.i, &args.data)), )) } fn remove_on_update_pk_identity(&self, callback: UpdatePkIdentityCallbackId) { - self.imp - .remove_on_reducer::("update_pk_identity", callback.0) + self.imp.remove_on_reducer::(138, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_pk_identity { impl set_flags_for_update_pk_identity for super::SetReducerFlags { fn update_pk_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_identity", flags); + self.imp.set_call_reducer_flags(138, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs index 66a3702b303..1f5e8e9253d 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_string_reducer.rs @@ -53,20 +53,19 @@ pub trait update_pk_string { impl update_pk_string for super::RemoteReducers { fn update_pk_string(&self, s: String, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_string", UpdatePkString { s, data }) + self.imp.call_reducer(139, UpdatePkString { s, data }) } fn on_update_pk_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> UpdatePkStringCallbackId { UpdatePkStringCallbackId(self.imp.on_reducer::( - "update_pk_string", + 139, Box::new(move |ctx: &super::EventContext, args: &UpdatePkString| callback(ctx, &args.s, &args.data)), )) } fn remove_on_update_pk_string(&self, callback: UpdatePkStringCallbackId) { - self.imp - .remove_on_reducer::("update_pk_string", callback.0) + self.imp.remove_on_reducer::(139, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_pk_string { impl set_flags_for_update_pk_string for super::SetReducerFlags { fn update_pk_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_string", flags); + self.imp.set_call_reducer_flags(139, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs index e2458fe54a5..dc4659f083b 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_128_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_u_128 { impl update_pk_u_128 for super::RemoteReducers { fn update_pk_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u128", UpdatePkU128 { n, data }) + self.imp.call_reducer(140, UpdatePkU128 { n, data }) } fn on_update_pk_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> UpdatePkU128CallbackId { UpdatePkU128CallbackId(self.imp.on_reducer::( - "update_pk_u128", + 140, Box::new(move |ctx: &super::EventContext, args: &UpdatePkU128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_u_128(&self, callback: UpdatePkU128CallbackId) { - self.imp.remove_on_reducer::("update_pk_u128", callback.0) + self.imp.remove_on_reducer::(140, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_u_128 { impl set_flags_for_update_pk_u_128 for super::SetReducerFlags { fn update_pk_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_u128", flags); + self.imp.set_call_reducer_flags(140, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs index 76ddd2a4f30..76afd2ab40f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_16_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_u_16 { impl update_pk_u_16 for super::RemoteReducers { fn update_pk_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u16", UpdatePkU16 { n, data }) + self.imp.call_reducer(141, UpdatePkU16 { n, data }) } fn on_update_pk_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> UpdatePkU16CallbackId { UpdatePkU16CallbackId(self.imp.on_reducer::( - "update_pk_u16", + 141, Box::new(move |ctx: &super::EventContext, args: &UpdatePkU16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_u_16(&self, callback: UpdatePkU16CallbackId) { - self.imp.remove_on_reducer::("update_pk_u16", callback.0) + self.imp.remove_on_reducer::(141, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_u_16 { impl set_flags_for_update_pk_u_16 for super::SetReducerFlags { fn update_pk_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_u16", flags); + self.imp.set_call_reducer_flags(141, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs index cc1fbc88f69..90aee264a06 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_256_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_u_256 { impl update_pk_u_256 for super::RemoteReducers { fn update_pk_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u256", UpdatePkU256 { n, data }) + self.imp.call_reducer(142, UpdatePkU256 { n, data }) } fn on_update_pk_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> UpdatePkU256CallbackId { UpdatePkU256CallbackId(self.imp.on_reducer::( - "update_pk_u256", + 142, Box::new(move |ctx: &super::EventContext, args: &UpdatePkU256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_u_256(&self, callback: UpdatePkU256CallbackId) { - self.imp.remove_on_reducer::("update_pk_u256", callback.0) + self.imp.remove_on_reducer::(142, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_u_256 { impl set_flags_for_update_pk_u_256 for super::SetReducerFlags { fn update_pk_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_u256", flags); + self.imp.set_call_reducer_flags(142, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs index ea212b4b4ac..24bef6fe2f7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_32_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_u_32 { impl update_pk_u_32 for super::RemoteReducers { fn update_pk_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u32", UpdatePkU32 { n, data }) + self.imp.call_reducer(143, UpdatePkU32 { n, data }) } fn on_update_pk_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> UpdatePkU32CallbackId { UpdatePkU32CallbackId(self.imp.on_reducer::( - "update_pk_u32", + 143, Box::new(move |ctx: &super::EventContext, args: &UpdatePkU32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_u_32(&self, callback: UpdatePkU32CallbackId) { - self.imp.remove_on_reducer::("update_pk_u32", callback.0) + self.imp.remove_on_reducer::(143, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_u_32 { impl set_flags_for_update_pk_u_32 for super::SetReducerFlags { fn update_pk_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_u32", flags); + self.imp.set_call_reducer_flags(143, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs index b2325b21468..b510c0b7252 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_64_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_u_64 { impl update_pk_u_64 for super::RemoteReducers { fn update_pk_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u64", UpdatePkU64 { n, data }) + self.imp.call_reducer(144, UpdatePkU64 { n, data }) } fn on_update_pk_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> UpdatePkU64CallbackId { UpdatePkU64CallbackId(self.imp.on_reducer::( - "update_pk_u64", + 144, Box::new(move |ctx: &super::EventContext, args: &UpdatePkU64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_u_64(&self, callback: UpdatePkU64CallbackId) { - self.imp.remove_on_reducer::("update_pk_u64", callback.0) + self.imp.remove_on_reducer::(144, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_u_64 { impl set_flags_for_update_pk_u_64 for super::SetReducerFlags { fn update_pk_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_u64", flags); + self.imp.set_call_reducer_flags(144, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs index 6654de8d585..4278b00fd8c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_pk_u_8_reducer.rs @@ -53,19 +53,19 @@ pub trait update_pk_u_8 { impl update_pk_u_8 for super::RemoteReducers { fn update_pk_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_pk_u8", UpdatePkU8 { n, data }) + self.imp.call_reducer(145, UpdatePkU8 { n, data }) } fn on_update_pk_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> UpdatePkU8CallbackId { UpdatePkU8CallbackId(self.imp.on_reducer::( - "update_pk_u8", + 145, Box::new(move |ctx: &super::EventContext, args: &UpdatePkU8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_pk_u_8(&self, callback: UpdatePkU8CallbackId) { - self.imp.remove_on_reducer::("update_pk_u8", callback.0) + self.imp.remove_on_reducer::(145, callback.0) } } @@ -85,6 +85,6 @@ pub trait set_flags_for_update_pk_u_8 { impl set_flags_for_update_pk_u_8 for super::SetReducerFlags { fn update_pk_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_pk_u8", flags); + self.imp.set_call_reducer_flags(145, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs index bb1f61defb4..a922360346e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_address_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_address { impl update_unique_address for super::RemoteReducers { fn update_unique_address(&self, a: __sdk::Address, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_address", UpdateUniqueAddress { a, data }) + self.imp.call_reducer(146, UpdateUniqueAddress { a, data }) } fn on_update_unique_address( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Address, &i32) + Send + 'static, ) -> UpdateUniqueAddressCallbackId { UpdateUniqueAddressCallbackId(self.imp.on_reducer::( - "update_unique_address", + 146, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueAddress| callback(ctx, &args.a, &args.data)), )) } fn remove_on_update_unique_address(&self, callback: UpdateUniqueAddressCallbackId) { - self.imp - .remove_on_reducer::("update_unique_address", callback.0) + self.imp.remove_on_reducer::(146, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_address { impl set_flags_for_update_unique_address for super::SetReducerFlags { fn update_unique_address(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_address", flags); + self.imp.set_call_reducer_flags(146, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs index 5b12f801635..f21af9b827f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_bool_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_bool { impl update_unique_bool for super::RemoteReducers { fn update_unique_bool(&self, b: bool, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_bool", UpdateUniqueBool { b, data }) + self.imp.call_reducer(147, UpdateUniqueBool { b, data }) } fn on_update_unique_bool( &self, mut callback: impl FnMut(&super::EventContext, &bool, &i32) + Send + 'static, ) -> UpdateUniqueBoolCallbackId { UpdateUniqueBoolCallbackId(self.imp.on_reducer::( - "update_unique_bool", + 147, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueBool| callback(ctx, &args.b, &args.data)), )) } fn remove_on_update_unique_bool(&self, callback: UpdateUniqueBoolCallbackId) { - self.imp - .remove_on_reducer::("update_unique_bool", callback.0) + self.imp.remove_on_reducer::(147, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_bool { impl set_flags_for_update_unique_bool for super::SetReducerFlags { fn update_unique_bool(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_bool", flags); + self.imp.set_call_reducer_flags(147, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs index 46295956068..283658124b7 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_128_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_i_128 { impl update_unique_i_128 for super::RemoteReducers { fn update_unique_i_128(&self, n: i128, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_i128", UpdateUniqueI128 { n, data }) + self.imp.call_reducer(148, UpdateUniqueI128 { n, data }) } fn on_update_unique_i_128( &self, mut callback: impl FnMut(&super::EventContext, &i128, &i32) + Send + 'static, ) -> UpdateUniqueI128CallbackId { UpdateUniqueI128CallbackId(self.imp.on_reducer::( - "update_unique_i128", + 148, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_i_128(&self, callback: UpdateUniqueI128CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i128", callback.0) + self.imp.remove_on_reducer::(148, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_i_128 { impl set_flags_for_update_unique_i_128 for super::SetReducerFlags { fn update_unique_i_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_i128", flags); + self.imp.set_call_reducer_flags(148, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs index 55b96d25fb2..cb310adcefc 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_16_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_i_16 { impl update_unique_i_16 for super::RemoteReducers { fn update_unique_i_16(&self, n: i16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i16", UpdateUniqueI16 { n, data }) + self.imp.call_reducer(149, UpdateUniqueI16 { n, data }) } fn on_update_unique_i_16( &self, mut callback: impl FnMut(&super::EventContext, &i16, &i32) + Send + 'static, ) -> UpdateUniqueI16CallbackId { UpdateUniqueI16CallbackId(self.imp.on_reducer::( - "update_unique_i16", + 149, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_i_16(&self, callback: UpdateUniqueI16CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i16", callback.0) + self.imp.remove_on_reducer::(149, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_i_16 { impl set_flags_for_update_unique_i_16 for super::SetReducerFlags { fn update_unique_i_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_i16", flags); + self.imp.set_call_reducer_flags(149, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs index c940a2aff8e..e203a8a374f 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_256_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_i_256 { impl update_unique_i_256 for super::RemoteReducers { fn update_unique_i_256(&self, n: __sats::i256, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_i256", UpdateUniqueI256 { n, data }) + self.imp.call_reducer(150, UpdateUniqueI256 { n, data }) } fn on_update_unique_i_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::i256, &i32) + Send + 'static, ) -> UpdateUniqueI256CallbackId { UpdateUniqueI256CallbackId(self.imp.on_reducer::( - "update_unique_i256", + 150, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_i_256(&self, callback: UpdateUniqueI256CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i256", callback.0) + self.imp.remove_on_reducer::(150, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_i_256 { impl set_flags_for_update_unique_i_256 for super::SetReducerFlags { fn update_unique_i_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_i256", flags); + self.imp.set_call_reducer_flags(150, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs index 25d960743e9..8b6299153ac 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_32_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_i_32 { impl update_unique_i_32 for super::RemoteReducers { fn update_unique_i_32(&self, n: i32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i32", UpdateUniqueI32 { n, data }) + self.imp.call_reducer(151, UpdateUniqueI32 { n, data }) } fn on_update_unique_i_32( &self, mut callback: impl FnMut(&super::EventContext, &i32, &i32) + Send + 'static, ) -> UpdateUniqueI32CallbackId { UpdateUniqueI32CallbackId(self.imp.on_reducer::( - "update_unique_i32", + 151, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_i_32(&self, callback: UpdateUniqueI32CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i32", callback.0) + self.imp.remove_on_reducer::(151, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_i_32 { impl set_flags_for_update_unique_i_32 for super::SetReducerFlags { fn update_unique_i_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_i32", flags); + self.imp.set_call_reducer_flags(151, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs index 69e512b73db..b032a1968ce 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_64_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_i_64 { impl update_unique_i_64 for super::RemoteReducers { fn update_unique_i_64(&self, n: i64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i64", UpdateUniqueI64 { n, data }) + self.imp.call_reducer(152, UpdateUniqueI64 { n, data }) } fn on_update_unique_i_64( &self, mut callback: impl FnMut(&super::EventContext, &i64, &i32) + Send + 'static, ) -> UpdateUniqueI64CallbackId { UpdateUniqueI64CallbackId(self.imp.on_reducer::( - "update_unique_i64", + 152, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_i_64(&self, callback: UpdateUniqueI64CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i64", callback.0) + self.imp.remove_on_reducer::(152, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_i_64 { impl set_flags_for_update_unique_i_64 for super::SetReducerFlags { fn update_unique_i_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_i64", flags); + self.imp.set_call_reducer_flags(152, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs index f113579e40b..65f646ebcca 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_i_8_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_i_8 { impl update_unique_i_8 for super::RemoteReducers { fn update_unique_i_8(&self, n: i8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_i8", UpdateUniqueI8 { n, data }) + self.imp.call_reducer(153, UpdateUniqueI8 { n, data }) } fn on_update_unique_i_8( &self, mut callback: impl FnMut(&super::EventContext, &i8, &i32) + Send + 'static, ) -> UpdateUniqueI8CallbackId { UpdateUniqueI8CallbackId(self.imp.on_reducer::( - "update_unique_i8", + 153, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueI8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_i_8(&self, callback: UpdateUniqueI8CallbackId) { - self.imp - .remove_on_reducer::("update_unique_i8", callback.0) + self.imp.remove_on_reducer::(153, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_i_8 { impl set_flags_for_update_unique_i_8 for super::SetReducerFlags { fn update_unique_i_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_i8", flags); + self.imp.set_call_reducer_flags(153, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs index 4c0e9b403f4..c6b299ab670 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_identity_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_identity { impl update_unique_identity for super::RemoteReducers { fn update_unique_identity(&self, i: __sdk::Identity, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_identity", UpdateUniqueIdentity { i, data }) + self.imp.call_reducer(154, UpdateUniqueIdentity { i, data }) } fn on_update_unique_identity( &self, mut callback: impl FnMut(&super::EventContext, &__sdk::Identity, &i32) + Send + 'static, ) -> UpdateUniqueIdentityCallbackId { UpdateUniqueIdentityCallbackId(self.imp.on_reducer::( - "update_unique_identity", + 154, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueIdentity| callback(ctx, &args.i, &args.data)), )) } fn remove_on_update_unique_identity(&self, callback: UpdateUniqueIdentityCallbackId) { - self.imp - .remove_on_reducer::("update_unique_identity", callback.0) + self.imp.remove_on_reducer::(154, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_identity { impl set_flags_for_update_unique_identity for super::SetReducerFlags { fn update_unique_identity(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_identity", flags); + self.imp.set_call_reducer_flags(154, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs index 7de7b54e867..e623b14d9e9 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_string_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_string { impl update_unique_string for super::RemoteReducers { fn update_unique_string(&self, s: String, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_string", UpdateUniqueString { s, data }) + self.imp.call_reducer(155, UpdateUniqueString { s, data }) } fn on_update_unique_string( &self, mut callback: impl FnMut(&super::EventContext, &String, &i32) + Send + 'static, ) -> UpdateUniqueStringCallbackId { UpdateUniqueStringCallbackId(self.imp.on_reducer::( - "update_unique_string", + 155, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueString| callback(ctx, &args.s, &args.data)), )) } fn remove_on_update_unique_string(&self, callback: UpdateUniqueStringCallbackId) { - self.imp - .remove_on_reducer::("update_unique_string", callback.0) + self.imp.remove_on_reducer::(155, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_string { impl set_flags_for_update_unique_string for super::SetReducerFlags { fn update_unique_string(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_string", flags); + self.imp.set_call_reducer_flags(155, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs index e3bfb08dd7d..2bd11502da1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_128_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_u_128 { impl update_unique_u_128 for super::RemoteReducers { fn update_unique_u_128(&self, n: u128, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_u128", UpdateUniqueU128 { n, data }) + self.imp.call_reducer(156, UpdateUniqueU128 { n, data }) } fn on_update_unique_u_128( &self, mut callback: impl FnMut(&super::EventContext, &u128, &i32) + Send + 'static, ) -> UpdateUniqueU128CallbackId { UpdateUniqueU128CallbackId(self.imp.on_reducer::( - "update_unique_u128", + 156, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU128| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_u_128(&self, callback: UpdateUniqueU128CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u128", callback.0) + self.imp.remove_on_reducer::(156, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_u_128 { impl set_flags_for_update_unique_u_128 for super::SetReducerFlags { fn update_unique_u_128(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_u128", flags); + self.imp.set_call_reducer_flags(156, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs index 117f96a7fc5..7149c7c1aba 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_16_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_u_16 { impl update_unique_u_16 for super::RemoteReducers { fn update_unique_u_16(&self, n: u16, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u16", UpdateUniqueU16 { n, data }) + self.imp.call_reducer(157, UpdateUniqueU16 { n, data }) } fn on_update_unique_u_16( &self, mut callback: impl FnMut(&super::EventContext, &u16, &i32) + Send + 'static, ) -> UpdateUniqueU16CallbackId { UpdateUniqueU16CallbackId(self.imp.on_reducer::( - "update_unique_u16", + 157, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU16| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_u_16(&self, callback: UpdateUniqueU16CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u16", callback.0) + self.imp.remove_on_reducer::(157, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_u_16 { impl set_flags_for_update_unique_u_16 for super::SetReducerFlags { fn update_unique_u_16(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_u16", flags); + self.imp.set_call_reducer_flags(157, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs index b3194175dd3..1e0d2783321 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_256_reducer.rs @@ -53,21 +53,19 @@ pub trait update_unique_u_256 { impl update_unique_u_256 for super::RemoteReducers { fn update_unique_u_256(&self, n: __sats::u256, data: i32) -> __anyhow::Result<()> { - self.imp - .call_reducer("update_unique_u256", UpdateUniqueU256 { n, data }) + self.imp.call_reducer(158, UpdateUniqueU256 { n, data }) } fn on_update_unique_u_256( &self, mut callback: impl FnMut(&super::EventContext, &__sats::u256, &i32) + Send + 'static, ) -> UpdateUniqueU256CallbackId { UpdateUniqueU256CallbackId(self.imp.on_reducer::( - "update_unique_u256", + 158, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU256| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_u_256(&self, callback: UpdateUniqueU256CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u256", callback.0) + self.imp.remove_on_reducer::(158, callback.0) } } @@ -87,6 +85,6 @@ pub trait set_flags_for_update_unique_u_256 { impl set_flags_for_update_unique_u_256 for super::SetReducerFlags { fn update_unique_u_256(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_u256", flags); + self.imp.set_call_reducer_flags(158, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs index 8eb5b3bd4bb..8caf8817929 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_32_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_u_32 { impl update_unique_u_32 for super::RemoteReducers { fn update_unique_u_32(&self, n: u32, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u32", UpdateUniqueU32 { n, data }) + self.imp.call_reducer(159, UpdateUniqueU32 { n, data }) } fn on_update_unique_u_32( &self, mut callback: impl FnMut(&super::EventContext, &u32, &i32) + Send + 'static, ) -> UpdateUniqueU32CallbackId { UpdateUniqueU32CallbackId(self.imp.on_reducer::( - "update_unique_u32", + 159, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU32| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_u_32(&self, callback: UpdateUniqueU32CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u32", callback.0) + self.imp.remove_on_reducer::(159, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_u_32 { impl set_flags_for_update_unique_u_32 for super::SetReducerFlags { fn update_unique_u_32(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_u32", flags); + self.imp.set_call_reducer_flags(159, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs index 7d4fe9211f0..e051f4fe669 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_64_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_u_64 { impl update_unique_u_64 for super::RemoteReducers { fn update_unique_u_64(&self, n: u64, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u64", UpdateUniqueU64 { n, data }) + self.imp.call_reducer(160, UpdateUniqueU64 { n, data }) } fn on_update_unique_u_64( &self, mut callback: impl FnMut(&super::EventContext, &u64, &i32) + Send + 'static, ) -> UpdateUniqueU64CallbackId { UpdateUniqueU64CallbackId(self.imp.on_reducer::( - "update_unique_u64", + 160, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU64| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_u_64(&self, callback: UpdateUniqueU64CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u64", callback.0) + self.imp.remove_on_reducer::(160, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_u_64 { impl set_flags_for_update_unique_u_64 for super::SetReducerFlags { fn update_unique_u_64(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_u64", flags); + self.imp.set_call_reducer_flags(160, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs index cc5fd6db16b..9d62273ec54 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/update_unique_u_8_reducer.rs @@ -53,20 +53,19 @@ pub trait update_unique_u_8 { impl update_unique_u_8 for super::RemoteReducers { fn update_unique_u_8(&self, n: u8, data: i32) -> __anyhow::Result<()> { - self.imp.call_reducer("update_unique_u8", UpdateUniqueU8 { n, data }) + self.imp.call_reducer(161, UpdateUniqueU8 { n, data }) } fn on_update_unique_u_8( &self, mut callback: impl FnMut(&super::EventContext, &u8, &i32) + Send + 'static, ) -> UpdateUniqueU8CallbackId { UpdateUniqueU8CallbackId(self.imp.on_reducer::( - "update_unique_u8", + 161, Box::new(move |ctx: &super::EventContext, args: &UpdateUniqueU8| callback(ctx, &args.n, &args.data)), )) } fn remove_on_update_unique_u_8(&self, callback: UpdateUniqueU8CallbackId) { - self.imp - .remove_on_reducer::("update_unique_u8", callback.0) + self.imp.remove_on_reducer::(161, callback.0) } } @@ -86,6 +85,6 @@ pub trait set_flags_for_update_unique_u_8 { impl set_flags_for_update_unique_u_8 for super::SetReducerFlags { fn update_unique_u_8(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("update_unique_u8", flags); + self.imp.set_call_reducer_flags(161, flags); } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_address_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_address_table.rs index da1bceb6827..676cc61e28e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_address_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_address_table.rs @@ -35,7 +35,7 @@ pub trait VecAddressTableAccess { impl VecAddressTableAccess for super::RemoteTables { fn vec_address(&self) -> VecAddressTableHandle<'_> { VecAddressTableHandle { - imp: self.imp.get_table::("vec_address"), + imp: self.imp.get_table::(64), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_bool_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_bool_table.rs index 8f659d02195..dc14d99a5f4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_bool_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_bool_table.rs @@ -35,7 +35,7 @@ pub trait VecBoolTableAccess { impl VecBoolTableAccess for super::RemoteTables { fn vec_bool(&self) -> VecBoolTableHandle<'_> { VecBoolTableHandle { - imp: self.imp.get_table::("vec_bool"), + imp: self.imp.get_table::(65), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_byte_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_byte_struct_table.rs index fe6369b9d91..9be31541e42 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_byte_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_byte_struct_table.rs @@ -36,7 +36,7 @@ pub trait VecByteStructTableAccess { impl VecByteStructTableAccess for super::RemoteTables { fn vec_byte_struct(&self) -> VecByteStructTableHandle<'_> { VecByteStructTableHandle { - imp: self.imp.get_table::("vec_byte_struct"), + imp: self.imp.get_table::(66), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_enum_with_payload_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_enum_with_payload_table.rs index c656c228bbd..b159220d1cd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_enum_with_payload_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_enum_with_payload_table.rs @@ -36,7 +36,7 @@ pub trait VecEnumWithPayloadTableAccess { impl VecEnumWithPayloadTableAccess for super::RemoteTables { fn vec_enum_with_payload(&self) -> VecEnumWithPayloadTableHandle<'_> { VecEnumWithPayloadTableHandle { - imp: self.imp.get_table::("vec_enum_with_payload"), + imp: self.imp.get_table::(67), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_every_primitive_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_every_primitive_struct_table.rs index 1f9bcae583d..eacaeab308c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_every_primitive_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_every_primitive_struct_table.rs @@ -36,9 +36,7 @@ pub trait VecEveryPrimitiveStructTableAccess { impl VecEveryPrimitiveStructTableAccess for super::RemoteTables { fn vec_every_primitive_struct(&self) -> VecEveryPrimitiveStructTableHandle<'_> { VecEveryPrimitiveStructTableHandle { - imp: self - .imp - .get_table::("vec_every_primitive_struct"), + imp: self.imp.get_table::(68), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_every_vec_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_every_vec_struct_table.rs index f30c45bff34..39dd3548887 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_every_vec_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_every_vec_struct_table.rs @@ -36,7 +36,7 @@ pub trait VecEveryVecStructTableAccess { impl VecEveryVecStructTableAccess for super::RemoteTables { fn vec_every_vec_struct(&self) -> VecEveryVecStructTableHandle<'_> { VecEveryVecStructTableHandle { - imp: self.imp.get_table::("vec_every_vec_struct"), + imp: self.imp.get_table::(69), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_f_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_f_32_table.rs index 4eb4fe87054..f0f6ee9b7f1 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_f_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_f_32_table.rs @@ -35,7 +35,7 @@ pub trait VecF32TableAccess { impl VecF32TableAccess for super::RemoteTables { fn vec_f_32(&self) -> VecF32TableHandle<'_> { VecF32TableHandle { - imp: self.imp.get_table::("vec_f32"), + imp: self.imp.get_table::(70), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_f_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_f_64_table.rs index 838573c5018..1696f579f0c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_f_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_f_64_table.rs @@ -35,7 +35,7 @@ pub trait VecF64TableAccess { impl VecF64TableAccess for super::RemoteTables { fn vec_f_64(&self) -> VecF64TableHandle<'_> { VecF64TableHandle { - imp: self.imp.get_table::("vec_f64"), + imp: self.imp.get_table::(71), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_i_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_i_128_table.rs index dc16bc1b95e..2b6029168b0 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_i_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_i_128_table.rs @@ -35,7 +35,7 @@ pub trait VecI128TableAccess { impl VecI128TableAccess for super::RemoteTables { fn vec_i_128(&self) -> VecI128TableHandle<'_> { VecI128TableHandle { - imp: self.imp.get_table::("vec_i128"), + imp: self.imp.get_table::(72), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_i_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_i_16_table.rs index b152c36eec3..399e2f72539 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_i_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_i_16_table.rs @@ -35,7 +35,7 @@ pub trait VecI16TableAccess { impl VecI16TableAccess for super::RemoteTables { fn vec_i_16(&self) -> VecI16TableHandle<'_> { VecI16TableHandle { - imp: self.imp.get_table::("vec_i16"), + imp: self.imp.get_table::(73), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_i_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_i_256_table.rs index 30e32027363..6dab4a1e323 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_i_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_i_256_table.rs @@ -35,7 +35,7 @@ pub trait VecI256TableAccess { impl VecI256TableAccess for super::RemoteTables { fn vec_i_256(&self) -> VecI256TableHandle<'_> { VecI256TableHandle { - imp: self.imp.get_table::("vec_i256"), + imp: self.imp.get_table::(74), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_i_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_i_32_table.rs index 0f091dbc77e..26132a262d4 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_i_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_i_32_table.rs @@ -35,7 +35,7 @@ pub trait VecI32TableAccess { impl VecI32TableAccess for super::RemoteTables { fn vec_i_32(&self) -> VecI32TableHandle<'_> { VecI32TableHandle { - imp: self.imp.get_table::("vec_i32"), + imp: self.imp.get_table::(75), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_i_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_i_64_table.rs index b165fa68c8a..982ddc69922 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_i_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_i_64_table.rs @@ -35,7 +35,7 @@ pub trait VecI64TableAccess { impl VecI64TableAccess for super::RemoteTables { fn vec_i_64(&self) -> VecI64TableHandle<'_> { VecI64TableHandle { - imp: self.imp.get_table::("vec_i64"), + imp: self.imp.get_table::(76), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_i_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_i_8_table.rs index 15e8abf384b..ad362fb647c 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_i_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_i_8_table.rs @@ -35,7 +35,7 @@ pub trait VecI8TableAccess { impl VecI8TableAccess for super::RemoteTables { fn vec_i_8(&self) -> VecI8TableHandle<'_> { VecI8TableHandle { - imp: self.imp.get_table::("vec_i8"), + imp: self.imp.get_table::(77), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_identity_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_identity_table.rs index 5e1828b30f1..6a544617305 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_identity_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_identity_table.rs @@ -35,7 +35,7 @@ pub trait VecIdentityTableAccess { impl VecIdentityTableAccess for super::RemoteTables { fn vec_identity(&self) -> VecIdentityTableHandle<'_> { VecIdentityTableHandle { - imp: self.imp.get_table::("vec_identity"), + imp: self.imp.get_table::(78), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_simple_enum_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_simple_enum_table.rs index 8c35332e50e..93d5482430e 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_simple_enum_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_simple_enum_table.rs @@ -36,7 +36,7 @@ pub trait VecSimpleEnumTableAccess { impl VecSimpleEnumTableAccess for super::RemoteTables { fn vec_simple_enum(&self) -> VecSimpleEnumTableHandle<'_> { VecSimpleEnumTableHandle { - imp: self.imp.get_table::("vec_simple_enum"), + imp: self.imp.get_table::(79), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_string_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_string_table.rs index 42842147191..5181e7fbfb6 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_string_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_string_table.rs @@ -35,7 +35,7 @@ pub trait VecStringTableAccess { impl VecStringTableAccess for super::RemoteTables { fn vec_string(&self) -> VecStringTableHandle<'_> { VecStringTableHandle { - imp: self.imp.get_table::("vec_string"), + imp: self.imp.get_table::(80), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_u_128_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_u_128_table.rs index 867532ef356..63ddfef3637 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_u_128_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_u_128_table.rs @@ -35,7 +35,7 @@ pub trait VecU128TableAccess { impl VecU128TableAccess for super::RemoteTables { fn vec_u_128(&self) -> VecU128TableHandle<'_> { VecU128TableHandle { - imp: self.imp.get_table::("vec_u128"), + imp: self.imp.get_table::(81), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_u_16_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_u_16_table.rs index 7c4ace51e70..ab83f44dffd 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_u_16_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_u_16_table.rs @@ -35,7 +35,7 @@ pub trait VecU16TableAccess { impl VecU16TableAccess for super::RemoteTables { fn vec_u_16(&self) -> VecU16TableHandle<'_> { VecU16TableHandle { - imp: self.imp.get_table::("vec_u16"), + imp: self.imp.get_table::(82), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_u_256_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_u_256_table.rs index 368682740be..e2ab5ff37ff 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_u_256_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_u_256_table.rs @@ -35,7 +35,7 @@ pub trait VecU256TableAccess { impl VecU256TableAccess for super::RemoteTables { fn vec_u_256(&self) -> VecU256TableHandle<'_> { VecU256TableHandle { - imp: self.imp.get_table::("vec_u256"), + imp: self.imp.get_table::(83), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_u_32_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_u_32_table.rs index 4777a2271b2..9be4748fae5 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_u_32_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_u_32_table.rs @@ -35,7 +35,7 @@ pub trait VecU32TableAccess { impl VecU32TableAccess for super::RemoteTables { fn vec_u_32(&self) -> VecU32TableHandle<'_> { VecU32TableHandle { - imp: self.imp.get_table::("vec_u32"), + imp: self.imp.get_table::(84), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_u_64_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_u_64_table.rs index f8f9dd26a84..80d4074bffa 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_u_64_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_u_64_table.rs @@ -35,7 +35,7 @@ pub trait VecU64TableAccess { impl VecU64TableAccess for super::RemoteTables { fn vec_u_64(&self) -> VecU64TableHandle<'_> { VecU64TableHandle { - imp: self.imp.get_table::("vec_u64"), + imp: self.imp.get_table::(85), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_u_8_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_u_8_table.rs index 75b7c377c68..2c65dd3c662 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_u_8_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_u_8_table.rs @@ -35,7 +35,7 @@ pub trait VecU8TableAccess { impl VecU8TableAccess for super::RemoteTables { fn vec_u_8(&self) -> VecU8TableHandle<'_> { VecU8TableHandle { - imp: self.imp.get_table::("vec_u8"), + imp: self.imp.get_table::(86), ctx: std::marker::PhantomData, } } diff --git a/crates/sdk/tests/test-client/src/module_bindings/vec_unit_struct_table.rs b/crates/sdk/tests/test-client/src/module_bindings/vec_unit_struct_table.rs index 35c9fd01242..87125ebe268 100644 --- a/crates/sdk/tests/test-client/src/module_bindings/vec_unit_struct_table.rs +++ b/crates/sdk/tests/test-client/src/module_bindings/vec_unit_struct_table.rs @@ -36,7 +36,7 @@ pub trait VecUnitStructTableAccess { impl VecUnitStructTableAccess for super::RemoteTables { fn vec_unit_struct(&self) -> VecUnitStructTableHandle<'_> { VecUnitStructTableHandle { - imp: self.imp.get_table::("vec_unit_struct"), + imp: self.imp.get_table::(87), ctx: std::marker::PhantomData, } } From bf20b11033f5a8efb2abaa31dc2ec31e6da7beb7 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 23 Oct 2024 03:44:43 +0200 Subject: [PATCH 03/11] fix standalone_integration_test --- .../tests/standalone_integration_test.rs | 62 +++++++++---------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/crates/testing/tests/standalone_integration_test.rs b/crates/testing/tests/standalone_integration_test.rs index 3f458f4d9e5..a785316ff77 100644 --- a/crates/testing/tests/standalone_integration_test.rs +++ b/crates/testing/tests/standalone_integration_test.rs @@ -37,6 +37,23 @@ async fn read_logs(module: &ModuleHandle) -> Vec { .collect::>() } +async fn call_reducer(module: &ModuleHandle, reducer: &str, args: &str, request_id: u32) { + let reducer_id = module.client.module.info().reducers_map.lookup_id(reducer).unwrap(); + + let json = format!( + r#"{{ + "CallReducer": {{ + "reducer_id": {reducer_id}, + "args": {args}, + "request_id": {request_id}, + "flags": 0 + }} + }}"# + ) + .to_string(); + module.send(json).await.unwrap(); +} + // The tests MUST be run in sequence because they read the OS environment // and can cause a race when run in parallel. @@ -46,24 +63,10 @@ fn test_calling_a_reducer_in_module(module_name: &'static str) { CompiledModule::compile(module_name, CompilationMode::Debug).with_module_async( DEFAULT_CONFIG, |module| async move { - let json = - r#"{"CallReducer": {"reducer": "add", "args": "[\"Tyrion\", 24]", "request_id": 0, "flags": 0 }}"# - .to_string(); - module.send(json).await.unwrap(); - - let json = - r#"{"CallReducer": {"reducer": "add", "args": "[\"Cersei\", 31]", "request_id": 1, "flags": 0 }}"# - .to_string(); - module.send(json).await.unwrap(); - - let json = - r#"{"CallReducer": {"reducer": "say_hello", "args": "[]", "request_id": 2, "flags": 0 }}"#.to_string(); - module.send(json).await.unwrap(); - - let json = r#"{"CallReducer": {"reducer": "list_over_age", "args": "[30]", "request_id": 3, "flags": 0 }}"# - .to_string(); - module.send(json).await.unwrap(); - + call_reducer(&module, "add", "[\"Tyrion\", 24]", 0).await; + call_reducer(&module, "add", "[\"Cersei\", 31]", 1).await; + call_reducer(&module, "say_hello", "[]", 2).await; + call_reducer(&module, "list_over_age", "[30]", 3).await; assert_eq!( read_logs(&module).await, [ @@ -174,16 +177,11 @@ fn test_call_query_macro() { // Hand-written JSON. This will fail if the JSON encoding of `ClientMessage` changes. test_call_query_macro_with_caller(|module| async move { // Note that JSON doesn't allow multiline strings, so the encoded args string must be on one line! - let json = r#" -{ "CallReducer": { - "reducer": "test", - "args": - "[ { \"x\": 0, \"y\": 2, \"z\": \"Macro\" }, { \"foo\": \"Foo\" }, { \"Foo\": {} }, { \"Baz\": \"buzz\" } ]", - "request_id": 0, - "flags": 0 -} }"# - .to_string(); - module.send(json).await.unwrap(); + call_reducer( + &module, + "test", "[ { \"x\": 0, \"y\": 2, \"z\": \"Macro\" }, { \"foo\": \"Foo\" }, { \"Foo\": {} }, { \"Baz\": \"buzz\" } ]", + 0, + ).await; }); let args_pv = product![ @@ -256,13 +254,9 @@ fn test_index_scans() { } async fn bench_call<'a>(module: &ModuleHandle, call: &str, count: &u32) -> Duration { - let json = - format!(r#"{{"CallReducer": {{"reducer": "{call}", "args": "[{count}]", "request_id": 0, "flags": 0 }}}}"#); - + let args = format!("\"[{count}]\""); let now = Instant::now(); - - module.send(json).await.unwrap(); - + call_reducer(module, call, &args, 0).await; now.elapsed() } From 29972843d8a1045a049ecfad02aa3fb843a1718e Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 23 Oct 2024 08:50:19 +0200 Subject: [PATCH 04/11] implement ids-no-names in c# sdk codegen --- crates/cli/src/subcommands/generate/csharp.rs | 72 +++++++++---------- crates/cli/src/subcommands/generate/mod.rs | 22 +++--- 2 files changed, 46 insertions(+), 48 deletions(-) diff --git a/crates/cli/src/subcommands/generate/csharp.rs b/crates/cli/src/subcommands/generate/csharp.rs index 5758bf69d60..215273f4c29 100644 --- a/crates/cli/src/subcommands/generate/csharp.rs +++ b/crates/cli/src/subcommands/generate/csharp.rs @@ -5,6 +5,7 @@ use std::fmt::{self, Write}; use std::ops::Deref; use convert_case::{Case, Casing}; +use itertools::Itertools; use spacetimedb_lib::sats::{AlgebraicType, AlgebraicTypeRef, ArrayType, ProductType, SumType}; use spacetimedb_lib::ReducerDef; use spacetimedb_primitives::ColList; @@ -505,7 +506,7 @@ fn autogen_csharp_access_funcs_for_struct( } } -pub fn autogen_csharp_reducer(ctx: &GenCtx, reducer: &ReducerDef, namespace: &str) -> String { +pub fn autogen_csharp_reducer(ctx: &GenCtx, reducer_idx: usize, reducer: &ReducerDef, namespace: &str) -> String { let func_name = &*reducer.name; let func_name_pascal_case = func_name.to_case(Case::Pascal); @@ -515,7 +516,7 @@ pub fn autogen_csharp_reducer(ctx: &GenCtx, reducer: &ReducerDef, namespace: &st writeln!(output, "[SpacetimeDB.Type]"); writeln!(output, "public partial class {func_name_pascal_case} : IReducerArgs"); indented_block(&mut output, |output| { - writeln!(output, "string IReducerArgs.ReducerName => \"{func_name}\";"); + writeln!(output, "uint IReducerArgs.ReducerIndex => {reducer_idx};"); if !reducer.args.is_empty() { writeln!(output); } @@ -542,13 +543,17 @@ pub fn autogen_csharp_reducer(ctx: &GenCtx, reducer: &ReducerDef, namespace: &st pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) -> Vec<(String, String)> { let mut results = Vec::new(); - let tables = items.iter().filter_map(|i| { - if let GenItem::Table(table) = i { - Some(table) - } else { - None - } - }); + let tables: Vec<_> = items + .iter() + .filter_map(|i| { + if let GenItem::Table(table) = i { + Some(table) + } else { + None + } + }) + .sorted_by_key(|t| &t.schema.table_name) + .collect(); let reducers: Vec<&ReducerDef> = items .iter() @@ -559,6 +564,7 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) None } }) + .sorted_by_key(|i| &i.name) .collect(); let reducer_names: Vec = reducers .iter() @@ -569,7 +575,7 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) writeln!(output, "public sealed class RemoteTables"); indented_block(&mut output, |output| { - for table in tables { + for &table in &tables { let schema = &table.schema; let name = &schema.table_name; let csharp_name = name.as_ref().to_case(Case::Pascal); @@ -761,8 +767,6 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) writeln!(output, "{reducer_name} {reducer_name},"); } writeln!(output, "Unit StdbNone,"); - writeln!(output, "Unit StdbIdentityConnected,"); - writeln!(output, "Unit StdbIdentityDisconnected"); } writeln!(output, ")>;"); @@ -782,43 +786,33 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) writeln!(output, "Reducers = new(this, this.SetReducerFlags);"); writeln!(output); - for item in items { - if let GenItem::Table(table) = item { - writeln!( - output, - "clientDB.AddTable<{table_type}>(\"{table_name}\", Db.{csharp_table_name});", - table_type = csharp_typename(ctx, table.data), - table_name = table.schema.table_name, - csharp_table_name = table.schema.table_name.as_ref().to_case(Case::Pascal) - ); - } + for (table_idx, &table) in tables.iter().enumerate() { + writeln!( + output, + "clientDB.AddTable<{table_type}>({table_idx}, Db.{csharp_table_name});", + table_type = csharp_typename(ctx, table.data), + csharp_table_name = table.schema.table_name.as_ref().to_case(Case::Pascal) + ); } }); writeln!(output); - writeln!(output, "protected override Reducer ToReducer(TransactionUpdate update)"); + writeln!( + output, + "protected override Reducer ToReducer(uint reducerIdx, TransactionUpdate update)" + ); indented_block(output, |output| { writeln!(output, "var encodedArgs = update.ReducerCall.Args;"); - writeln!(output, "return update.ReducerCall.ReducerName switch {{"); + writeln!(output, "return reducerIdx switch {{"); { indent_scope!(output); - for (reducer, reducer_name) in std::iter::zip(&reducers, &reducer_names) { - let reducer_str_name = &reducer.name; + for (reducer_idx, reducer_name) in reducer_names.iter().enumerate() { writeln!( output, - "\"{reducer_str_name}\" => new Reducer.{reducer_name}(BSATNHelpers.Decode<{reducer_name}>(encodedArgs))," + "{reducer_idx} => new Reducer.{reducer_name}(BSATNHelpers.Decode<{reducer_name}>(encodedArgs))," ); } - writeln!(output, "\"\" => new Reducer.StdbNone(default),"); - writeln!( - output, - "\"__identity_connected__\" => new Reducer.StdbIdentityConnected(default)," - ); - writeln!( - output, - "\"__identity_disconnected__\" => new Reducer.StdbIdentityDisconnected(default)," - ); - writeln!(output, "\"\" => new Reducer.StdbNone(default),"); //Transaction from CLI command + writeln!(output, "4294967295 => new Reducer.StdbNone(default),"); writeln!( output, r#"var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {{reducer}}")"# @@ -850,9 +844,7 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) "Reducer.{reducer_name}(var args) => Reducers.Invoke{reducer_name}(eventContext, args)," ); } - writeln!(output, "Reducer.StdbNone or"); - writeln!(output, "Reducer.StdbIdentityConnected or"); - writeln!(output, "Reducer.StdbIdentityDisconnected => true,"); + writeln!(output, "Reducer.StdbNone => true,"); writeln!( output, r#"_ => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {{reducer}}")"# diff --git a/crates/cli/src/subcommands/generate/mod.rs b/crates/cli/src/subcommands/generate/mod.rs index 911b3d78fdd..9663af294fc 100644 --- a/crates/cli/src/subcommands/generate/mod.rs +++ b/crates/cli/src/subcommands/generate/mod.rs @@ -267,15 +267,14 @@ pub fn generate(module: RawModuleDef, lang: Language, namespace: &str) -> anyhow let items = itertools::chain!( types, tables.into_iter().map(GenItem::Table), - reducers - .filter(|r| !(r.name.starts_with("__") && r.name.ends_with("__"))) - .map(GenItem::Reducer), + reducers.map(GenItem::Reducer), ); let items: Vec = items.collect(); + let reducer_idx = &mut 0; let mut files: Vec<(String, String)> = items .iter() - .filter_map(|item| item.generate(&ctx, lang, namespace)) + .filter_map(|item| item.generate(&ctx, reducer_idx, lang, namespace)) .collect(); files.extend(generate_globals(&ctx, lang, namespace, &items)); files @@ -340,15 +339,21 @@ fn generate_globals(ctx: &GenCtx, lang: Language, namespace: &str, items: &[GenI } impl GenItem { - fn generate(&self, ctx: &GenCtx, lang: Language, namespace: &str) -> Option<(String, String)> { + fn generate( + &self, + ctx: &GenCtx, + reducer_idx: &mut usize, + lang: Language, + namespace: &str, + ) -> Option<(String, String)> { match lang { - Language::Csharp => self.generate_csharp(ctx, namespace), + Language::Csharp => self.generate_csharp(ctx, reducer_idx, namespace), Language::TypeScript => unreachable!(), Language::Rust => unreachable!(), } } - fn generate_csharp(&self, ctx: &GenCtx, namespace: &str) -> Option<(String, String)> { + fn generate_csharp(&self, ctx: &GenCtx, reducer_idx: &mut usize, namespace: &str) -> Option<(String, String)> { match self { GenItem::Table(table) => { let code = csharp::autogen_csharp_table(ctx, table, namespace); @@ -367,7 +372,8 @@ impl GenItem { _ => todo!(), }, GenItem::Reducer(reducer) => { - let code = csharp::autogen_csharp_reducer(ctx, reducer, namespace); + let code = csharp::autogen_csharp_reducer(ctx, *reducer_idx, reducer, namespace); + *reducer_idx += 1; let pascalcase = reducer.name.deref().to_case(Case::Pascal); Some((pascalcase + "Reducer.cs", code)) } From da03bf3409eb62b520a3f808c254d948222b55be Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 23 Oct 2024 09:20:50 +0200 Subject: [PATCH 05/11] fix rebase fallout --- crates/core/src/host/module_host.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/core/src/host/module_host.rs b/crates/core/src/host/module_host.rs index eb07fad00bd..720c254fa0f 100644 --- a/crates/core/src/host/module_host.rs +++ b/crates/core/src/host/module_host.rs @@ -932,7 +932,9 @@ impl ModuleHost { let db = self.db(); let auth = self.auth_ctx_for(identity); let (table_names, table_ids): (Vec<_>, Vec<_>) = db - .with_read_only(&ExecutionContext::internal(db.address()), |tx| db.get_all_tables(tx)) + .with_read_only(&ExecutionContext::internal(db.database_identity()), |tx| { + db.get_all_tables(tx) + }) .expect("ids_to_name: database in a broken state?") .iter() .filter(|schema| is_table_visible(schema, &auth)) From 4f796f6eea9c7a45b485a9f799b193e29a0b64d2 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 23 Oct 2024 09:38:19 +0200 Subject: [PATCH 06/11] fix 'Unit StdbNone' syntax error --- crates/cli/src/subcommands/generate/csharp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/src/subcommands/generate/csharp.rs b/crates/cli/src/subcommands/generate/csharp.rs index 215273f4c29..2b1f0047c08 100644 --- a/crates/cli/src/subcommands/generate/csharp.rs +++ b/crates/cli/src/subcommands/generate/csharp.rs @@ -766,7 +766,7 @@ pub fn autogen_csharp_globals(ctx: &GenCtx, items: &[GenItem], namespace: &str) for reducer_name in &reducer_names { writeln!(output, "{reducer_name} {reducer_name},"); } - writeln!(output, "Unit StdbNone,"); + writeln!(output, "Unit StdbNone"); } writeln!(output, ")>;"); From ec75753b275c0d5c5857d4c91f6902c1db350e19 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 23 Oct 2024 16:29:41 +0200 Subject: [PATCH 07/11] bless insta snapshots --- .../snapshots/codegen__codegen_csharp.snap | 145 +++++++++++++----- 1 file changed, 108 insertions(+), 37 deletions(-) diff --git a/crates/cli/tests/snapshots/codegen__codegen_csharp.snap b/crates/cli/tests/snapshots/codegen__codegen_csharp.snap index 686b9144c81..fe3895c5b54 100644 --- a/crates/cli/tests/snapshots/codegen__codegen_csharp.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_csharp.snap @@ -16,7 +16,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class AddPlayer : IReducerArgs { - string IReducerArgs.ReducerName => "add_player"; + uint IReducerArgs.ReducerIndex => 2; public string Name = ""; } @@ -36,7 +36,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class AddPrivate : IReducerArgs { - string IReducerArgs.ReducerName => "add_private"; + uint IReducerArgs.ReducerIndex => 3; public string Name = ""; } @@ -91,7 +91,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class DeletePlayer : IReducerArgs { - string IReducerArgs.ReducerName => "delete_player"; + uint IReducerArgs.ReducerIndex => 4; public ulong Id; } @@ -111,7 +111,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class DeletePlayersByName : IReducerArgs { - string IReducerArgs.ReducerName => "delete_players_by_name"; + uint IReducerArgs.ReducerIndex => 5; public string Name = ""; } @@ -176,6 +176,42 @@ namespace SpacetimeDB } } ''' +"IdentityConnectedReducer.cs" = ''' +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. +// + +#nullable enable + +using System; + +namespace SpacetimeDB +{ + [SpacetimeDB.Type] + public partial class IdentityConnected : IReducerArgs + { + uint IReducerArgs.ReducerIndex => 0; + } +} +''' +"InitReducer.cs" = ''' +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. +// + +#nullable enable + +using System; + +namespace SpacetimeDB +{ + [SpacetimeDB.Type] + public partial class Init : IReducerArgs + { + uint IReducerArgs.ReducerIndex => 1; + } +} +''' "NamespaceTestC.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD. @@ -351,7 +387,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class QueryPrivate : IReducerArgs { - string IReducerArgs.ReducerName => "query_private"; + uint IReducerArgs.ReducerIndex => 6; } } ''' @@ -412,7 +448,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class RepeatingTest : IReducerArgs { - string IReducerArgs.ReducerName => "repeating_test"; + uint IReducerArgs.ReducerIndex => 7; public SpacetimeDB.RepeatingTestArg Arg = new(); } @@ -510,7 +546,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class TestBtreeIndexArgs : IReducerArgs { - string IReducerArgs.ReducerName => "test_btree_index_args"; + uint IReducerArgs.ReducerIndex => 9; } } ''' @@ -636,7 +672,7 @@ namespace SpacetimeDB [SpacetimeDB.Type] public partial class Test : IReducerArgs { - string IReducerArgs.ReducerName => "test"; + uint IReducerArgs.ReducerIndex => 8; public SpacetimeDB.TestA Arg = new(); public SpacetimeDB.TestB Arg2 = new(); @@ -882,6 +918,38 @@ namespace SpacetimeDB { internal RemoteReducers(DbConnection conn, SetReducerFlags SetReducerFlags) : base(conn) { this.SetCallReducerFlags = SetReducerFlags; } internal readonly SetReducerFlags SetCallReducerFlags; + public delegate void IdentityConnectedHandler(EventContext ctx); + public event IdentityConnectedHandler? OnIdentityConnected; + + public void IdentityConnected() + { + conn.InternalCallReducer(new IdentityConnected { }, this.SetCallReducerFlags.IdentityConnectedFlags); + } + + public bool InvokeIdentityConnected(EventContext ctx, IdentityConnected args) + { + if (OnIdentityConnected == null) return false; + OnIdentityConnected( + ctx + ); + return true; + } + public delegate void InitHandler(EventContext ctx); + public event InitHandler? OnInit; + + public void Init() + { + conn.InternalCallReducer(new Init { }, this.SetCallReducerFlags.InitFlags); + } + + public bool InvokeInit(EventContext ctx, Init args) + { + if (OnInit == null) return false; + OnInit( + ctx + ); + return true; + } public delegate void AddPlayerHandler(EventContext ctx, string name); public event AddPlayerHandler? OnAddPlayer; @@ -1024,6 +1092,10 @@ namespace SpacetimeDB public sealed class SetReducerFlags { internal SetReducerFlags() { } + internal CallReducerFlags IdentityConnectedFlags; + public void IdentityConnected(CallReducerFlags flags) { this.IdentityConnectedFlags = flags; } + internal CallReducerFlags InitFlags; + public void Init(CallReducerFlags flags) { this.InitFlags = flags; } internal CallReducerFlags AddPlayerFlags; public void AddPlayer(CallReducerFlags flags) { this.AddPlayerFlags = flags; } internal CallReducerFlags AddPrivateFlags; @@ -1058,6 +1130,8 @@ namespace SpacetimeDB [Type] public partial record Reducer : TaggedEnum<( + IdentityConnected IdentityConnected, + Init Init, AddPlayer AddPlayer, AddPrivate AddPrivate, DeletePlayer DeletePlayer, @@ -1066,9 +1140,7 @@ namespace SpacetimeDB RepeatingTest RepeatingTest, Test Test, TestBtreeIndexArgs TestBtreeIndexArgs, - Unit StdbNone, - Unit StdbIdentityConnected, - Unit StdbIdentityDisconnected + Unit StdbNone )>; public class DbConnection : DbConnectionBase { @@ -1081,33 +1153,32 @@ namespace SpacetimeDB SetReducerFlags = new(); Reducers = new(this, this.SetReducerFlags); - clientDB.AddTable("has_special_stuff", Db.HasSpecialStuff); - clientDB.AddTable("pk_multi_identity", Db.PkMultiIdentity); - clientDB.AddTable("points", Db.Points); - clientDB.AddTable("private", Db.Private); - clientDB.AddTable("repeating_test_arg", Db.RepeatingTestArg); - clientDB.AddTable("test_a", Db.TestA); - clientDB.AddTable("test_d", Db.TestD); - clientDB.AddTable("test_e", Db.TestE); - clientDB.AddTable("test_f", Db.TestF); + clientDB.AddTable(0, Db.HasSpecialStuff); + clientDB.AddTable(1, Db.PkMultiIdentity); + clientDB.AddTable(2, Db.Points); + clientDB.AddTable(3, Db.Private); + clientDB.AddTable(4, Db.RepeatingTestArg); + clientDB.AddTable(5, Db.TestA); + clientDB.AddTable(6, Db.TestD); + clientDB.AddTable(7, Db.TestE); + clientDB.AddTable(8, Db.TestF); } - protected override Reducer ToReducer(TransactionUpdate update) + protected override Reducer ToReducer(uint reducerIdx, TransactionUpdate update) { var encodedArgs = update.ReducerCall.Args; - return update.ReducerCall.ReducerName switch { - "add_player" => new Reducer.AddPlayer(BSATNHelpers.Decode(encodedArgs)), - "add_private" => new Reducer.AddPrivate(BSATNHelpers.Decode(encodedArgs)), - "delete_player" => new Reducer.DeletePlayer(BSATNHelpers.Decode(encodedArgs)), - "delete_players_by_name" => new Reducer.DeletePlayersByName(BSATNHelpers.Decode(encodedArgs)), - "query_private" => new Reducer.QueryPrivate(BSATNHelpers.Decode(encodedArgs)), - "repeating_test" => new Reducer.RepeatingTest(BSATNHelpers.Decode(encodedArgs)), - "test" => new Reducer.Test(BSATNHelpers.Decode(encodedArgs)), - "test_btree_index_args" => new Reducer.TestBtreeIndexArgs(BSATNHelpers.Decode(encodedArgs)), - "" => new Reducer.StdbNone(default), - "__identity_connected__" => new Reducer.StdbIdentityConnected(default), - "__identity_disconnected__" => new Reducer.StdbIdentityDisconnected(default), - "" => new Reducer.StdbNone(default), + return reducerIdx switch { + 0 => new Reducer.IdentityConnected(BSATNHelpers.Decode(encodedArgs)), + 1 => new Reducer.Init(BSATNHelpers.Decode(encodedArgs)), + 2 => new Reducer.AddPlayer(BSATNHelpers.Decode(encodedArgs)), + 3 => new Reducer.AddPrivate(BSATNHelpers.Decode(encodedArgs)), + 4 => new Reducer.DeletePlayer(BSATNHelpers.Decode(encodedArgs)), + 5 => new Reducer.DeletePlayersByName(BSATNHelpers.Decode(encodedArgs)), + 6 => new Reducer.QueryPrivate(BSATNHelpers.Decode(encodedArgs)), + 7 => new Reducer.RepeatingTest(BSATNHelpers.Decode(encodedArgs)), + 8 => new Reducer.Test(BSATNHelpers.Decode(encodedArgs)), + 9 => new Reducer.TestBtreeIndexArgs(BSATNHelpers.Decode(encodedArgs)), + 4294967295 => new Reducer.StdbNone(default), var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {reducer}") }; } @@ -1119,6 +1190,8 @@ namespace SpacetimeDB { var eventContext = (EventContext)context; return reducer switch { + Reducer.IdentityConnected(var args) => Reducers.InvokeIdentityConnected(eventContext, args), + Reducer.Init(var args) => Reducers.InvokeInit(eventContext, args), Reducer.AddPlayer(var args) => Reducers.InvokeAddPlayer(eventContext, args), Reducer.AddPrivate(var args) => Reducers.InvokeAddPrivate(eventContext, args), Reducer.DeletePlayer(var args) => Reducers.InvokeDeletePlayer(eventContext, args), @@ -1127,9 +1200,7 @@ namespace SpacetimeDB Reducer.RepeatingTest(var args) => Reducers.InvokeRepeatingTest(eventContext, args), Reducer.Test(var args) => Reducers.InvokeTest(eventContext, args), Reducer.TestBtreeIndexArgs(var args) => Reducers.InvokeTestBtreeIndexArgs(eventContext, args), - Reducer.StdbNone or - Reducer.StdbIdentityConnected or - Reducer.StdbIdentityDisconnected => true, + Reducer.StdbNone => true, _ => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {reducer}") }; } From 7efa5ea141456171d904e31b01f226f0e51bece5 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 24 Oct 2024 21:53:01 +0200 Subject: [PATCH 08/11] fix standalone_integration_test more --- crates/testing/tests/standalone_integration_test.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/testing/tests/standalone_integration_test.rs b/crates/testing/tests/standalone_integration_test.rs index a785316ff77..bbc502f98e4 100644 --- a/crates/testing/tests/standalone_integration_test.rs +++ b/crates/testing/tests/standalone_integration_test.rs @@ -63,10 +63,10 @@ fn test_calling_a_reducer_in_module(module_name: &'static str) { CompiledModule::compile(module_name, CompilationMode::Debug).with_module_async( DEFAULT_CONFIG, |module| async move { - call_reducer(&module, "add", "[\"Tyrion\", 24]", 0).await; - call_reducer(&module, "add", "[\"Cersei\", 31]", 1).await; - call_reducer(&module, "say_hello", "[]", 2).await; - call_reducer(&module, "list_over_age", "[30]", 3).await; + call_reducer(&module, "add", r#"[\"Tyrion\", 24]"#, 0).await; + call_reducer(&module, "add", r#"[\"Cersei\", 31]"#, 1).await; + call_reducer(&module, "say_hello", r#"[]"#, 2).await; + call_reducer(&module, "list_over_age", r#"[30]"#, 3).await; assert_eq!( read_logs(&module).await, [ @@ -179,7 +179,7 @@ fn test_call_query_macro() { // Note that JSON doesn't allow multiline strings, so the encoded args string must be on one line! call_reducer( &module, - "test", "[ { \"x\": 0, \"y\": 2, \"z\": \"Macro\" }, { \"foo\": \"Foo\" }, { \"Foo\": {} }, { \"Baz\": \"buzz\" } ]", + "test", r#"[ { \"x\": 0, \"y\": 2, \"z\": \"Macro\" }, { \"foo\": \"Foo\" }, { \"Foo\": {} }, { \"Baz\": \"buzz\" } ]"#, 0, ).await; }); @@ -254,7 +254,7 @@ fn test_index_scans() { } async fn bench_call<'a>(module: &ModuleHandle, call: &str, count: &u32) -> Duration { - let args = format!("\"[{count}]\""); + let args = format!(r#"[{count}]"#); let now = Instant::now(); call_reducer(module, call, &args, 0).await; now.elapsed() From 20954af74c41a4994621711f8a46ec5d1b7d8d4a Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 25 Oct 2024 00:10:07 +0200 Subject: [PATCH 09/11] 3 more reducer files generated, so 3 more namespaces --- smoketests/tests/namespaces.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/smoketests/tests/namespaces.py b/smoketests/tests/namespaces.py index b1bd0eb268a..91ba246c356 100644 --- a/smoketests/tests/namespaces.py +++ b/smoketests/tests/namespaces.py @@ -23,7 +23,7 @@ def test_spacetimedb_ns_csharp(self): with tempfile.TemporaryDirectory() as tmpdir: self.spacetime("generate", "--out-dir", tmpdir, "--lang=cs", "--project-path", self.project_path) - self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 4) + self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 7) def test_custom_ns_csharp(self): """Ensure that when a custom namespace is specified on the command line, it actually gets used in generation""" @@ -33,5 +33,5 @@ def test_custom_ns_csharp(self): with tempfile.TemporaryDirectory() as tmpdir: self.spacetime("generate", "--out-dir", tmpdir, "--lang=cs", "--namespace", namespace, "--project-path", self.project_path) - self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 4) - self.assertEqual(count_matches(tmpdir, "using SpacetimeDB;"), 4) + self.assertEqual(count_matches(tmpdir, f"namespace {namespace}"), 7) + self.assertEqual(count_matches(tmpdir, "using SpacetimeDB;"), 7) From 6fc632b9c36a4b55873924a2297aa3e2a11c8997 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 25 Oct 2024 00:34:41 +0200 Subject: [PATCH 10/11] fix standalone_integration_test yet again --- crates/testing/tests/standalone_integration_test.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/testing/tests/standalone_integration_test.rs b/crates/testing/tests/standalone_integration_test.rs index bbc502f98e4..2f439315607 100644 --- a/crates/testing/tests/standalone_integration_test.rs +++ b/crates/testing/tests/standalone_integration_test.rs @@ -44,7 +44,7 @@ async fn call_reducer(module: &ModuleHandle, reducer: &str, args: &str, request_ r#"{{ "CallReducer": {{ "reducer_id": {reducer_id}, - "args": {args}, + "args": "{args}", "request_id": {request_id}, "flags": 0 }} @@ -65,8 +65,8 @@ fn test_calling_a_reducer_in_module(module_name: &'static str) { |module| async move { call_reducer(&module, "add", r#"[\"Tyrion\", 24]"#, 0).await; call_reducer(&module, "add", r#"[\"Cersei\", 31]"#, 1).await; - call_reducer(&module, "say_hello", r#"[]"#, 2).await; - call_reducer(&module, "list_over_age", r#"[30]"#, 3).await; + call_reducer(&module, "say_hello", "[]", 2).await; + call_reducer(&module, "list_over_age", "[30]", 3).await; assert_eq!( read_logs(&module).await, [ @@ -254,7 +254,7 @@ fn test_index_scans() { } async fn bench_call<'a>(module: &ModuleHandle, call: &str, count: &u32) -> Duration { - let args = format!(r#"[{count}]"#); + let args = format!("[{count}]"); let now = Instant::now(); call_reducer(module, call, &args, 0).await; now.elapsed() From 42b315b4f084cacb0f90ad436205b1400fb85626 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 30 Oct 2024 14:50:51 +0100 Subject: [PATCH 11/11] fix rebase fallout + use Arc more for reducers --- crates/core/src/db/relational_db.rs | 4 ++-- crates/core/src/execution_context.rs | 6 +++--- crates/core/src/host/module_host.rs | 9 ++++----- crates/core/src/host/wasm_common/module_host_actor.rs | 8 ++++---- crates/core/src/host/wasmtime/wasm_instance_env.rs | 9 +++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/core/src/db/relational_db.rs b/crates/core/src/db/relational_db.rs index f4b3031e431..784ecb28110 100644 --- a/crates/core/src/db/relational_db.rs +++ b/crates/core/src/db/relational_db.rs @@ -2424,9 +2424,9 @@ mod tests { arg_bsatn, } = ReducerContext::try_from(&input).unwrap(); if i == 0 { - assert_eq!(reducer_name, "__identity_connected__"); + assert_eq!(&*reducer_name, "__identity_connected__"); } else { - assert_eq!(reducer_name, "abstract_concrete_proxy_factory_impl"); + assert_eq!(&*reducer_name, "abstract_concrete_proxy_factory_impl"); } assert!( arg_bsatn.is_empty(), diff --git a/crates/core/src/execution_context.rs b/crates/core/src/execution_context.rs index fa084404b24..fefacc65f21 100644 --- a/crates/core/src/execution_context.rs +++ b/crates/core/src/execution_context.rs @@ -26,7 +26,7 @@ pub struct ExecutionContext { #[derive(Clone)] pub struct ReducerContext { /// The name of the reducer. - pub name: String, + pub name: Arc, /// The [`Identity`] of the caller. pub caller_identity: Identity, /// The [`Address`] of the caller. @@ -81,7 +81,7 @@ impl TryFrom<&txdata::Inputs> for ReducerContext { let timestamp = bsatn::from_reader(args)?; Ok(Self { - name: inputs.reducer_name.to_string(), + name: inputs.reducer_name.as_str().into(), caller_identity, caller_address, timestamp, @@ -200,7 +200,7 @@ impl ExecutionContext { /// If this is a reducer context, returns the name of the reducer. #[inline] pub fn reducer_name(&self) -> &str { - self.reducer.as_ref().map(|ctx| ctx.name.as_str()).unwrap_or_default() + self.reducer.as_ref().map(|ctx| &*ctx.name).unwrap_or_default() } /// If this is a reducer context, returns the full reducer metadata. diff --git a/crates/core/src/host/module_host.rs b/crates/core/src/host/module_host.rs index 720c254fa0f..bec86e04a59 100644 --- a/crates/core/src/host/module_host.rs +++ b/crates/core/src/host/module_host.rs @@ -592,7 +592,8 @@ impl ModuleHost { let db = self.db(); let workload = || { Workload::Reducer(ReducerContext { - name: reducer_name.to_owned(), + // TODO(perf, centril): consider allowing `&'static str | Arc`, perhaps flexstr. + name: reducer_name.into(), caller_identity, caller_address, timestamp: Timestamp::now(), @@ -794,7 +795,7 @@ impl ModuleHost { tx.ctx = ExecutionContext::with_workload( tx.ctx.database_identity(), Workload::Reducer(ReducerContext { - name: reducer.into(), + name: reducer, caller_identity: params.caller_identity, caller_address: params.caller_address, timestamp: Timestamp::now(), @@ -932,9 +933,7 @@ impl ModuleHost { let db = self.db(); let auth = self.auth_ctx_for(identity); let (table_names, table_ids): (Vec<_>, Vec<_>) = db - .with_read_only(&ExecutionContext::internal(db.database_identity()), |tx| { - db.get_all_tables(tx) - }) + .with_read_only(Workload::Internal, |tx| db.get_all_tables(tx)) .expect("ids_to_name: database in a broken state?") .iter() .filter(|schema| is_table_visible(schema, &auth)) diff --git a/crates/core/src/host/wasm_common/module_host_actor.rs b/crates/core/src/host/wasm_common/module_host_actor.rs index e90116e4532..975ce0424ba 100644 --- a/crates/core/src/host/wasm_common/module_host_actor.rs +++ b/crates/core/src/host/wasm_common/module_host_actor.rs @@ -429,7 +429,7 @@ impl WasmModuleInstance { let op = ReducerOp { id: reducer_id, - name: reducer_name, + name: reducer_name_arc.clone(), caller_identity: &caller_identity, caller_address: &caller_address, timestamp, @@ -444,7 +444,7 @@ impl WasmModuleInstance { }); let _guard = WORKER_METRICS .reducer_plus_query_duration - .with_label_values(&address, op.name) + .with_label_values(&address, reducer_name) .with_timer(tx.timer); let mut tx_slot = self.instance.instance_env().tx.clone(); @@ -576,7 +576,7 @@ impl WasmModuleInstance { #[derive(Clone, Debug)] pub struct ReducerOp<'a> { pub id: ReducerId, - pub name: &'a str, + pub name: Arc, pub caller_identity: &'a Identity, pub caller_address: &'a Address, pub timestamp: Timestamp, @@ -596,7 +596,7 @@ impl From> for execution_context::ReducerContext { }: ReducerOp<'_>, ) -> Self { Self { - name: name.to_owned(), + name, caller_identity: *caller_identity, caller_address: *caller_address, timestamp, diff --git a/crates/core/src/host/wasmtime/wasm_instance_env.rs b/crates/core/src/host/wasmtime/wasm_instance_env.rs index faf640b6d73..a7de34b57d9 100644 --- a/crates/core/src/host/wasmtime/wasm_instance_env.rs +++ b/crates/core/src/host/wasmtime/wasm_instance_env.rs @@ -1,5 +1,6 @@ #![allow(clippy::too_many_arguments)] +use std::sync::Arc; use std::time::Instant; use crate::database_logger::{BacktraceFrame, BacktraceProvider, ModuleBacktrace, Record}; @@ -72,7 +73,7 @@ pub(super) struct WasmInstanceEnv { call_times: CallTimes, /// The last, including current, reducer to be executed by this environment. - reducer_name: String, + reducer_name: Arc, } const CALL_REDUCER_ARGS_SOURCE: u32 = 1; @@ -96,7 +97,7 @@ impl WasmInstanceEnv { timing_spans: Default::default(), reducer_start, call_times: CallTimes::new(), - reducer_name: String::from(""), + reducer_name: "".into(), } } @@ -138,7 +139,7 @@ impl WasmInstanceEnv { /// /// Returns the handle used by reducers to read from `args` /// as well as the handle used to write the error message, if any. - pub fn start_reducer(&mut self, name: &str, args: bytes::Bytes) -> (u32, u32) { + pub fn start_reducer(&mut self, name: Arc, args: bytes::Bytes) -> (u32, u32) { let errors = self.setup_standard_bytes_sink(); // Pass an invalid source when the reducer args were empty. @@ -151,7 +152,7 @@ impl WasmInstanceEnv { }; self.reducer_start = Instant::now(); - name.clone_into(&mut self.reducer_name); + self.reducer_name = name; (args, errors) }