Skip to content

Commit 159912d

Browse files
cloutiertylermamcx
authored andcommitted
Split datastore into its own crate (#2933)
1 parent 86a3c88 commit 159912d

63 files changed

Lines changed: 348 additions & 250 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ members = [
1111
"crates/commitlog",
1212
"crates/core",
1313
"crates/data-structures",
14+
"crates/datastore",
1415
"crates/durability",
1516
"crates/execution",
1617
"crates/expr",
@@ -104,6 +105,7 @@ spacetimedb-codegen = { path = "crates/codegen", version = "1.2.0" }
104105
spacetimedb-commitlog = { path = "crates/commitlog", version = "1.2.0" }
105106
spacetimedb-core = { path = "crates/core", version = "1.2.0" }
106107
spacetimedb-data-structures = { path = "crates/data-structures", version = "1.2.0" }
108+
spacetimedb-datastore = { path = "crates/datastore", version = "1.2.0" }
107109
spacetimedb-durability = { path = "crates/durability", version = "1.2.0" }
108110
spacetimedb-execution = { path = "crates/execution", version = "1.2.0" }
109111
spacetimedb-expr = { path = "crates/expr", version = "1.2.0" }

crates/bench/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ bench = false
4040
spacetimedb-client-api = { path = "../client-api" }
4141
spacetimedb-core = { path = "../core", features = ["test"] }
4242
spacetimedb-data-structures.workspace = true
43+
spacetimedb-datastore.workspace = true
4344
spacetimedb-execution = { path = "../execution" }
4445
spacetimedb-lib = { path = "../lib" }
4546
spacetimedb-paths.workspace = true

crates/bench/benches/delete_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use criterion::{
77
use itertools::Itertools;
88
use rand::{prelude::*, seq::SliceRandom};
99
use smallvec::SmallVec;
10-
use spacetimedb::db::datastore::locking_tx_datastore::delete_table;
1110
use spacetimedb_data_structures::map::HashSet;
11+
use spacetimedb_datastore::locking_tx_datastore::delete_table;
1212
use spacetimedb_sats::layout::Size;
1313
use spacetimedb_table::indexes::{PageIndex, PageOffset, RowPointer, SquashedOffset};
1414
use std::collections::BTreeSet;

crates/bench/benches/subscription.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use criterion::{black_box, criterion_group, criterion_main, Criterion};
22
use spacetimedb::error::DBError;
3-
use spacetimedb::execution_context::Workload;
43
use spacetimedb::host::module_host::DatabaseTableUpdate;
54
use spacetimedb::identity::AuthCtx;
65
use spacetimedb::messages::websocket::BsatnFormat;
@@ -12,6 +11,7 @@ use spacetimedb::subscription::{collect_table_update, TableUpdateType};
1211
use spacetimedb::{db::relational_db::RelationalDB, messages::websocket::Compression};
1312
use spacetimedb_bench::database::BenchDatabase as _;
1413
use spacetimedb_bench::spacetime_raw::SpacetimeRaw;
14+
use spacetimedb_datastore::execution_context::Workload;
1515
use spacetimedb_execution::pipelined::PipelinedProject;
1616
use spacetimedb_primitives::{col_list, TableId};
1717
use spacetimedb_query::compile_subscription;

crates/bench/src/spacetime_raw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
ResultBench,
55
};
66
use spacetimedb::db::relational_db::{tests_utils::TestDB, RelationalDB};
7-
use spacetimedb::execution_context::Workload;
7+
use spacetimedb_datastore::execution_context::Workload;
88
use spacetimedb_primitives::{ColId, IndexId, TableId};
99
use spacetimedb_sats::{bsatn, AlgebraicValue};
1010
use spacetimedb_schema::{

crates/client-api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description = "The HTTP API for SpacetimeDB"
99
spacetimedb-client-api-messages.workspace = true
1010
spacetimedb-core.workspace = true
1111
spacetimedb-data-structures.workspace = true
12+
spacetimedb-datastore.workspace = true
1213
spacetimedb-lib = { workspace = true, features = ["serde"] }
1314
spacetimedb-paths.workspace = true
1415
spacetimedb-schema.workspace = true

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ use spacetimedb::client::{
2828
ClientActorId, ClientConfig, ClientConnection, DataMessage, MessageExecutionError, MessageHandleError,
2929
MeteredReceiver, Protocol,
3030
};
31-
use spacetimedb::execution_context::WorkloadType;
3231
use spacetimedb::host::module_host::ClientConnectedError;
3332
use spacetimedb::host::NoSuchModule;
3433
use spacetimedb::util::spawn_rayon;
3534
use spacetimedb::worker_metrics::WORKER_METRICS;
3635
use spacetimedb::Identity;
3736
use spacetimedb_client_api_messages::websocket::{self as ws_api, Compression};
37+
use spacetimedb_datastore::execution_context::WorkloadType;
3838
use spacetimedb_lib::connection_id::{ConnectionId, ConnectionIdForUrl};
3939
use std::time::Instant;
4040
use tokio::sync::{mpsc, watch};

crates/core/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spacetimedb-data-structures.workspace = true
2020
spacetimedb-lib = { workspace = true, features = ["serde", "metrics_impls"] }
2121
spacetimedb-client-api-messages.workspace = true
2222
spacetimedb-commitlog.workspace = true
23+
spacetimedb-datastore.workspace = true
2324
spacetimedb-durability.workspace = true
2425
spacetimedb-memory-usage.workspace = true
2526
spacetimedb-metrics.workspace = true
@@ -131,7 +132,7 @@ default = ["unindexed_iter_by_col_range_warn"]
131132
# Enable timing for wasm ABI calls
132133
spacetimedb-wasm-instance-env-times = []
133134
# Enable test helpers and utils
134-
test = ["spacetimedb-commitlog/test"]
135+
test = ["spacetimedb-commitlog/test", "spacetimedb-datastore/test"]
135136
# Perfmaps for profiling modules
136137
perfmap = []
137138

crates/core/src/client/message_handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use super::messages::{SubscriptionUpdateMessage, SwitchedServerMessage, ToProtocol, TransactionUpdateMessage};
22
use super::{ClientConnection, DataMessage, Protocol};
33
use crate::energy::EnergyQuanta;
4-
use crate::execution_context::WorkloadType;
54
use crate::host::module_host::{EventStatus, ModuleEvent, ModuleFunctionCall};
65
use crate::host::{ReducerArgs, ReducerId};
76
use crate::identity::Identity;
87
use crate::messages::websocket::{CallReducer, ClientMessage, OneOffQuery};
98
use crate::worker_metrics::WORKER_METRICS;
9+
use spacetimedb_datastore::execution_context::WorkloadType;
1010
use spacetimedb_lib::de::serde::DeserializeWrapper;
1111
use spacetimedb_lib::identity::RequestId;
1212
use spacetimedb_lib::{bsatn, ConnectionId, Timestamp};

0 commit comments

Comments
 (0)