From 02861dd8ef0b13625eaf4cf18e75ed07ea567e25 Mon Sep 17 00:00:00 2001 From: Benjamin Riley Zimmerman Date: Wed, 11 Sep 2024 14:17:27 -0700 Subject: [PATCH] create bplus db skeleton and reserve db module --- src/database/bplus/mod.rs | 84 +++++++++++++++++++++++++++++++++++++++ src/database/mod.rs | 1 + 2 files changed, 85 insertions(+) create mode 100644 src/database/bplus/mod.rs diff --git a/src/database/bplus/mod.rs b/src/database/bplus/mod.rs new file mode 100644 index 0000000..0814217 --- /dev/null +++ b/src/database/bplus/mod.rs @@ -0,0 +1,84 @@ +//! # Bplus Database [WIP] +//! +//! This module provides a database implementation backed by a +//! persistent bplus tree. + +/* IMPORTS */ + +use anyhow::Result; +use bitvec::prelude::{BitSlice, Msb0}; + +use std::path::Path; + +use crate::{ + model::State, + database::{Persistence, KVStore, Persistent, Tabular, Record, Schema}, +}; + +/* CONSTANTS */ + + + +/* DATABASE DEFINITION */ + +pub struct Database<'a> { + data: &'a str, +} + +pub struct Parameters<'a> { + persistence: Persistence<'a>, +} + +/* IMPLEMENTATION */ + +impl Database<'_> { + pub fn initialize(params: Parameters) -> Result { + todo!() + } +} + +impl KVStore for Database<'_> { + fn put(&mut self, key: State, value: &R) { + todo!() + } + + fn get(&self, key: State) -> Option<&BitSlice> { + todo!() + } + + fn del(&self, key: State) { + todo!() + } +} + +impl Persistent for Database<'_> { + fn bind_path(&self, path: &Path) -> Result<()> { + todo!() + } + + fn materialize(&self) -> Result<()> { + todo!() + } +} + +impl Tabular for Database<'_> { + fn create_table(&self, id: &str, schema: Schema) -> Result<()> { + todo!() + } + + fn select_table(&self, id: &str) -> Result<()> { + todo!() + } + + fn delete_table(&self, id: &str) -> Result<()> { + todo!() + } +} + +/* UNIT TESTING */ + + +#[cfg(test)] +mod tests { + use super::*; +} \ No newline at end of file diff --git a/src/database/mod.rs b/src/database/mod.rs index 9a66927..404669f 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -24,6 +24,7 @@ mod util; pub mod volatile; pub mod vector; pub mod lsmt; +pub mod bplus; /* DATABASE PARAMETERS */