-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from BnjmnZmmrmn/bplusdb
- Loading branch information
Showing
4 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//! # Bplus Tree Errors [WIP] | ||
//! | ||
//! This file contains error codes that are | ||
//! surfaced in the Bplus Tree API. | ||
|
||
/* IMPORTS */ | ||
|
||
use std::fmt::{Formatter, Result}; | ||
|
||
/* CONSTANTS */ | ||
|
||
/* DEFINITIONS */ | ||
|
||
#[derive(Debug)] | ||
pub enum Error { | ||
UnexpectedError, | ||
} | ||
|
||
/* IMPLEMENTATIONS */ | ||
|
||
impl std::fmt::Display for Error { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> Result { | ||
todo!() | ||
} | ||
} | ||
|
||
impl std::convert::From<std::io::Error> for Error { | ||
fn from(_e: std::io::Error) -> Error { | ||
Error::UnexpectedError | ||
} | ||
} | ||
|
||
/* UNIT TESTING */ | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//! # Bplus Tree Module [WIP] | ||
//! | ||
//! This module provides a b+ tree data structure | ||
//! that supports insert, delete, and lookup operations. | ||
|
||
/* UTILITY MODULES */ | ||
|
||
mod error; | ||
|
||
/* IMPLEMENTATION MODULES */ | ||
|
||
mod tree; | ||
|
||
/* IMPORTS */ | ||
|
||
pub use tree::{BTree, BTreeBuilder}; | ||
|
||
/* UNIT TESTING */ | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//! # Bplus Tree Implementation [WIP] | ||
//! | ||
//! This file contains a b+ tree implementation | ||
//! and a b+ tree builder to help with construction. | ||
|
||
/* IMPORTS */ | ||
|
||
use anyhow::Result; | ||
use crate::{ | ||
database::{bplus::index::error::Error, Record}, | ||
model::State, | ||
}; | ||
|
||
/* DEFINITIONS */ | ||
|
||
struct BTreeRecord { | ||
} | ||
|
||
pub struct BTree<> { | ||
} | ||
|
||
pub struct BTreeBuilder { | ||
} | ||
|
||
/* IMPLEMENTATIONS */ | ||
|
||
impl Record for BTreeRecord { | ||
fn raw(&self) -> &bitvec::prelude::BitSlice<u8, bitvec::prelude::Msb0> { | ||
todo!() | ||
} | ||
} | ||
|
||
impl BTree<> { | ||
fn insert(&mut self, record: BTreeRecord) -> Result<(), Error> { | ||
todo!() | ||
} | ||
|
||
fn delete(&mut self, state: &State) -> Result<(), Error> { | ||
todo!() | ||
} | ||
|
||
fn lookup(&mut self, state: &State) -> Result<BTreeRecord, Error> { | ||
todo!() | ||
} | ||
|
||
#[cfg(debug_assertions)] | ||
fn print(&mut self) -> Result<(), Error> { | ||
todo!() | ||
} | ||
} | ||
|
||
|
||
impl BTreeBuilder<> { | ||
pub fn initialize() -> Result<Self> { | ||
todo!() | ||
} | ||
|
||
pub fn build(&self) -> Result<BTree, Error> { | ||
todo!() | ||
} | ||
} | ||
|
||
/* UNIT TESTING */ | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters