Skip to content

Commit 85bc884

Browse files
Shubham8287aasoni
authored andcommitted
point to 2pc bindings
1 parent 17d3e5f commit 85bc884

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

crates/bindings/src/remote_reducer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,14 @@ pub fn call_reducer_on_db_2pc(
103103
database_identity: Identity,
104104
reducer_name: &str,
105105
args: &[u8],
106-
) -> Result<(), RemoteCallError> {
106+
) -> Result<Vec<u8>, RemoteCallError> {
107107
let identity_bytes = database_identity.to_byte_array();
108108
match spacetimedb_bindings_sys::call_reducer_on_db_2pc(identity_bytes, reducer_name, args) {
109109
Ok((status, body_source)) => {
110110
if status < 300 {
111-
return Ok(());
111+
let mut out = Vec::new();
112+
read_bytes_source_into(body_source, &mut out);
113+
return Ok(out);
112114
}
113115
let msg = if body_source == spacetimedb_bindings_sys::raw::BytesSource::INVALID {
114116
String::new()

modules/tpcc/src/remote.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use spacetimedb::{
2-
reducer, remote_reducer::call_reducer_on_db, table, DeserializeOwned, Identity, ReducerContext, Serialize,
2+
reducer, remote_reducer::call_reducer_on_db_2pc, table, DeserializeOwned, Identity, ReducerContext, Serialize,
33
SpacetimeType, Table,
44
};
55
use spacetimedb_sats::bsatn;
66

7-
87
/// For warehouses not managed by this database, stores the [`Identity`] of the remote database which manages that warehouse.
98
///
109
/// Will not have a row present for a warehouse managed by the local database.
@@ -55,7 +54,7 @@ where
5554
let args = bsatn::to_vec(args).map_err(|e| {
5655
format!("Failed to BSATN-serialize args for remote reducer {reducer_name} on database {database_ident}: {e}")
5756
})?;
58-
let out = call_reducer_on_db(database_ident, reducer_name, &args)
57+
let out = call_reducer_on_db_2pc(database_ident, reducer_name, &args)
5958
.map_err(|e| format!("Failed to call remote reducer {reducer_name} on database {database_ident}: {e}"))?;
6059
bsatn::from_slice(&out).map_err(|e| {
6160
format!(

0 commit comments

Comments
 (0)