diff --git a/Cargo.lock b/Cargo.lock index 42c5df8..a086ca9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,12 +82,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "backtrace" version = "0.3.69" @@ -131,12 +125,6 @@ dependencies = [ "virtue", ] -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bytes" version = "1.5.0" @@ -204,8 +192,6 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "minisql", - "parser", "proto", "tokio", ] @@ -241,9 +227,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "itoa" @@ -257,16 +243,6 @@ version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "memchr" version = "2.6.4" @@ -366,29 +342,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - [[package]] name = "parser" version = "0.1.0" @@ -509,15 +462,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -530,12 +474,6 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "serde" version = "1.0.196" @@ -578,25 +516,9 @@ dependencies = [ "parser", "proto", "rand", - "serde_json", "tokio", ] -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - [[package]] name = "socket2" version = "0.5.5" @@ -647,18 +569,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2 1.0.78", "quote 1.0.35", @@ -667,18 +589,16 @@ dependencies = [ [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", "libc", "mio", "num_cpus", - "parking_lot", "pin-project-lite", - "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.48.0", diff --git a/Cargo.toml b/Cargo.toml index 3e6cda3..729ebaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,14 @@ members = [ "parser", "storage_engine" ] + +[workspace.dependencies] +anyhow = "1.0.79" +async-trait = "0.1.77" +bimap = "0.6.3" +bincode = "2.0.0-rc.3" +clap = "4.4.18" +rand = "0.8.5" +serde = "1.0.196" +thiserror = "1.0.56" +tokio = "1.36.0" diff --git a/client/Cargo.toml b/client/Cargo.toml index 4e060c2..82b49c7 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -6,9 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tokio = { version = "1.35.1", features = ["full"] } -anyhow = "1.0.76" +anyhow = { workspace = true } +clap = { workspace = true, features = ["derive"] } +tokio = { workspace = true, features = ["io-util", "macros", "net", "rt-multi-thread"] } + proto = { path = "../proto" } -minisql = { path = "../minisql" } -parser = { path = "../parser" } -clap = { version = "4.4.18", features = ["derive"] } \ No newline at end of file diff --git a/minisql/Cargo.toml b/minisql/Cargo.toml index 4029a5c..7cef722 100644 --- a/minisql/Cargo.toml +++ b/minisql/Cargo.toml @@ -7,13 +7,14 @@ rust-version = "1.74" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.79" -async-trait = "0.1.77" -bimap = { version = "0.6.3", features = ["serde"] } -bincode = "2.0.0-rc.3" -serde = { version = "1.0.196", features = ["derive", "rc"] } -tokio = { version = "1.34.0", features = ["full"] } -thiserror = "1.0.50" +anyhow = { workspace = true } +async-trait = { workspace = true } +bimap = { workspace = true, features = ["serde"] } +bincode = { workspace = true } +serde = { workspace = true, features = ["derive", "rc"] } +serde_json = "1.0.113" +thiserror = { workspace = true } +tokio = { workspace = true, features = ["macros", "sync"] } + proto = { path = "../proto" } storage_engine = { path = "../storage_engine" } -serde_json = "1.0.113" diff --git a/minisql/src/interpreter2.rs b/minisql/src/interpreter2.rs index 9426018..ca123ab 100644 --- a/minisql/src/interpreter2.rs +++ b/minisql/src/interpreter2.rs @@ -128,7 +128,6 @@ impl State { } async fn attach_table(&mut self, table: Table) { - // TODO: You need to update the global DB SCHEMA! let new_table_position: TablePosition = self.tables.len(); self.table_name_position_mapping .insert(table.schema().table_name().clone(), new_table_position); diff --git a/minisql/src/type_system.rs b/minisql/src/type_system.rs index 155eb99..ba00632 100644 --- a/minisql/src/type_system.rs +++ b/minisql/src/type_system.rs @@ -2,8 +2,6 @@ use crate::error::TypeConversionError; use proto::message::primitive::pgoid::PgOid; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; -// TODO: Private??? -// use bincode::{Encode, Encoder, EncodeError, Decode, Decoder, DecodeError}; use bincode::{Encode, Decode}; // ==============Types================ @@ -92,7 +90,6 @@ impl PartialOrd for Value { } } -// TODO: Make column know about indexable types impl Ord for Value { fn cmp(&self, other: &Self) -> Ordering { match (self, other) { @@ -120,18 +117,6 @@ impl Ord for Value { } } -// impl Encode for Value { -// fn encode(&self, encoder: &mut E) -> Result<(), EncodeError> { -// todo!() -// } -// } - -// impl Decode for Value { -// fn decode(decoder: &mut D) -> Result { -// todo!() -// } -// } - impl DbType { fn new_n_option(n: usize, inside: DbType) -> DbType { if n == 0 { diff --git a/parser/Cargo.toml b/parser/Cargo.toml index ff211a0..67c99be 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -6,8 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -nom-peg = "0.1.1" +bimap = { workspace = true } nom = "7.1.3" +nom-peg = "0.1.1" +thiserror = { workspace = true } + minisql = { path = "../minisql" } -bimap = "0.6.3" -thiserror = "1" \ No newline at end of file diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 40f5991..9675904 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" edition = "2021" [dependencies] -bincode = "2.0.0-rc.3" -tokio = { version = "1.34.0", features = ["io-util", "macros", "test-util"] } -async-trait = "0.1.74" -thiserror = "1.0.50" -rand_seeder = "0.2.3" +async-trait = { workspace = true } +bincode = { workspace = true } +rand = { workspace = true } rand_pcg = "0.3.1" -rand = "0.8.5" +rand_seeder = "0.2.3" +thiserror = { workspace = true } +tokio = { workspace = true, features = ["io-util", "macros"] } diff --git a/server/Cargo.toml b/server/Cargo.toml index 67c87d7..c1c54b9 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,12 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tokio = { version = "1.35.1", features = ["full"] } -anyhow = "1.0.76" -clap = { version = "4.4.18", features = ["derive"] } -async-trait = "0.1.74" -rand = "0.8.5" -serde_json = "1.0.112" +anyhow = { workspace = true } +async-trait = { workspace = true } +clap = { workspace = true, features = ["derive"] } +rand = { workspace = true } +tokio = { workspace = true, features = ["io-util", "macros", "net", "rt-multi-thread", "time"] } + minisql = { path = "../minisql" } +parser = { path = "../parser" } proto = { path = "../proto" } -parser = { path = "../parser" } \ No newline at end of file diff --git a/server/src/main.rs b/server/src/main.rs index c76c371..131caa0 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -85,7 +85,7 @@ async fn handle_stream( let mut wrapped_writer = ServerProtoWrapper::new(writer, config.get_throttle()); let result = match request { Ok(req) => { - handle_connection(&mut reader, &mut wrapped_writer, req, state, token, config).await + handle_connection(&mut reader, &mut wrapped_writer, req, state, token).await } Err(ServerHandshakeError::IsCancelRequest(cancel)) => { handle_cancellation(cancel.pid, cancel.secret, &tokens).await @@ -141,7 +141,6 @@ async fn handle_connection( request: HandshakeRequest, state: SharedDbState, token: ResetCancelToken, - config: Arc, ) -> anyhow::Result<()> where R: FrontendProtoReader + Send, @@ -157,7 +156,7 @@ where break; } FrontendMessage::Query(data) => { - let result = handle_query(writer, &state, data.query.into(), &token, &config).await; + let result = handle_query(writer, &state, data.query.into(), &token).await; match result { Ok(_) => {} Err(e) => writer.write_error_message(&e.to_string()).await?, @@ -176,7 +175,6 @@ async fn handle_query( state: &SharedDbState, query: String, token: &ResetCancelToken, - config: &Arc, ) -> anyhow::Result<()> where W: BackendProtoWriter + ProtoFlush + Send, diff --git a/storage_engine/Cargo.toml b/storage_engine/Cargo.toml index 6658764..6846dd5 100644 --- a/storage_engine/Cargo.toml +++ b/storage_engine/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -bincode = "2.0.0-rc.3" -tokio = { version = "1.34.0", features = ["full"] } -async-trait = "0.1.74" -thiserror = "1.0.50" +async-trait = { workspace = true } +bincode = { workspace = true } +thiserror = { workspace = true } +tokio = { workspace = true, features = ["fs", "io-util", "macros", "rt-multi-thread"] } diff --git a/storage_engine/src/store.rs b/storage_engine/src/store.rs index bb256ff..d90327f 100644 --- a/storage_engine/src/store.rs +++ b/storage_engine/src/store.rs @@ -16,7 +16,6 @@ pub type Result = std::result::Result; pub type Column = u64; pub type FilePosition = u64; -// TODO: Consider adding another type parameter for indexable values #[derive(Debug)] pub struct Store { pub header: StoreHeader,