Skip to content

Commit 7e34373

Browse files
committed
Re-enable "fake" remote transactions
1 parent f1725d6 commit 7e34373

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

modules/tpcc/src/new_order.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use std::collections::HashMap;
22

33
use crate::{
4-
DISTRICTS_PER_WAREHOUSE, District, Item, OrderLine, Stock, TAX_SCALE, WarehouseId, district, find_customer_by_id, find_district, find_stock, find_warehouse, item, order_line, pack_order_key, remote::{call_remote_reducer, remote_warehouse_home, simulate_remote_call}, stock
4+
district, find_customer_by_id, find_district, find_stock, find_warehouse, item, order_line, pack_order_key,
5+
remote::{remote_warehouse_home, simulate_remote_call},
6+
stock, District, Item, OrderLine, Stock, WarehouseId, DISTRICTS_PER_WAREHOUSE, TAX_SCALE,
57
};
68
use spacetimedb::{log_stopwatch::LogStopwatch, reducer, Identity, ReducerContext, SpacetimeType, Table, Timestamp};
79

@@ -181,19 +183,19 @@ fn call_remote_order_multiple_items_and_decrement_stock(
181183
remote_database_identity: Identity,
182184
input: OrderMultipleItemsInput,
183185
) -> Result<Vec<OrderItemOutput>, String> {
184-
call_remote_reducer(
185-
ctx,
186-
remote_database_identity,
187-
"order_multiple_items_and_decrement_stocks",
188-
&input,
189-
)
190-
// simulate_remote_call(
186+
// call_remote_reducer(
191187
// ctx,
192188
// remote_database_identity,
193189
// "order_multiple_items_and_decrement_stocks",
194190
// &input,
195-
// )?;
196-
//Ok(simulated_remote_order_outputs(input))
191+
// )
192+
simulate_remote_call(
193+
ctx,
194+
remote_database_identity,
195+
"order_multiple_items_and_decrement_stocks",
196+
&input,
197+
)?;
198+
Ok(simulated_remote_order_outputs(input))
197199
}
198200

199201
struct ProcessedNewOrderItem {

modules/tpcc/src/payment.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use crate::{
2-
Customer, CustomerSelector, District, History, MAX_C_DATA_LEN, Warehouse, customer, district, find_district, find_warehouse, history, remote::{call_remote_reducer, remote_warehouse_home, simulate_remote_call}, resolve_customer, warehouse
2+
customer, district, find_district, find_warehouse, history,
3+
remote::{remote_warehouse_home, simulate_remote_call},
4+
resolve_customer, warehouse, Customer, CustomerSelector, District, History, Warehouse, MAX_C_DATA_LEN,
35
};
46
use spacetimedb::{
57
log_stopwatch::LogStopwatch, procedure, reducer, Identity, ProcedureContext, ReducerContext, SpacetimeType, Table,
@@ -126,19 +128,19 @@ fn call_remote_resolve_and_update_customer_for_payment(
126128
remote_database_identity: Identity,
127129
request: &PaymentRequest,
128130
) -> Result<Customer, String> {
129-
call_remote_reducer(
130-
ctx,
131-
remote_database_identity,
132-
"resolve_and_update_customer_for_payment",
133-
request,
134-
)
135-
// simulate_remote_call(
131+
// call_remote_reducer(
136132
// ctx,
137133
// remote_database_identity,
138134
// "resolve_and_update_customer_for_payment",
139135
// request,
140-
// )?;
141-
// Ok(simulated_remote_customer(request))
136+
// )
137+
simulate_remote_call(
138+
ctx,
139+
remote_database_identity,
140+
"resolve_and_update_customer_for_payment",
141+
request,
142+
)?;
143+
Ok(simulated_remote_customer(request))
142144
}
143145

144146
#[procedure]

0 commit comments

Comments
 (0)