Skip to content

Commit b0112b8

Browse files
committed
fmt
1 parent f036abd commit b0112b8

12 files changed

Lines changed: 50 additions & 63 deletions

File tree

crates/bindings-macro/src/table.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,14 @@ impl OutboxArg {
279279
if meta.input.peek(syn::Token![=]) || meta.input.peek(syn::token::Paren) {
280280
Err(meta.error("outbox takes a single function path, e.g. `outbox(my_remote_reducer)`"))
281281
} else {
282-
check_duplicate_msg(
283-
&remote_reducer,
284-
&meta,
285-
"can only specify one remote reducer for outbox",
286-
)?;
282+
check_duplicate_msg(&remote_reducer, &meta, "can only specify one remote reducer for outbox")?;
287283
remote_reducer = Some(meta.path);
288284
Ok(())
289285
}
290286
})?;
291287

292-
let remote_reducer = remote_reducer.ok_or_else(|| {
293-
syn::Error::new(span, "outbox requires a remote reducer: `outbox(my_remote_reducer)`")
294-
})?;
288+
let remote_reducer = remote_reducer
289+
.ok_or_else(|| syn::Error::new(span, "outbox requires a remote reducer: `outbox(my_remote_reducer)`"))?;
295290

296291
Ok(Self {
297292
span,
@@ -309,18 +304,17 @@ impl OutboxArg {
309304
if meta.input.peek(syn::Token![=]) || meta.input.peek(syn::token::Paren) {
310305
Err(meta.error("on_result takes a single function path, e.g. `on_result(my_local_reducer)`"))
311306
} else {
312-
check_duplicate_msg(
313-
&result,
314-
&meta,
315-
"can only specify one on_result reducer",
316-
)?;
307+
check_duplicate_msg(&result, &meta, "can only specify one on_result reducer")?;
317308
result = Some(meta.path);
318309
Ok(())
319310
}
320311
})?;
321312

322313
result.ok_or_else(|| {
323-
syn::Error::new(span, "on_result requires a local reducer: `on_result(my_local_reducer)`")
314+
syn::Error::new(
315+
span,
316+
"on_result requires a local reducer: `on_result(my_local_reducer)`",
317+
)
324318
})
325319
}
326320
}

crates/bindings/src/rt.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,9 @@ pub fn register_table<T: Table>() {
775775
table.finish();
776776

777777
if let Some(outbox) = T::OUTBOX {
778-
module.inner.add_outbox(
779-
T::TABLE_NAME,
780-
outbox.remote_reducer_name,
781-
outbox.on_result_reducer_name,
782-
);
778+
module
779+
.inner
780+
.add_outbox(T::TABLE_NAME, outbox.remote_reducer_name, outbox.on_result_reducer_name);
783781
}
784782

785783
module.inner.add_explicit_names(T::explicit_names());

crates/client-api/src/routes/database.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,12 @@ pub async fn call_from_database<S: ControlStateDelegate + NodeDelegate>(
269269

270270
let caller_identity = auth.claims.identity;
271271

272-
let sender_identity = Identity::from_hex(&sender_identity)
273-
.map_err(|_| (StatusCode::BAD_REQUEST, "Invalid sender_identity: expected hex-encoded identity"))?;
272+
let sender_identity = Identity::from_hex(&sender_identity).map_err(|_| {
273+
(
274+
StatusCode::BAD_REQUEST,
275+
"Invalid sender_identity: expected hex-encoded identity",
276+
)
277+
})?;
274278

275279
let args = FunctionArgs::Bsatn(body);
276280
let connection_id = generate_random_connection_id();

crates/core/src/host/idc_runtime.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,7 @@ pub struct IdcRuntimeStarter {
5656

5757
impl IdcRuntimeStarter {
5858
/// Spawn the IDC runtime background task.
59-
pub fn start(
60-
self,
61-
db: Arc<RelationalDB>,
62-
config: IdcRuntimeConfig,
63-
module_host: WeakModuleHost,
64-
) -> IdcRuntime {
59+
pub fn start(self, db: Arc<RelationalDB>, config: IdcRuntimeConfig, module_host: WeakModuleHost) -> IdcRuntime {
6560
let abort = tokio::spawn(run_idc_loop(db, config, module_host, self.rx)).abort_handle();
6661
IdcRuntime { _abort: abort }
6762
}
@@ -328,10 +323,7 @@ fn load_pending_into_targets(db: &RelationalDB, targets: &mut HashMap<Identity,
328323
};
329324

330325
let table_name = schema.table_name.to_string();
331-
let target_reducer = table_name
332-
.strip_prefix("__outbox_")
333-
.unwrap_or(&table_name)
334-
.to_string();
326+
let target_reducer = table_name.strip_prefix("__outbox_").unwrap_or(&table_name).to_string();
335327
let on_result_reducer = schema.on_result_reducer.clone();
336328

337329
// Look up the outbox row by its auto-inc PK (col 0) to get target identity and args.

crates/core/src/host/module_common.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ pub fn build_common_module_from_raw(
3838
replica_ctx.subscriptions.clone(),
3939
);
4040

41-
Ok(ModuleCommon::new(replica_ctx, mcc.scheduler, mcc.idc_sender, info, mcc.energy_monitor))
41+
Ok(ModuleCommon::new(
42+
replica_ctx,
43+
mcc.scheduler,
44+
mcc.idc_sender,
45+
info,
46+
mcc.energy_monitor,
47+
))
4248
}
4349

4450
/// Non-runtime-specific parts of a module.

crates/core/src/host/wasm_common/module_host_actor.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ use core::time::Duration;
3434
use prometheus::{Histogram, IntCounter, IntGauge};
3535
use spacetimedb_auth::identity::ConnectionAuthCtx;
3636
use spacetimedb_datastore::db_metrics::DB_METRICS;
37-
use spacetimedb_datastore::system_tables::st_inbound_msg_id_result_status;
3837
use spacetimedb_datastore::error::{DatastoreError, ViewError};
3938
use spacetimedb_datastore::execution_context::{self, ReducerContext, Workload};
4039
use spacetimedb_datastore::locking_tx_datastore::{FuncCallType, MutTxId, ViewCallInfo};
40+
use spacetimedb_datastore::system_tables::st_inbound_msg_id_result_status;
4141
use spacetimedb_datastore::traits::{IsolationLevel, Program};
4242
use spacetimedb_execution::pipelined::PipelinedProject;
4343
use spacetimedb_lib::buffer::DecodeError;
@@ -423,7 +423,11 @@ impl<T: WasmModule> WasmModuleHostActor<T> {
423423

424424
pub fn create_instance(&self) -> WasmModuleInstance<T::Instance> {
425425
let common = &self.common;
426-
let env = InstanceEnv::new(common.replica_ctx().clone(), common.scheduler().clone(), common.idc_sender());
426+
let env = InstanceEnv::new(
427+
common.replica_ctx().clone(),
428+
common.scheduler().clone(),
429+
common.idc_sender(),
430+
);
427431
// this shouldn't fail, since we already called module.create_instance()
428432
// before and it didn't error, and ideally they should be deterministic
429433
let mut instance = self
@@ -933,9 +937,7 @@ impl InstanceCommon {
933937
};
934938
let res = lifecycle_res.and(dedup_res);
935939
match res {
936-
Ok(()) => {
937-
(EventStatus::Committed(DatabaseUpdate::default()), return_value)
938-
}
940+
Ok(()) => (EventStatus::Committed(DatabaseUpdate::default()), return_value),
939941
Err(err) => {
940942
let err = err.to_string();
941943
log_reducer_error(
@@ -997,9 +999,7 @@ impl InstanceCommon {
997999
// record the failure in st_inbound_msg_id in a separate tx (since the reducer tx
9981000
// was rolled back). This allows the sending database to receive the error on dedup
9991001
// rather than re-running the reducer.
1000-
if let (Some((sender_identity, sender_msg_id)), EventStatus::FailedUser(err)) =
1001-
(dedup_sender, &event.status)
1002-
{
1002+
if let (Some((sender_identity, sender_msg_id)), EventStatus::FailedUser(err)) = (dedup_sender, &event.status) {
10031003
let err_msg = err.clone();
10041004
let mut dedup_tx = stdb.begin_mut_tx(IsolationLevel::Serializable, Workload::Internal);
10051005
if let Err(e) = dedup_tx.upsert_inbound_last_msg_id(

crates/datastore/src/locking_tx_datastore/committed_state.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ use crate::{
3030
locking_tx_datastore::ViewCallInfo,
3131
system_tables::{
3232
ST_COLUMN_ACCESSOR_ID, ST_COLUMN_ACCESSOR_IDX, ST_CONNECTION_CREDENTIALS_ID, ST_CONNECTION_CREDENTIALS_IDX,
33-
ST_INBOUND_MSG_ID_IDX, ST_MSG_ID_ID, ST_MSG_ID_IDX, ST_EVENT_TABLE_ID, ST_EVENT_TABLE_IDX, ST_INDEX_ACCESSOR_ID, ST_INDEX_ACCESSOR_IDX,
34-
ST_TABLE_ACCESSOR_ID, ST_TABLE_ACCESSOR_IDX, ST_VIEW_COLUMN_ID, ST_VIEW_COLUMN_IDX, ST_VIEW_ID, ST_VIEW_IDX,
35-
ST_VIEW_PARAM_ID, ST_VIEW_PARAM_IDX, ST_VIEW_SUB_ID, ST_VIEW_SUB_IDX,
33+
ST_EVENT_TABLE_ID, ST_EVENT_TABLE_IDX, ST_INBOUND_MSG_ID_IDX, ST_INDEX_ACCESSOR_ID, ST_INDEX_ACCESSOR_IDX,
34+
ST_MSG_ID_ID, ST_MSG_ID_IDX, ST_TABLE_ACCESSOR_ID, ST_TABLE_ACCESSOR_IDX, ST_VIEW_COLUMN_ID,
35+
ST_VIEW_COLUMN_IDX, ST_VIEW_ID, ST_VIEW_IDX, ST_VIEW_PARAM_ID, ST_VIEW_PARAM_IDX, ST_VIEW_SUB_ID,
36+
ST_VIEW_SUB_IDX,
3637
},
3738
};
3839
use anyhow::anyhow;

crates/datastore/src/locking_tx_datastore/mut_tx.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use crate::{
2020
use crate::{
2121
error::{IndexError, SequenceError, TableError},
2222
system_tables::{
23-
with_sys_table_buf, StClientFields, StClientRow, StColumnAccessorFields, StColumnAccessorRow,
24-
StColumnFields, StColumnRow, StConstraintFields, StConstraintRow, StEventTableRow, StFields as _,
25-
StInboundMsgIdFields, StInboundMsgIdRow, StIndexAccessorFields, StIndexAccessorRow, StIndexFields, StIndexRow,
26-
StMsgIdFields, StMsgIdRow, StRowLevelSecurityFields, StRowLevelSecurityRow, StScheduledFields, StScheduledRow,
23+
with_sys_table_buf, StClientFields, StClientRow, StColumnAccessorFields, StColumnAccessorRow, StColumnFields,
24+
StColumnRow, StConstraintFields, StConstraintRow, StEventTableRow, StFields as _, StInboundMsgIdFields,
25+
StInboundMsgIdRow, StIndexAccessorFields, StIndexAccessorRow, StIndexFields, StIndexRow, StMsgIdFields,
26+
StMsgIdRow, StRowLevelSecurityFields, StRowLevelSecurityRow, StScheduledFields, StScheduledRow,
2727
StSequenceFields, StSequenceRow, StTableAccessorFields, StTableAccessorRow, StTableFields, StTableRow,
2828
SystemTable, ST_CLIENT_ID, ST_COLUMN_ACCESSOR_ID, ST_COLUMN_ID, ST_CONSTRAINT_ID, ST_EVENT_TABLE_ID,
2929
ST_INBOUND_MSG_ID_ID, ST_INDEX_ACCESSOR_ID, ST_INDEX_ID, ST_MSG_ID_ID, ST_ROW_LEVEL_SECURITY_ID,

crates/datastore/src/system_tables.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ pub fn is_built_in_meta_row(table_id: TableId, row: &ProductValue) -> Result<boo
190190
let row: StEventTableRow = to_typed_row(row)?;
191191
table_id_is_reserved(row.table_id)
192192
}
193-
ST_TABLE_ACCESSOR_ID | ST_INDEX_ACCESSOR_ID | ST_COLUMN_ACCESSOR_ID | ST_INBOUND_MSG_ID_ID | ST_MSG_ID_ID => false,
193+
ST_TABLE_ACCESSOR_ID | ST_INDEX_ACCESSOR_ID | ST_COLUMN_ACCESSOR_ID | ST_INBOUND_MSG_ID_ID | ST_MSG_ID_ID => {
194+
false
195+
}
194196
TableId(..ST_RESERVED_SEQUENCE_RANGE) => {
195197
log::warn!("Unknown system table {table_id:?}");
196198
false
@@ -706,10 +708,7 @@ fn system_module_def() -> ModuleDef {
706708

707709
let st_msg_id_type = builder.add_type::<StMsgIdRow>();
708710
builder
709-
.build_table(
710-
ST_MSG_ID_NAME,
711-
*st_msg_id_type.as_ref().expect("should be ref"),
712-
)
711+
.build_table(ST_MSG_ID_NAME, *st_msg_id_type.as_ref().expect("should be ref"))
713712
.with_type(TableType::System)
714713
.with_auto_inc_primary_key(StMsgIdFields::MsgId)
715714
.with_index_no_accessor_name(btree(StMsgIdFields::MsgId));

crates/schema/src/def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ impl From<TableDef> for RawTableDefV9 {
752752
table_type,
753753
table_access,
754754
is_event: _, // V9 does not support event tables; ignore when converting back
755-
outbox: _, // V9 does not support outbox tables; ignore when converting back
755+
outbox: _, // V9 does not support outbox tables; ignore when converting back
756756
..
757757
} = val;
758758

0 commit comments

Comments
 (0)