@@ -46,6 +46,7 @@ use spacetimedb_sats::algebraic_type::fmt::fmt_algebraic_type;
4646use spacetimedb_sats:: memory_usage:: MemoryUsage ;
4747use spacetimedb_sats:: { AlgebraicType , AlgebraicValue , ProductType , ProductValue } ;
4848use spacetimedb_schema:: def:: { ModuleDef , TableDef , ViewDef } ;
49+ use spacetimedb_schema:: reducer_name:: ReducerName ;
4950use spacetimedb_schema:: schema:: {
5051 ColumnSchema , IndexSchema , RowLevelSecuritySchema , Schema , SequenceSchema , TableSchema ,
5152} ;
@@ -769,7 +770,7 @@ impl RelationalDB {
769770 }
770771
771772 #[ tracing:: instrument( level = "trace" , skip_all) ]
772- pub fn rollback_mut_tx ( & self , tx : MutTx ) -> ( TxOffset , TxMetrics , String ) {
773+ pub fn rollback_mut_tx ( & self , tx : MutTx ) -> ( TxOffset , TxMetrics , ReducerName ) {
773774 log:: trace!( "ROLLBACK MUT TX" ) ;
774775 self . inner . rollback_mut_tx ( tx)
775776 }
@@ -781,14 +782,14 @@ impl RelationalDB {
781782 }
782783
783784 #[ tracing:: instrument( level = "trace" , skip_all) ]
784- pub fn release_tx ( & self , tx : Tx ) -> ( TxOffset , TxMetrics , String ) {
785+ pub fn release_tx ( & self , tx : Tx ) -> ( TxOffset , TxMetrics , ReducerName ) {
785786 log:: trace!( "RELEASE TX" ) ;
786787 self . inner . release_tx ( tx)
787788 }
788789
789790 #[ tracing:: instrument( level = "trace" , skip_all) ]
790791 #[ allow( clippy:: type_complexity) ]
791- pub fn commit_tx ( & self , tx : MutTx ) -> Result < Option < ( TxOffset , Arc < TxData > , TxMetrics , String ) > , DBError > {
792+ pub fn commit_tx ( & self , tx : MutTx ) -> Result < Option < ( TxOffset , Arc < TxData > , TxMetrics , ReducerName ) > , DBError > {
792793 log:: trace!( "COMMIT MUT TX" ) ;
793794
794795 let reducer_context = tx. ctx . reducer_context ( ) . cloned ( ) ;
@@ -1002,7 +1003,7 @@ impl RelationalDB {
10021003 /// Should only be called after the tx lock has been fully released.
10031004 pub ( crate ) fn report_tx_metrics (
10041005 & self ,
1005- reducer : String ,
1006+ reducer : ReducerName ,
10061007 tx_data : Option < Arc < TxData > > ,
10071008 metrics_for_writer : Option < TxMetrics > ,
10081009 metrics_for_reader : Option < TxMetrics > ,
@@ -1469,12 +1470,12 @@ impl RelationalDB {
14691470 }
14701471
14711472 /// Reports the metrics for `reducer`, using counters provided by `db`.
1472- pub fn report_mut_tx_metrics ( & self , reducer : String , metrics : TxMetrics , tx_data : Option < Arc < TxData > > ) {
1473+ pub fn report_mut_tx_metrics ( & self , reducer : ReducerName , metrics : TxMetrics , tx_data : Option < Arc < TxData > > ) {
14731474 self . report_tx_metrics ( reducer, tx_data, Some ( metrics) , None ) ;
14741475 }
14751476
14761477 /// Reports subscription metrics for `reducer`, using counters provided by `db`.
1477- pub fn report_read_tx_metrics ( & self , reducer : String , metrics : TxMetrics ) {
1478+ pub fn report_read_tx_metrics ( & self , reducer : ReducerName , metrics : TxMetrics ) {
14781479 self . report_tx_metrics ( reducer, None , None , Some ( metrics) ) ;
14791480 }
14801481
@@ -3277,7 +3278,7 @@ mod tests {
32773278 let timestamp = Timestamp :: now ( ) ;
32783279 let workload = |name : & str | {
32793280 Workload :: Reducer ( ReducerContext {
3280- name : name . into ( ) ,
3281+ name : ReducerName :: new_from_str ( name ) ,
32813282 caller_identity : Identity :: __dummy ( ) ,
32823283 caller_connection_id : ConnectionId :: ZERO ,
32833284 timestamp,
@@ -3468,9 +3469,9 @@ mod tests {
34683469 arg_bsatn,
34693470 } = ReducerContext :: try_from ( & input) . unwrap ( ) ;
34703471 if i == 0 {
3471- assert_eq ! ( reducer_name, "__identity_connected__" ) ;
3472+ assert_eq ! ( & * reducer_name, "__identity_connected__" ) ;
34723473 } else {
3473- assert_eq ! ( reducer_name, "abstract_concrete_proxy_factory_impl" ) ;
3474+ assert_eq ! ( & * reducer_name, "abstract_concrete_proxy_factory_impl" ) ;
34743475 }
34753476 assert ! (
34763477 arg_bsatn. is_empty( ) ,
0 commit comments