@@ -1252,13 +1252,13 @@ mod tests {
12521252 use crate :: system_tables:: {
12531253 system_tables, StColumnRow , StConnectionCredentialsFields , StConstraintData , StConstraintFields ,
12541254 StConstraintRow , StIndexAlgorithm , StIndexFields , StIndexRow , StRowLevelSecurityFields , StScheduledFields ,
1255- StSequenceFields , StSequenceRow , StTableRow , StVarFields , StViewArgFields , StViewFields , ST_CLIENT_NAME ,
1256- ST_COLUMN_ID , ST_COLUMN_NAME , ST_CONNECTION_CREDENTIALS_ID , ST_CONNECTION_CREDENTIALS_NAME , ST_CONSTRAINT_ID ,
1257- ST_CONSTRAINT_NAME , ST_INDEX_ID , ST_INDEX_NAME , ST_MODULE_NAME , ST_RESERVED_SEQUENCE_RANGE ,
1255+ StSequenceFields , StSequenceRow , StTableRow , StVarFields , StViewArgFields , StViewFields , ST_CLIENT_ID ,
1256+ ST_CLIENT_NAME , ST_COLUMN_ID , ST_COLUMN_NAME , ST_CONNECTION_CREDENTIALS_ID , ST_CONNECTION_CREDENTIALS_NAME ,
1257+ ST_CONSTRAINT_ID , ST_CONSTRAINT_NAME , ST_INDEX_ID , ST_INDEX_NAME , ST_MODULE_NAME , ST_RESERVED_SEQUENCE_RANGE ,
12581258 ST_ROW_LEVEL_SECURITY_ID , ST_ROW_LEVEL_SECURITY_NAME , ST_SCHEDULED_ID , ST_SCHEDULED_NAME , ST_SEQUENCE_ID ,
1259- ST_SEQUENCE_NAME , ST_TABLE_NAME , ST_VAR_ID , ST_VAR_NAME , ST_VIEW_ARG_ID , ST_VIEW_ARG_NAME , ST_VIEW_CLIENT_ID ,
1260- ST_VIEW_CLIENT_NAME , ST_VIEW_COLUMN_ID , ST_VIEW_COLUMN_NAME , ST_VIEW_ID , ST_VIEW_NAME , ST_VIEW_PARAM_ID ,
1261- ST_VIEW_PARAM_NAME ,
1259+ ST_SEQUENCE_NAME , ST_TABLE_NAME , ST_VAR_ID , ST_VAR_NAME , ST_VIEW_ARG_ID , ST_VIEW_ARG_NAME , ST_VIEW_COLUMN_ID ,
1260+ ST_VIEW_COLUMN_NAME , ST_VIEW_ID , ST_VIEW_NAME , ST_VIEW_PARAM_ID , ST_VIEW_PARAM_NAME , ST_VIEW_SUB_ID ,
1261+ ST_VIEW_SUB_NAME ,
12621262 } ;
12631263 use crate :: traits:: { IsolationLevel , MutTx } ;
12641264 use crate :: Result ;
@@ -1272,7 +1272,7 @@ mod tests {
12721272 use spacetimedb_lib:: error:: ResultTest ;
12731273 use spacetimedb_lib:: st_var:: StVarValue ;
12741274 use spacetimedb_lib:: { resolved_type_via_v9, ScheduleAt , TimeDuration } ;
1275- use spacetimedb_primitives:: { col_list, ColId , ScheduleId , ViewId } ;
1275+ use spacetimedb_primitives:: { col_list, ArgId , ColId , ScheduleId , ViewId } ;
12761276 use spacetimedb_sats:: algebraic_value:: ser:: value_serialize;
12771277 use spacetimedb_sats:: bsatn:: ToBsatn ;
12781278 use spacetimedb_sats:: layout:: RowTypeLayout ;
@@ -1715,7 +1715,7 @@ mod tests {
17151715 TableRow { id: ST_VIEW_ID . into( ) , name: ST_VIEW_NAME , ty: StTableType :: System , access: StAccess :: Public , primary_key: Some ( StViewFields :: ViewId . into( ) ) } ,
17161716 TableRow { id: ST_VIEW_PARAM_ID . into( ) , name: ST_VIEW_PARAM_NAME , ty: StTableType :: System , access: StAccess :: Public , primary_key: None } ,
17171717 TableRow { id: ST_VIEW_COLUMN_ID . into( ) , name: ST_VIEW_COLUMN_NAME , ty: StTableType :: System , access: StAccess :: Public , primary_key: None } ,
1718- TableRow { id: ST_VIEW_CLIENT_ID . into( ) , name: ST_VIEW_CLIENT_NAME , ty: StTableType :: System , access: StAccess :: Public , primary_key: None } ,
1718+ TableRow { id: ST_VIEW_SUB_ID . into( ) , name: ST_VIEW_SUB_NAME , ty: StTableType :: System , access: StAccess :: Public , primary_key: None } ,
17191719 TableRow { id: ST_VIEW_ARG_ID . into( ) , name: ST_VIEW_ARG_NAME , ty: StTableType :: System , access: StAccess :: Public , primary_key: Some ( StViewArgFields :: Id . into( ) ) } ,
17201720
17211721 ] ) ) ;
@@ -1793,10 +1793,12 @@ mod tests {
17931793 ColRow { table: ST_VIEW_COLUMN_ID . into( ) , pos: 2 , name: "col_name" , ty: AlgebraicType :: String } ,
17941794 ColRow { table: ST_VIEW_COLUMN_ID . into( ) , pos: 3 , name: "col_type" , ty: AlgebraicType :: bytes( ) } ,
17951795
1796- ColRow { table: ST_VIEW_CLIENT_ID . into( ) , pos: 0 , name: "view_id" , ty: ViewId :: get_type( ) } ,
1797- ColRow { table: ST_VIEW_CLIENT_ID . into( ) , pos: 1 , name: "arg_id" , ty: AlgebraicType :: U64 } ,
1798- ColRow { table: ST_VIEW_CLIENT_ID . into( ) , pos: 2 , name: "identity" , ty: AlgebraicType :: U256 } ,
1799- ColRow { table: ST_VIEW_CLIENT_ID . into( ) , pos: 3 , name: "connection_id" , ty: AlgebraicType :: U128 } ,
1796+ ColRow { table: ST_VIEW_SUB_ID . into( ) , pos: 0 , name: "view_id" , ty: ViewId :: get_type( ) } ,
1797+ ColRow { table: ST_VIEW_SUB_ID . into( ) , pos: 1 , name: "arg_id" , ty: ArgId :: get_type( ) } ,
1798+ ColRow { table: ST_VIEW_SUB_ID . into( ) , pos: 2 , name: "identity" , ty: AlgebraicType :: U256 } ,
1799+ ColRow { table: ST_VIEW_SUB_ID . into( ) , pos: 3 , name: "num_subscribers" , ty: AlgebraicType :: U64 } ,
1800+ ColRow { table: ST_VIEW_SUB_ID . into( ) , pos: 4 , name: "has_subscribers" , ty: AlgebraicType :: Bool } ,
1801+ ColRow { table: ST_VIEW_SUB_ID . into( ) , pos: 5 , name: "last_called" , ty: AlgebraicType :: I64 } ,
18001802
18011803 ColRow { table: ST_VIEW_ARG_ID . into( ) , pos: 0 , name: "id" , ty: AlgebraicType :: U64 } ,
18021804 ColRow { table: ST_VIEW_ARG_ID . into( ) , pos: 1 , name: "bytes" , ty: AlgebraicType :: bytes( ) } ,
@@ -1820,10 +1822,11 @@ mod tests {
18201822 IndexRow { id: 15 , table: ST_VIEW_ID . into( ) , col: col( 1 ) , name: "st_view_view_name_idx_btree" , } ,
18211823 IndexRow { id: 16 , table: ST_VIEW_PARAM_ID . into( ) , col: col_list![ 0 , 1 ] , name: "st_view_param_view_id_param_pos_idx_btree" , } ,
18221824 IndexRow { id: 17 , table: ST_VIEW_COLUMN_ID . into( ) , col: col_list![ 0 , 1 ] , name: "st_view_column_view_id_col_pos_idx_btree" , } ,
1823- IndexRow { id: 18 , table: ST_VIEW_CLIENT_ID . into( ) , col: col_list![ 0 , 1 ] , name: "st_view_client_view_id_arg_id_idx_btree" , } ,
1824- IndexRow { id: 19 , table: ST_VIEW_CLIENT_ID . into( ) , col: col_list![ 2 , 3 ] , name: "st_view_client_identity_connection_id_idx_btree" , } ,
1825- IndexRow { id: 20 , table: ST_VIEW_ARG_ID . into( ) , col: col( 0 ) , name: "st_view_arg_id_idx_btree" , } ,
1826- IndexRow { id: 21 , table: ST_VIEW_ARG_ID . into( ) , col: col( 1 ) , name: "st_view_arg_bytes_idx_btree" , } ,
1825+ IndexRow { id: 18 , table: ST_VIEW_SUB_ID . into( ) , col: col( 2 ) , name: "st_view_sub_identity_idx_btree" , } ,
1826+ IndexRow { id: 19 , table: ST_VIEW_SUB_ID . into( ) , col: col( 4 ) , name: "st_view_sub_has_subscribers_idx_btree" , } ,
1827+ IndexRow { id: 20 , table: ST_VIEW_SUB_ID . into( ) , col: col_list![ 0 , 1 , 2 ] , name: "st_view_sub_view_id_arg_id_identity_idx_btree" , } ,
1828+ IndexRow { id: 21 , table: ST_VIEW_ARG_ID . into( ) , col: col( 0 ) , name: "st_view_arg_id_idx_btree" , } ,
1829+ IndexRow { id: 22 , table: ST_VIEW_ARG_ID . into( ) , col: col( 1 ) , name: "st_view_arg_bytes_idx_btree" , } ,
18271830 ] ) ) ;
18281831 let start = ST_RESERVED_SEQUENCE_RANGE as i128 + 1 ;
18291832 #[ rustfmt:: skip]
@@ -2282,10 +2285,11 @@ mod tests {
22822285 IndexRow { id : 15 , table : ST_VIEW_ID . into ( ) , col : col ( 1 ) , name : "st_view_view_name_idx_btree" , } ,
22832286 IndexRow { id : 16 , table : ST_VIEW_PARAM_ID . into ( ) , col : col_list ! [ 0 , 1 ] , name : "st_view_param_view_id_param_pos_idx_btree" , } ,
22842287 IndexRow { id : 17 , table : ST_VIEW_COLUMN_ID . into ( ) , col : col_list ! [ 0 , 1 ] , name : "st_view_column_view_id_col_pos_idx_btree" , } ,
2285- IndexRow { id : 18 , table : ST_VIEW_CLIENT_ID . into ( ) , col : col_list ! [ 0 , 1 ] , name : "st_view_client_view_id_arg_id_idx_btree" , } ,
2286- IndexRow { id : 19 , table : ST_VIEW_CLIENT_ID . into ( ) , col : col_list ! [ 2 , 3 ] , name : "st_view_client_identity_connection_id_idx_btree" , } ,
2287- IndexRow { id : 20 , table : ST_VIEW_ARG_ID . into ( ) , col : col ( 0 ) , name : "st_view_arg_id_idx_btree" , } ,
2288- IndexRow { id : 21 , table : ST_VIEW_ARG_ID . into ( ) , col : col ( 1 ) , name : "st_view_arg_bytes_idx_btree" , } ,
2288+ IndexRow { id : 18 , table : ST_VIEW_SUB_ID . into ( ) , col : col ( 2 ) , name : "st_view_sub_identity_idx_btree" , } ,
2289+ IndexRow { id : 19 , table : ST_VIEW_SUB_ID . into ( ) , col : col ( 4 ) , name : "st_view_sub_has_subscribers_idx_btree" , } ,
2290+ IndexRow { id : 20 , table : ST_VIEW_SUB_ID . into ( ) , col : col_list ! [ 0 , 1 , 2 ] , name : "st_view_sub_view_id_arg_id_identity_idx_btree" , } ,
2291+ IndexRow { id : 21 , table : ST_VIEW_ARG_ID . into ( ) , col : col ( 0 ) , name : "st_view_arg_id_idx_btree" , } ,
2292+ IndexRow { id : 22 , table : ST_VIEW_ARG_ID . into ( ) , col : col ( 1 ) , name : "st_view_arg_bytes_idx_btree" , } ,
22892293 IndexRow { id : seq_start, table : FIRST_NON_SYSTEM_ID , col : col ( 0 ) , name : "Foo_id_idx_btree" , } ,
22902294 IndexRow { id : seq_start + 1 , table : FIRST_NON_SYSTEM_ID , col : col ( 1 ) , name : "Foo_name_idx_btree" , } ,
22912295 IndexRow { id : seq_start + 2 , table : FIRST_NON_SYSTEM_ID , col : col ( 2 ) , name : "Foo_age_idx_btree" , } ,
0 commit comments