diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e843c1d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +target + +data diff --git a/Cargo.lock b/Cargo.lock index 3224199..1fece25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,28 +2,352 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + [[package]] name = "cli" version = "0.1.0" dependencies = [ + "bincode", + "clap", "common", + "server", ] +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + [[package]] name = "common" version = "0.1.0" +dependencies = [ + "bincode", + "serde", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-skiplist" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df29de440c58ca2cc6e587ec3d22347551a32435fbde9d2bff64e78a9ffa151b" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "engine" version = "0.1.0" dependencies = [ + "bincode", "common", + "crossbeam-skiplist", + "parking_lot", + "serde", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "libc" +version = "0.2.185" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[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.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] name = "server" version = "0.1.0" dependencies = [ + "bincode", "common", "engine", + "serde", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", ] diff --git a/README.md b/README.md index d3c8757..77afe77 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,34 @@ # Axii - High-Performance LSM-Based Key-Value Store -Axii is a high-performance, persistent key-value database implemented in Rust using a Log-Structured Merge Tree (LSM Tree) architecture. It is designed for high write throughput and scalability. +Axii is a persistent key-value database implemented in Rust using a [Log-Structured Merge Tree (LSM Tree)](https://en.wikipedia.org/wiki/Log-structured_merge-tree) architecture. It is designed for high write throughput and durability. ## Architecture & Folder Structure -The project is organized as a Cargo workspace to ensure separation of concerns, scalability, and code reusability. +The project is organized as a Cargo workspace to ensure separation of concerns and code reusability. ```text axii/ -├── common/ # Shared library: custom errors, primitive types (Key, Value), and configs. -├── engine/ # Core library: LSM-Tree logic (Memtable, WAL, SSTables, Compaction). -│ ├── memtable/ # In-memory sorted structures (e.g., SkipList). +├── common/ # Shared library: custom errors, protocol types, and binary serialization. +├── engine/ # Core library: LSM-Tree logic (Memtable, WAL, SSTables). +│ ├── memtable/ # In-memory sorted structure (BTreeMap). │ ├── wal/ # Write-Ahead Log for crash recovery and durability. -│ ├── sstable/ # Sorted String Table formats, indexing, and block management. -│ └── compaction/ # Background merge-sort logic for storage optimization. -├── server/ # Network binary: Handles TCP/gRPC client connections and queries. -├── cli/ # Terminal binary: Interactive REPL for database interaction. -└── tests/ # Integration tests covering cross-crate functionality. +│ └── sstable/ # Sorted String Table formats for persistent storage. +├── server/ # Network library: Handles multi-threaded TCP client connections. +├── cli/ # Terminal binary: Command-line interface for the database. +└── GEMINI.md # Technical specification and roadmap. ``` ## Key Components -- **Memtable**: Fast in-memory writes using sorted structures. -- **WAL (Write-Ahead Log)**: Ensures data durability before flushing to disk. -- **SSTables**: Immutable on-disk files for persistent storage with sparse indexing. -- **Compaction**: Background process that merges SSTables to reclaim space and optimize reads. +- **[Memtable](https://github.com/facebook/rocksdb/wiki/MemTable)**: Fast in-memory writes using a thread-safe `BTreeMap`. +- **[WAL (Write-Ahead Log)](https://en.wikipedia.org/wiki/Write-ahead_logging)**: Ensures data durability by logging operations before applying them to the Memtable. +- **[SSTables](https://www.igvita.com/2012/02/06/sstable-and-log-structured-storage-leveldb/)**: Immutable on-disk files for persistent storage, flushed when the Memtable exceeds size thresholds. ## Getting Started ### Prerequisites -- [Rust](https://www.rust-lang.org/tools/install) (1.75+ recommended) +- [Rust](https://www.rust-lang.org/tools/install) (latest stable) ### Build the Project @@ -42,30 +40,43 @@ cargo build ### Running the Components -**Start the Server:** +All operations are managed through the unified `cli` tool. + +#### 1. Start the Server +The server stores data in the specified directory (defaults to `./data`). + ```bash -cargo run -p server +cargo run --bin cli -- start-server --data ./data ``` -**Launch the CLI:** +#### 2. Perform Database Operations +In a separate terminal, use the CLI to interact with the server: + +**Set a key-value pair:** ```bash -cargo run -p cli +cargo run --bin cli -- set mykey "hello world" ``` -### Running Tests - -Run all unit and integration tests: +**Get a value by key:** +```bash +cargo run --bin cli -- get mykey +``` +**Delete a key:** ```bash -cargo test +cargo run --bin cli -- delete mykey ``` +## Protocol +Axii uses a custom binary protocol over TCP. Requests and responses are serialized using `bincode` for maximum efficiency. + ## Implementation Status - [x] Workspace & Crate Structure -- [x] Common Type Definitions -- [ ] In-Memory Engine (Memtable) -- [ ] Write-Ahead Log (WAL) -- [ ] SSTables & Indexing -- [ ] Compaction Worker -- [ ] Network Server & CLI REPL +- [x] Common Type Definitions & Binary Protocol +- [x] In-Memory Engine (Memtable using BTreeMap) +- [x] Write-Ahead Log (WAL) with Recovery +- [x] SSTable Flushing & Persistent Lookups +- [x] Multi-threaded TCP Server +- [x] Unified CLI Client +- [ ] Compaction Worker (Background storage optimization) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 999e29b..ac58a4e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -5,3 +5,6 @@ edition = "2021" [dependencies] common = { path = "../common" } +server = { path = "../server" } +clap = { version = "4.0", features = ["derive"] } +bincode = "1.3" diff --git a/cli/src/main.rs b/cli/src/main.rs index 2b1b65b..7054d9d 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,3 +1,96 @@ -fn main() { - println!("Hello from cli!"); +use std::net::TcpStream; +use std::io::{Read, Write, BufReader}; +use std::path::PathBuf; +use clap::{Parser, Subcommand}; +use common::types::{Request, Response}; +use common::error::Result; + +#[derive(Parser)] +#[command(author, version, about, long_about = None)] +struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + /// Start the database server + StartServer { + #[arg(short, long, default_value = "127.0.0.1:6379")] + addr: String, + #[arg(short, long, default_value = "./data")] + data: PathBuf, + }, + /// Set a key-value pair + Set { + key: String, + value: String, + #[arg(short, long, default_value = "127.0.0.1:6379")] + addr: String, + }, + /// Get the value for a key + Get { + key: String, + #[arg(short, long, default_value = "127.0.0.1:6379")] + addr: String, + }, + /// Delete a key + Delete { + key: String, + #[arg(short, long, default_value = "127.0.0.1:6379")] + addr: String, + }, +} + +fn main() -> Result<()> { + let cli = Cli::parse(); + + match cli.command { + Commands::StartServer { addr, data } => { + server::start_server(&addr, data)?; + } + Commands::Set { key, value, addr } => { + let resp = send_request(&addr, Request::Set(key.into_bytes(), value.into_bytes()))?; + match resp { + Response::Ok(_) => println!("OK"), + Response::Error(e) => eprintln!("Error: {}", e), + } + } + Commands::Get { key, addr } => { + let resp = send_request(&addr, Request::Get(key.into_bytes()))?; + match resp { + Response::Ok(Some(val)) => println!("{}", String::from_utf8_lossy(&val)), + Response::Ok(None) => println!("(nil)"), + Response::Error(e) => eprintln!("Error: {}", e), + } + } + Commands::Delete { key, addr } => { + let resp = send_request(&addr, Request::Delete(key.into_bytes()))?; + match resp { + Response::Ok(_) => println!("OK"), + Response::Error(e) => eprintln!("Error: {}", e), + } + } + } + + Ok(()) +} + +fn send_request(addr: &str, req: Request) -> Result { + let mut stream = TcpStream::connect(addr)?; + let bytes = bincode::serialize(&req)?; + let len = bytes.len() as u32; + stream.write_all(&len.to_le_bytes())?; + stream.write_all(&bytes)?; + stream.flush()?; + + let mut reader = BufReader::new(stream.try_clone()?); + let mut len_bytes = [0u8; 4]; + reader.read_exact(&mut len_bytes)?; + let res_len = u32::from_le_bytes(len_bytes) as usize; + let mut res_bytes = vec![0u8; res_len]; + reader.read_exact(&mut res_bytes)?; + + let response: Response = bincode::deserialize(&res_bytes)?; + Ok(response) } diff --git a/common/Cargo.toml b/common/Cargo.toml index e020b17..cf8d44d 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -4,3 +4,5 @@ version = "0.1.0" edition = "2021" [dependencies] +serde = { version = "1.0", features = ["derive"] } +bincode = "1.3" diff --git a/common/src/types.rs b/common/src/types.rs index 901baf5..33a1e3f 100644 --- a/common/src/types.rs +++ b/common/src/types.rs @@ -1,2 +1,29 @@ +use serde::{Deserialize, Serialize}; + pub type Key = Vec; -pub type Value = Option>; // None represents a tombstone +pub type Value = Vec; + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum Operation { + Set(Key, Value), + Delete(Key), +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct Record { + pub key: Key, + pub value: Option, // None represents a tombstone +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum Request { + Get(Key), + Set(Key, Value), + Delete(Key), +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum Response { + Ok(Option), + Error(String), +} diff --git a/engine/Cargo.toml b/engine/Cargo.toml index 59446cf..b378f8d 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -5,3 +5,7 @@ edition = "2021" [dependencies] common = { path = "../common" } +serde = { version = "1.0", features = ["derive"] } +bincode = "1.3" +parking_lot = "0.12" +crossbeam-skiplist = "0.1" # In case we want to try skiplist later, but BTreeMap is fine for now. diff --git a/engine/src/compaction/mod.rs b/engine/src/compaction/mod.rs deleted file mode 100644 index 2c8b839..0000000 --- a/engine/src/compaction/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod worker; diff --git a/engine/src/compaction/worker.rs b/engine/src/compaction/worker.rs deleted file mode 100644 index 0cd85f8..0000000 --- a/engine/src/compaction/worker.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct CompactionWorker; diff --git a/engine/src/db.rs b/engine/src/db.rs index 24ae4f8..c29ad25 100644 --- a/engine/src/db.rs +++ b/engine/src/db.rs @@ -1 +1,125 @@ -pub struct Database; +use std::sync::Arc; +use std::path::PathBuf; +use std::fs; +use parking_lot::{Mutex, RwLock}; +use crate::memtable::Memtable; +use crate::wal::WalManager; +use crate::sstable::{SstableWriter, SstableReader}; +use common::types::{Key, Value, Operation}; +use common::error::Result; + +const FLUSH_THRESHOLD: usize = 1024; // 1KB for demo + +pub struct Database { + path: PathBuf, + memtable: Arc, + wal: Arc>, + sstables: Arc>>, +} + +impl Database { + pub fn open(path: PathBuf) -> Result { + if !path.exists() { + fs::create_dir_all(&path)?; + } + + let memtable = Arc::new(Memtable::new()); + let wal_path = path.join("wal.log"); + let wal = WalManager::new(wal_path)?; + + wal.recover(&memtable)?; + + // Load existing sstables + let mut sstables = Vec::new(); + let entries = fs::read_dir(&path)?; + let mut sstable_files: Vec<_> = entries + .filter_map(|e| e.ok()) + .filter(|e| e.path().extension().and_then(|s| s.to_str()) == Some("sst")) + .collect(); + + // Sort sstables by name (timestamp) to read newest first + sstable_files.sort_by_key(|e| e.file_name()); + sstable_files.reverse(); + + for entry in sstable_files { + sstables.push(SstableReader::new(entry.path())); + } + + Ok(Self { + path, + memtable, + wal: Arc::new(Mutex::new(wal)), + sstables: Arc::new(RwLock::new(sstables)), + }) + } + + pub fn set(&self, key: Key, value: Value) -> Result<()> { + let op = Operation::Set(key.clone(), value.clone()); + self.wal.lock().append(&op)?; + self.memtable.set(key, value); + + if self.memtable.size() >= FLUSH_THRESHOLD { + self.flush()?; + } + + Ok(()) + } + + pub fn get(&self, key: &[u8]) -> Result> { + // 1. Search memtable + if let Some(result) = self.memtable.get(key) { + return Ok(result); + } + + // 2. Search sstables (newest first) + let sstables = self.sstables.read(); + for sstable in sstables.iter() { + if let Some(result) = sstable.get(key)? { + return Ok(result); + } + } + + Ok(None) + } + + pub fn delete(&self, key: Key) -> Result<()> { + let op = Operation::Delete(key.clone()); + self.wal.lock().append(&op)?; + self.memtable.delete(key); + + if self.memtable.size() >= FLUSH_THRESHOLD { + self.flush()?; + } + + Ok(()) + } + + fn flush(&self) -> Result<()> { + let timestamp = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH)? + .as_millis(); + let sstable_path = self.path.join(format!("{}.sst", timestamp)); + + let entries = self.memtable.entries(); + if entries.is_empty() { + return Ok(()); + } + + let writer = SstableWriter::new(sstable_path.clone()); + writer.write(entries)?; + + // Rotate WAL + let mut wal = self.wal.lock(); + let wal_path = self.path.join("wal.log"); + let old_wal_path = self.path.join(format!("wal.{}.old", timestamp)); + fs::rename(&wal_path, &old_wal_path)?; + *wal = WalManager::new(wal_path)?; + + // Clear memtable and add sstable to list + self.memtable.clear(); + let mut sstables = self.sstables.write(); + sstables.insert(0, SstableReader::new(sstable_path)); + + Ok(()) + } +} diff --git a/engine/src/lib.rs b/engine/src/lib.rs index fb029c2..d4b19f3 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -2,5 +2,3 @@ pub mod db; pub mod memtable; pub mod sstable; pub mod wal; -pub mod compaction; -pub mod utils; diff --git a/engine/src/memtable/mod.rs b/engine/src/memtable/mod.rs index 30efa0a..2038d53 100644 --- a/engine/src/memtable/mod.rs +++ b/engine/src/memtable/mod.rs @@ -1 +1,71 @@ -pub mod skiplist; +use std::collections::BTreeMap; +use parking_lot::RwLock; +use common::types::{Key, Value}; + +pub struct Memtable { + map: RwLock>>, + size: RwLock, +} + +impl Memtable { + pub fn new() -> Self { + Self { + map: RwLock::new(BTreeMap::new()), + size: RwLock::new(0), + } + } + + pub fn set(&self, key: Key, value: Value) { + let mut map = self.map.write(); + let mut size = self.size.write(); + + let key_len = key.len(); + let val_len = value.len(); + + if let Some(old) = map.insert(key, Some(value)) { + if let Some(old_val) = old { + *size = (*size + val_len).saturating_sub(old_val.len()); + } else { + *size += val_len; + } + } else { + *size += key_len + val_len; + } + } + + pub fn delete(&self, key: Key) { + let mut map = self.map.write(); + let mut size = self.size.write(); + + let key_len = key.len(); + + if let Some(old) = map.insert(key, None) { + if let Some(old_val) = old { + *size = *size + 1 - old_val.len(); // None is effectively 1 byte or so in terms of overhead + } + } else { + *size += key_len + 1; + } + } + + pub fn get(&self, key: &[u8]) -> Option> { + let map = self.map.read(); + map.get(key).cloned() + } + + pub fn size(&self) -> usize { + *self.size.read() + } + + pub fn clear(&self) { + let mut map = self.map.write(); + let mut size = self.size.write(); + map.clear(); + *size = 0; + } + + pub fn entries(&self) -> Vec<(Key, Option)> { + let map = self.map.read(); + map.iter().map(|(k, v)| (k.clone(), v.clone())).collect() + } +} diff --git a/engine/src/memtable/skiplist.rs b/engine/src/memtable/skiplist.rs deleted file mode 100644 index 385d993..0000000 --- a/engine/src/memtable/skiplist.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct SkipList; diff --git a/engine/src/sstable/block.rs b/engine/src/sstable/block.rs deleted file mode 100644 index 9228d43..0000000 --- a/engine/src/sstable/block.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Block; diff --git a/engine/src/sstable/index.rs b/engine/src/sstable/index.rs deleted file mode 100644 index beb0830..0000000 --- a/engine/src/sstable/index.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Index; diff --git a/engine/src/sstable/mod.rs b/engine/src/sstable/mod.rs index c310b2b..c75ad3e 100644 --- a/engine/src/sstable/mod.rs +++ b/engine/src/sstable/mod.rs @@ -1,3 +1,74 @@ -pub mod block; -pub mod index; -pub mod reader; +use std::fs::{File, OpenOptions}; +use std::io::{Read, Write, BufReader, BufWriter}; +use std::path::PathBuf; +use common::types::{Key, Value, Record}; +use common::error::Result; + +pub struct SstableWriter { + path: PathBuf, +} + +impl SstableWriter { + pub fn new(path: PathBuf) -> Self { + Self { path } + } + + pub fn write(&self, entries: Vec<(Key, Option)>) -> Result<()> { + let file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(&self.path)?; + let mut writer = BufWriter::new(file); + + let count = entries.len() as u64; + writer.write_all(&count.to_le_bytes())?; + + for (key, value) in entries { + let record = Record { key, value }; + let bytes = bincode::serialize(&record)?; + let len = bytes.len() as u32; + writer.write_all(&len.to_le_bytes())?; + writer.write_all(&bytes)?; + } + + writer.flush()?; + Ok(()) + } +} + +pub struct SstableReader { + path: PathBuf, +} + +impl SstableReader { + pub fn new(path: PathBuf) -> Self { + Self { path } + } + + pub fn get(&self, key: &[u8]) -> Result>> { + let file = File::open(&self.path)?; + let mut reader = BufReader::new(file); + + let mut count_bytes = [0u8; 8]; + reader.read_exact(&mut count_bytes)?; + let count = u64::from_le_bytes(count_bytes); + + for _ in 0..count { + let mut len_bytes = [0u8; 4]; + if reader.read_exact(&mut len_bytes).is_err() { + break; + } + let len = u32::from_le_bytes(len_bytes) as usize; + let mut bytes = vec![0u8; len]; + reader.read_exact(&mut bytes)?; + + let record: Record = bincode::deserialize(&bytes)?; + if record.key == key { + return Ok(Some(record.value)); + } + } + + Ok(None) + } +} diff --git a/engine/src/sstable/reader.rs b/engine/src/sstable/reader.rs deleted file mode 100644 index ac99fdc..0000000 --- a/engine/src/sstable/reader.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct Reader; diff --git a/engine/src/utils.rs b/engine/src/utils.rs deleted file mode 100644 index 638e9b7..0000000 --- a/engine/src/utils.rs +++ /dev/null @@ -1 +0,0 @@ -// Utility functions diff --git a/engine/src/wal/mod.rs b/engine/src/wal/mod.rs index d3baa81..e5be35e 100644 --- a/engine/src/wal/mod.rs +++ b/engine/src/wal/mod.rs @@ -1 +1,61 @@ -pub mod writer; +use std::fs::{File, OpenOptions}; +use std::io::{Read, Write, BufReader, BufWriter}; +use std::path::PathBuf; +use common::error::Result; +use common::types::Operation; +use crate::memtable::Memtable; + +pub struct WalManager { + path: PathBuf, + writer: BufWriter, +} + +impl WalManager { + pub fn new(path: PathBuf) -> Result { + let file = OpenOptions::new() + .append(true) + .create(true) + .open(&path)?; + + Ok(Self { + path, + writer: BufWriter::new(file), + }) + } + + pub fn append(&mut self, op: &Operation) -> Result<()> { + let bytes = bincode::serialize(op)?; + let len = bytes.len() as u32; + self.writer.write_all(&len.to_le_bytes())?; + self.writer.write_all(&bytes)?; + self.writer.flush()?; + Ok(()) + } + + pub fn recover(&self, memtable: &Memtable) -> Result<()> { + if !self.path.exists() { + return Ok(()); + } + + let file = File::open(&self.path)?; + let mut reader = BufReader::new(file); + + loop { + let mut len_bytes = [0u8; 4]; + if reader.read_exact(&mut len_bytes).is_err() { + break; + } + let len = u32::from_le_bytes(len_bytes) as usize; + let mut bytes = vec![0u8; len]; + reader.read_exact(&mut bytes)?; + + let op: Operation = bincode::deserialize(&bytes)?; + match op { + Operation::Set(k, v) => memtable.set(k, v), + Operation::Delete(k) => memtable.delete(k), + } + } + + Ok(()) + } +} diff --git a/engine/src/wal/writer.rs b/engine/src/wal/writer.rs deleted file mode 100644 index 1d20313..0000000 --- a/engine/src/wal/writer.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct WalWriter; diff --git a/server/Cargo.toml b/server/Cargo.toml index f052a29..550e344 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,3 +6,5 @@ edition = "2021" [dependencies] common = { path = "../common" } engine = { path = "../engine" } +serde = { version = "1.0", features = ["derive"] } +bincode = "1.3" diff --git a/server/src/lib.rs b/server/src/lib.rs new file mode 100644 index 0000000..23ee88d --- /dev/null +++ b/server/src/lib.rs @@ -0,0 +1,70 @@ +use std::net::{TcpListener, TcpStream}; +use std::io::{Read, Write, BufReader}; +use std::sync::Arc; +use std::path::PathBuf; +use engine::db::Database; +use common::types::{Request, Response}; +use common::error::Result; + +pub fn start_server(addr: &str, db_path: PathBuf) -> Result<()> { + let listener = TcpListener::bind(addr)?; + println!("Server listening on {}", addr); + + let db = Arc::new(Database::open(db_path)?); + + for stream in listener.incoming() { + let stream = stream?; + let db = Arc::clone(&db); + std::thread::spawn(move || { + if let Err(e) = handle_client(stream, db) { + eprintln!("Error handling client: {}", e); + } + }); + } + + Ok(()) +} + +fn handle_client(mut stream: TcpStream, db: Arc) -> Result<()> { + let mut reader = BufReader::new(stream.try_clone()?); + + loop { + let mut len_bytes = [0u8; 4]; + if reader.read_exact(&mut len_bytes).is_err() { + break; // Connection closed + } + let len = u32::from_le_bytes(len_bytes) as usize; + let mut bytes = vec![0u8; len]; + reader.read_exact(&mut bytes)?; + + let request: Request = bincode::deserialize(&bytes)?; + let response = match request { + Request::Get(key) => { + match db.get(&key) { + Ok(val) => Response::Ok(val), + Err(e) => Response::Error(e.to_string()), + } + } + Request::Set(key, value) => { + match db.set(key, value) { + Ok(_) => Response::Ok(None), + Err(e) => Response::Error(e.to_string()), + } + } + Request::Delete(key) => { + match db.delete(key) { + Ok(_) => Response::Ok(None), + Err(e) => Response::Error(e.to_string()), + } + } + }; + + let res_bytes = bincode::serialize(&response)?; + let res_len = res_bytes.len() as u32; + stream.write_all(&res_len.to_le_bytes())?; + stream.write_all(&res_bytes)?; + stream.flush()?; + } + + Ok(()) +} diff --git a/server/src/main.rs b/server/src/main.rs index 3560d8a..b5e0a03 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,3 +1,9 @@ -fn main() { - println!("Hello from server!"); +use std::path::PathBuf; +use common::error::Result; +use server::start_server; + +fn main() -> Result<()> { + let addr = "127.0.0.1:6379"; + let db_path = PathBuf::from("./data"); + start_server(addr, db_path) } diff --git a/target/.rustc_info.json b/target/.rustc_info.json deleted file mode 100644 index 40e109e..0000000 --- a/target/.rustc_info.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc_fingerprint":15275687681451369836,"outputs":{"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.94.1 (e408947bf 2026-03-25) (Arch Linux rust 1:1.94.1-1)\nbinary: rustc\ncommit-hash: e408947bfd200af42db322daf0fadfe7e26d3bd1\ncommit-date: 2026-03-25\nhost: x86_64-unknown-linux-gnu\nrelease: 1.94.1\nLLVM version: 22.1.1\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/usr\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/target/CACHEDIR.TAG b/target/CACHEDIR.TAG deleted file mode 100644 index 20d7c31..0000000 --- a/target/CACHEDIR.TAG +++ /dev/null @@ -1,3 +0,0 @@ -Signature: 8a477f597d28d172789f06886806bc55 -# This file is a cache directory tag created by cargo. -# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/target/debug/.cargo-lock b/target/debug/.cargo-lock deleted file mode 100644 index e69de29..0000000 diff --git a/target/debug/.fingerprint/cli-9792b054fead65f0/bin-cli b/target/debug/.fingerprint/cli-9792b054fead65f0/bin-cli deleted file mode 100644 index 9e0cd96..0000000 --- a/target/debug/.fingerprint/cli-9792b054fead65f0/bin-cli +++ /dev/null @@ -1 +0,0 @@ -3a247dc4204bb88c \ No newline at end of file diff --git a/target/debug/.fingerprint/cli-9792b054fead65f0/bin-cli.json b/target/debug/.fingerprint/cli-9792b054fead65f0/bin-cli.json deleted file mode 100644 index d939082..0000000 --- a/target/debug/.fingerprint/cli-9792b054fead65f0/bin-cli.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":13159710979830874675,"features":"[]","declared_features":"[]","target":11350485868370498262,"profile":17672942494452627365,"path":15162269893553335056,"deps":[[5105710422153833948,"common",false,11821167848484302318]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/cli-9792b054fead65f0/dep-bin-cli","checksum":false}}],"rustflags":[],"config":8247474407144887393,"compile_kind":0} \ No newline at end of file diff --git a/target/debug/.fingerprint/cli-9792b054fead65f0/dep-bin-cli b/target/debug/.fingerprint/cli-9792b054fead65f0/dep-bin-cli deleted file mode 100644 index 5c54f74..0000000 Binary files a/target/debug/.fingerprint/cli-9792b054fead65f0/dep-bin-cli and /dev/null differ diff --git a/target/debug/.fingerprint/cli-9792b054fead65f0/invoked.timestamp b/target/debug/.fingerprint/cli-9792b054fead65f0/invoked.timestamp deleted file mode 100644 index e00328d..0000000 --- a/target/debug/.fingerprint/cli-9792b054fead65f0/invoked.timestamp +++ /dev/null @@ -1 +0,0 @@ -This file has an mtime of when this was started. \ No newline at end of file diff --git a/target/debug/.fingerprint/common-d52c5250bbb2aa31/dep-lib-common b/target/debug/.fingerprint/common-d52c5250bbb2aa31/dep-lib-common deleted file mode 100644 index 4df95b7..0000000 Binary files a/target/debug/.fingerprint/common-d52c5250bbb2aa31/dep-lib-common and /dev/null differ diff --git a/target/debug/.fingerprint/common-d52c5250bbb2aa31/invoked.timestamp b/target/debug/.fingerprint/common-d52c5250bbb2aa31/invoked.timestamp deleted file mode 100644 index e00328d..0000000 --- a/target/debug/.fingerprint/common-d52c5250bbb2aa31/invoked.timestamp +++ /dev/null @@ -1 +0,0 @@ -This file has an mtime of when this was started. \ No newline at end of file diff --git a/target/debug/.fingerprint/common-d52c5250bbb2aa31/lib-common b/target/debug/.fingerprint/common-d52c5250bbb2aa31/lib-common deleted file mode 100644 index 1904f8e..0000000 --- a/target/debug/.fingerprint/common-d52c5250bbb2aa31/lib-common +++ /dev/null @@ -1 +0,0 @@ -eeed2ce786390da4 \ No newline at end of file diff --git a/target/debug/.fingerprint/common-d52c5250bbb2aa31/lib-common.json b/target/debug/.fingerprint/common-d52c5250bbb2aa31/lib-common.json deleted file mode 100644 index 769f154..0000000 --- a/target/debug/.fingerprint/common-d52c5250bbb2aa31/lib-common.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":13159710979830874675,"features":"[]","declared_features":"[]","target":18158387057575095560,"profile":17672942494452627365,"path":3996496124079738140,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/common-d52c5250bbb2aa31/dep-lib-common","checksum":false}}],"rustflags":[],"config":8247474407144887393,"compile_kind":0} \ No newline at end of file diff --git a/target/debug/.fingerprint/engine-970377fa98761e24/dep-lib-engine b/target/debug/.fingerprint/engine-970377fa98761e24/dep-lib-engine deleted file mode 100644 index 97c9195..0000000 Binary files a/target/debug/.fingerprint/engine-970377fa98761e24/dep-lib-engine and /dev/null differ diff --git a/target/debug/.fingerprint/engine-970377fa98761e24/invoked.timestamp b/target/debug/.fingerprint/engine-970377fa98761e24/invoked.timestamp deleted file mode 100644 index e00328d..0000000 --- a/target/debug/.fingerprint/engine-970377fa98761e24/invoked.timestamp +++ /dev/null @@ -1 +0,0 @@ -This file has an mtime of when this was started. \ No newline at end of file diff --git a/target/debug/.fingerprint/engine-970377fa98761e24/lib-engine b/target/debug/.fingerprint/engine-970377fa98761e24/lib-engine deleted file mode 100644 index 4836f5a..0000000 --- a/target/debug/.fingerprint/engine-970377fa98761e24/lib-engine +++ /dev/null @@ -1 +0,0 @@ -1b20386de93b9f92 \ No newline at end of file diff --git a/target/debug/.fingerprint/engine-970377fa98761e24/lib-engine.json b/target/debug/.fingerprint/engine-970377fa98761e24/lib-engine.json deleted file mode 100644 index 0150cd7..0000000 --- a/target/debug/.fingerprint/engine-970377fa98761e24/lib-engine.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":13159710979830874675,"features":"[]","declared_features":"[]","target":6705654820588646449,"profile":17672942494452627365,"path":14279395392993056477,"deps":[[5105710422153833948,"common",false,11821167848484302318]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/engine-970377fa98761e24/dep-lib-engine","checksum":false}}],"rustflags":[],"config":8247474407144887393,"compile_kind":0} \ No newline at end of file diff --git a/target/debug/.fingerprint/server-b2e516feb17b9506/bin-server b/target/debug/.fingerprint/server-b2e516feb17b9506/bin-server deleted file mode 100644 index bb9a1bf..0000000 --- a/target/debug/.fingerprint/server-b2e516feb17b9506/bin-server +++ /dev/null @@ -1 +0,0 @@ -514c027a21cb9274 \ No newline at end of file diff --git a/target/debug/.fingerprint/server-b2e516feb17b9506/bin-server.json b/target/debug/.fingerprint/server-b2e516feb17b9506/bin-server.json deleted file mode 100644 index 9956980..0000000 --- a/target/debug/.fingerprint/server-b2e516feb17b9506/bin-server.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc":13159710979830874675,"features":"[]","declared_features":"[]","target":6751271728464079581,"profile":17672942494452627365,"path":746648054797942320,"deps":[[5105710422153833948,"common",false,11821167848484302318],[14600279144047733637,"engine",false,10565229124580286491]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/server-b2e516feb17b9506/dep-bin-server","checksum":false}}],"rustflags":[],"config":8247474407144887393,"compile_kind":0} \ No newline at end of file diff --git a/target/debug/.fingerprint/server-b2e516feb17b9506/dep-bin-server b/target/debug/.fingerprint/server-b2e516feb17b9506/dep-bin-server deleted file mode 100644 index 5c54f74..0000000 Binary files a/target/debug/.fingerprint/server-b2e516feb17b9506/dep-bin-server and /dev/null differ diff --git a/target/debug/.fingerprint/server-b2e516feb17b9506/invoked.timestamp b/target/debug/.fingerprint/server-b2e516feb17b9506/invoked.timestamp deleted file mode 100644 index e00328d..0000000 --- a/target/debug/.fingerprint/server-b2e516feb17b9506/invoked.timestamp +++ /dev/null @@ -1 +0,0 @@ -This file has an mtime of when this was started. \ No newline at end of file diff --git a/target/debug/deps/cli-9792b054fead65f0.d b/target/debug/deps/cli-9792b054fead65f0.d deleted file mode 100644 index 3c21745..0000000 --- a/target/debug/deps/cli-9792b054fead65f0.d +++ /dev/null @@ -1,5 +0,0 @@ -/home/shivu/Desktop/projects/axii/target/debug/deps/cli-9792b054fead65f0.d: cli/src/main.rs - -/home/shivu/Desktop/projects/axii/target/debug/deps/libcli-9792b054fead65f0.rmeta: cli/src/main.rs - -cli/src/main.rs: diff --git a/target/debug/deps/common-d52c5250bbb2aa31.d b/target/debug/deps/common-d52c5250bbb2aa31.d deleted file mode 100644 index f161cd2..0000000 --- a/target/debug/deps/common-d52c5250bbb2aa31.d +++ /dev/null @@ -1,7 +0,0 @@ -/home/shivu/Desktop/projects/axii/target/debug/deps/common-d52c5250bbb2aa31.d: common/src/lib.rs common/src/error.rs common/src/types.rs - -/home/shivu/Desktop/projects/axii/target/debug/deps/libcommon-d52c5250bbb2aa31.rmeta: common/src/lib.rs common/src/error.rs common/src/types.rs - -common/src/lib.rs: -common/src/error.rs: -common/src/types.rs: diff --git a/target/debug/deps/engine-970377fa98761e24.d b/target/debug/deps/engine-970377fa98761e24.d deleted file mode 100644 index f4ab0b6..0000000 --- a/target/debug/deps/engine-970377fa98761e24.d +++ /dev/null @@ -1,17 +0,0 @@ -/home/shivu/Desktop/projects/axii/target/debug/deps/engine-970377fa98761e24.d: engine/src/lib.rs engine/src/db.rs engine/src/memtable/mod.rs engine/src/memtable/skiplist.rs engine/src/sstable/mod.rs engine/src/sstable/block.rs engine/src/sstable/index.rs engine/src/sstable/reader.rs engine/src/wal/mod.rs engine/src/wal/writer.rs engine/src/compaction/mod.rs engine/src/compaction/worker.rs engine/src/utils.rs - -/home/shivu/Desktop/projects/axii/target/debug/deps/libengine-970377fa98761e24.rmeta: engine/src/lib.rs engine/src/db.rs engine/src/memtable/mod.rs engine/src/memtable/skiplist.rs engine/src/sstable/mod.rs engine/src/sstable/block.rs engine/src/sstable/index.rs engine/src/sstable/reader.rs engine/src/wal/mod.rs engine/src/wal/writer.rs engine/src/compaction/mod.rs engine/src/compaction/worker.rs engine/src/utils.rs - -engine/src/lib.rs: -engine/src/db.rs: -engine/src/memtable/mod.rs: -engine/src/memtable/skiplist.rs: -engine/src/sstable/mod.rs: -engine/src/sstable/block.rs: -engine/src/sstable/index.rs: -engine/src/sstable/reader.rs: -engine/src/wal/mod.rs: -engine/src/wal/writer.rs: -engine/src/compaction/mod.rs: -engine/src/compaction/worker.rs: -engine/src/utils.rs: diff --git a/target/debug/deps/libcli-9792b054fead65f0.rmeta b/target/debug/deps/libcli-9792b054fead65f0.rmeta deleted file mode 100644 index e69de29..0000000 diff --git a/target/debug/deps/libcommon-d52c5250bbb2aa31.rmeta b/target/debug/deps/libcommon-d52c5250bbb2aa31.rmeta deleted file mode 100644 index 1b17146..0000000 Binary files a/target/debug/deps/libcommon-d52c5250bbb2aa31.rmeta and /dev/null differ diff --git a/target/debug/deps/libengine-970377fa98761e24.rmeta b/target/debug/deps/libengine-970377fa98761e24.rmeta deleted file mode 100644 index 28c0143..0000000 Binary files a/target/debug/deps/libengine-970377fa98761e24.rmeta and /dev/null differ diff --git a/target/debug/deps/libserver-b2e516feb17b9506.rmeta b/target/debug/deps/libserver-b2e516feb17b9506.rmeta deleted file mode 100644 index e69de29..0000000 diff --git a/target/debug/deps/server-b2e516feb17b9506.d b/target/debug/deps/server-b2e516feb17b9506.d deleted file mode 100644 index d77d02f..0000000 --- a/target/debug/deps/server-b2e516feb17b9506.d +++ /dev/null @@ -1,5 +0,0 @@ -/home/shivu/Desktop/projects/axii/target/debug/deps/server-b2e516feb17b9506.d: server/src/main.rs - -/home/shivu/Desktop/projects/axii/target/debug/deps/libserver-b2e516feb17b9506.rmeta: server/src/main.rs - -server/src/main.rs: diff --git a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/dep-graph.bin b/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/dep-graph.bin deleted file mode 100644 index 21aa107..0000000 Binary files a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/dep-graph.bin and /dev/null differ diff --git a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/query-cache.bin b/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/query-cache.bin deleted file mode 100644 index d2bdb69..0000000 Binary files a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/query-cache.bin and /dev/null differ diff --git a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/work-products.bin b/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/work-products.bin deleted file mode 100644 index c765834..0000000 Binary files a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg-e7v2cxw1ekgbv09fo09ti3fmt/work-products.bin and /dev/null differ diff --git a/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg.lock b/target/debug/incremental/cli-2juybg9qrtnln/s-hhr14owzrv-15i6hhg.lock deleted file mode 100644 index e69de29..0000000 diff --git a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/dep-graph.bin b/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/dep-graph.bin deleted file mode 100644 index 8110b72..0000000 Binary files a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/dep-graph.bin and /dev/null differ diff --git a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/metadata.rmeta b/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/metadata.rmeta deleted file mode 100644 index 1b17146..0000000 Binary files a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/metadata.rmeta and /dev/null differ diff --git a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/query-cache.bin b/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/query-cache.bin deleted file mode 100644 index ab3111e..0000000 Binary files a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/query-cache.bin and /dev/null differ diff --git a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/work-products.bin b/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/work-products.bin deleted file mode 100644 index a91316d..0000000 Binary files a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl-8usja5bgsb6e47mhtqbml7ntm/work-products.bin and /dev/null differ diff --git a/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl.lock b/target/debug/incremental/common-2u34k8gtzsyb8/s-hhr14ou8eq-1e5rbcl.lock deleted file mode 100644 index e69de29..0000000 diff --git a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/dep-graph.bin b/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/dep-graph.bin deleted file mode 100644 index 2b4eddd..0000000 Binary files a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/dep-graph.bin and /dev/null differ diff --git a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/metadata.rmeta b/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/metadata.rmeta deleted file mode 100644 index 28c0143..0000000 Binary files a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/metadata.rmeta and /dev/null differ diff --git a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/query-cache.bin b/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/query-cache.bin deleted file mode 100644 index ecd2a79..0000000 Binary files a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/query-cache.bin and /dev/null differ diff --git a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/work-products.bin b/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/work-products.bin deleted file mode 100644 index a91316d..0000000 Binary files a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg-2gisnwlbvoywo5fw91w5yyvg9/work-products.bin and /dev/null differ diff --git a/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg.lock b/target/debug/incremental/engine-2qigxvctoc1wd/s-hhr14owzrh-1iylwyg.lock deleted file mode 100644 index e69de29..0000000 diff --git a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/dep-graph.bin b/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/dep-graph.bin deleted file mode 100644 index 49ddb1e..0000000 Binary files a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/dep-graph.bin and /dev/null differ diff --git a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/query-cache.bin b/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/query-cache.bin deleted file mode 100644 index a65092b..0000000 Binary files a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/query-cache.bin and /dev/null differ diff --git a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/work-products.bin b/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/work-products.bin deleted file mode 100644 index c765834..0000000 Binary files a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf-3jl6hiaa9588oym3baop3xeqw/work-products.bin and /dev/null differ diff --git a/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf.lock b/target/debug/incremental/server-069rbhnayuf2z/s-hhr14oxh71-1j2khnf.lock deleted file mode 100644 index e69de29..0000000