Skip to content

Commit

Permalink
Refactoring IDs for system objects
Browse files Browse the repository at this point in the history
  • Loading branch information
mamcx committed Nov 13, 2023
1 parent f12a238 commit 1cee02c
Show file tree
Hide file tree
Showing 39 changed files with 688 additions and 538 deletions.
105 changes: 84 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 13 additions & 12 deletions crates/bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,28 @@ bench = false
[dependencies]
spacetimedb-lib = { path = "../lib" }
spacetimedb-core = { path = "../core" }
spacetimedb-sats= { path = "../sats" }
spacetimedb-standalone = { path = "../standalone" }
spacetimedb-client-api = { path = "../client-api" }
spacetimedb-testing = { path = "../testing" }
spacetimedb-primitives = { path = "../primitives" }

ahash.workspace = true
log.workspace = true
clap.workspace = true
rusqlite.workspace = true
criterion.workspace = true
tempfile.workspace = true
rand.workspace = true
tokio.workspace = true
serde_json.workspace = true
serde.workspace = true
anyhow.workspace = true
anymap.workspace = true
byte-unit.workspace = true
clap.workspace = true
criterion.workspace = true
futures.workspace = true
tracing-subscriber.workspace = true
lazy_static.workspace = true
walkdir.workspace = true
regex.workspace = true
log.workspace = true
mimalloc.workspace = true
rand.workspace = true
regex.workspace = true
rusqlite.workspace = true
serde.workspace = true
serde_json.workspace = true
tempdir.workspace = true
tokio.workspace = true
tracing-subscriber.workspace = true
walkdir.workspace = true
2 changes: 1 addition & 1 deletion crates/bench/src/spacetime_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl BenchDatabase for SpacetimeModule {
}
}

#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TableId {
pascal_case: String,
snake_case: String,
Expand Down
7 changes: 4 additions & 3 deletions crates/bench/src/spacetime_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use spacetimedb_lib::sats::db::def::{IndexDef, TableDef};
use spacetimedb_lib::sats::AlgebraicValue;
use spacetimedb_primitives::{ColId, TableId};
use std::hint::black_box;
use tempfile::TempDir;
use tempdir::TempDir;

pub type DbResult = (RelationalDB, TempDir, u32);

Expand All @@ -28,7 +28,7 @@ impl BenchDatabase for SpacetimeRaw {
where
Self: Sized,
{
let temp_dir = TempDir::with_prefix("stdb_test")?;
let temp_dir = TempDir::new("stdb_test")?;
let db = open_db(temp_dir.path(), in_memory, fsync)?;

Ok(SpacetimeRaw {
Expand All @@ -46,13 +46,14 @@ impl BenchDatabase for SpacetimeRaw {
match index_strategy {
IndexStrategy::Unique => {
self.db
.create_index(tx, IndexDef::new("id".to_string(), table_id, 0.into(), true))?;
.create_index(tx, table_id, IndexDef::new("id".to_string(), table_id, 0.into(), true))?;
}
IndexStrategy::NonUnique => (),
IndexStrategy::MultiIndex => {
for (i, column) in T::product_type().elements.iter().enumerate() {
self.db.create_index(
tx,
table_id,
IndexDef::new(column.name.clone().unwrap(), table_id, i.into(), false),
)?;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bench/src/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
hint::black_box,
sync::{Arc, RwLock},
};
use tempfile::TempDir;
use tempdir::TempDir;

/// SQLite benchmark harness.
pub struct SQLite {
Expand All @@ -30,7 +30,7 @@ impl BenchDatabase for SQLite {
where
Self: Sized,
{
let temp_dir = TempDir::with_prefix("sqlite_test")?;
let temp_dir = TempDir::new("sqlite_test")?;
let db = if in_memory {
Connection::open_in_memory()?
} else {
Expand Down
Loading

0 comments on commit 1cee02c

Please sign in to comment.