First attempt at storage engine
This commit is contained in:
parent
ee757c7ca2
commit
bd3fdb266f
6 changed files with 514 additions and 1 deletions
54
storage_engine/src/main.rs
Normal file
54
storage_engine/src/main.rs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
use tokio::sync::{Mutex, RwLock};
|
||||
use tokio::fs::{File, OpenOptions};
|
||||
use tokio::io::{BufReader, BufWriter, AsyncReadExt, AsyncWriteExt, AsyncSeekExt, SeekFrom};
|
||||
use tokio::fs;
|
||||
|
||||
mod storage_engine;
|
||||
|
||||
use crate::storage_engine::*;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), std::io::Error> {
|
||||
println!("STOOOOOOOOOOOORAAAAAAAAAAAGE");
|
||||
|
||||
let blob_name = "blob10.minisql";
|
||||
|
||||
// WARNING: Number of columns is 5?????
|
||||
|
||||
let mut store = Store::new(blob_name, 5).await.map_err(|e| e.to_io_or_panic())?;
|
||||
|
||||
// let store_bytes = store.get_all_bytes().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", store_bytes);
|
||||
|
||||
let mut buff: Vec<u8> = vec![0;1];
|
||||
let x = store.file.read_exact(&mut buff[..]).await?;
|
||||
println!("{:?}", buff);
|
||||
|
||||
|
||||
// let entry0: Entry<u32> = Entry::new_deleted(vec![1, 2, 3, 4, 5]);
|
||||
// let entry1: Entry<u32> = Entry::new_deleted(vec![200,200,5,6,7]);
|
||||
// let cursor0 = store.append_entry(&entry0).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// // println!("cursor0 = {}", cursor0);
|
||||
|
||||
// let cursor1 = store.append_entry(&entry1).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("cursor0 = {}, cursor1 = {}", cursor0, cursor1);
|
||||
|
||||
// let mut store = Store::connect(blob_name).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", store);
|
||||
|
||||
// let x = store.entry_at::<u32>(16).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
|
||||
// let store_bytes = store.get_all_bytes().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", store_bytes);
|
||||
|
||||
// let mut store = ColumnStore::connect("blob08.minisql").await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let entry2: StoreEntry<u32> = StoreEntry::new_deleted(vec![3, 2, 1]);
|
||||
// let cursor2 = store.append_entry(&entry2).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("cursor2 = {}", cursor2);
|
||||
// println!("{:?}", store);
|
||||
|
||||
|
||||
println!("DONE");
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue