@@ -201,9 +201,8 @@ pub struct TableSchema {
201201 /// Whether this is an event table.
202202 pub is_event : bool ,
203203
204- /// For outbox tables (`__outbox_<reducer>`): the name of the local reducer to call
205- /// with the result of the remote reducer invocation. `None` means no callback.
206- pub on_result_reducer : Option < String > ,
204+ /// Outbox configuration if this is an outbox table; `None` for non-outbox tables.
205+ pub outbox : Option < OutboxSchema > ,
207206
208207 /// Cache for `row_type_for_table` in the data store.
209208 pub row_type : ProductType ,
@@ -231,7 +230,7 @@ impl TableSchema {
231230 primary_key : Option < ColId > ,
232231 is_event : bool ,
233232 alias : Option < Identifier > ,
234- on_result_reducer : Option < String > ,
233+ outbox : Option < OutboxSchema > ,
235234 ) -> Self {
236235 Self {
237236 row_type : columns_to_row_type ( & columns) ,
@@ -248,7 +247,7 @@ impl TableSchema {
248247 primary_key,
249248 is_event,
250249 alias,
251- on_result_reducer ,
250+ outbox ,
252251 }
253252 }
254253
@@ -1041,10 +1040,10 @@ impl Schema for TableSchema {
10411040 . as_ref ( )
10421041 . map ( |schedule| ScheduleSchema :: from_module_def ( module_def, schedule, table_id, ScheduleId :: SENTINEL ) ) ;
10431042
1044- let on_result_reducer = outbox
1045- . as_ref ( )
1046- . and_then ( |o| o. on_result_reducer . as_ref ( ) )
1047- . map ( |r| r . to_string ( ) ) ;
1043+ let outbox_schema = outbox. as_ref ( ) . map ( |o| OutboxSchema {
1044+ remote_reducer : o . remote_reducer . clone ( ) ,
1045+ on_result_reducer : o. on_result_reducer . clone ( ) ,
1046+ } ) ;
10481047
10491048 TableSchema :: new (
10501049 table_id,
@@ -1060,7 +1059,7 @@ impl Schema for TableSchema {
10601059 * primary_key,
10611060 * is_event,
10621061 Some ( accessor_name. clone ( ) ) ,
1063- on_result_reducer ,
1062+ outbox_schema ,
10641063 )
10651064 }
10661065
@@ -1443,6 +1442,15 @@ impl Schema for ScheduleSchema {
14431442 }
14441443}
14451444
1445+ /// Marks a table as an outbox table for inter-database communication.
1446+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
1447+ pub struct OutboxSchema {
1448+ /// The name of the reducer to invoke on the target database.
1449+ pub remote_reducer : Identifier ,
1450+ /// The local reducer called with the delivery result, if any.
1451+ pub on_result_reducer : Option < Identifier > ,
1452+ }
1453+
14461454/// A struct representing the schema of a database index.
14471455#[ derive( Debug , Clone , PartialEq , Eq ) ]
14481456pub struct IndexSchema {
0 commit comments