Cleanup
This commit is contained in:
parent
2261fe39de
commit
3bf04ae2d6
7 changed files with 194 additions and 215 deletions
|
|
@ -1,17 +1,15 @@
|
|||
use tokio::sync::{Mutex, RwLock};
|
||||
use tokio::fs::{File, OpenOptions};
|
||||
use tokio::io::{BufReader, BufWriter, AsyncReadExt, AsyncWriteExt, AsyncSeekExt, SeekFrom};
|
||||
use tokio::fs;
|
||||
use std::path::Path;
|
||||
|
||||
mod storage_engine;
|
||||
mod binary_coding;
|
||||
mod error;
|
||||
mod index;
|
||||
mod cursor;
|
||||
mod entry;
|
||||
mod entry_header;
|
||||
mod store_header;
|
||||
|
||||
use crate::storage_engine::*;
|
||||
use crate::cursor::*;
|
||||
use crate::entry::{Entry, EntryDetailed};
|
||||
use crate::storage_engine::{Store, FilePosition};
|
||||
use crate::cursor::{ReadCursor, WriteCursor};
|
||||
|
||||
type Data = u32;
|
||||
|
||||
|
|
@ -46,7 +44,7 @@ async fn create_or_connect() -> Result<Store<Data>> {
|
|||
}
|
||||
|
||||
|
||||
async fn append_entry(cursor: &mut WriteCursor<'_, Data>, entry: &Entry<Data>) -> Result<FilePosition>{
|
||||
async fn append_entry(cursor: &mut WriteCursor<'_, Data>, entry: &Entry<Data>) -> Result<FilePosition> {
|
||||
println!("APPENDING");
|
||||
println!("entry == {:?}", entry);
|
||||
let file_position: FilePosition = cursor.append_entry(&entry).await.map_err(|e| e.to_io_or_panic())?;
|
||||
|
|
@ -54,7 +52,7 @@ async fn append_entry(cursor: &mut WriteCursor<'_, Data>, entry: &Entry<Data>) -
|
|||
Ok(file_position)
|
||||
}
|
||||
|
||||
async fn read_entry(cursor: &mut Cursor<Data>, file_position: FilePosition) -> Result<Option<EntryDetailed<Data>>>{
|
||||
async fn read_entry(cursor: &mut ReadCursor<Data>, file_position: FilePosition) -> Result<Option<EntryDetailed<Data>>> {
|
||||
println!("READING ENTRY at file_position={}", file_position);
|
||||
// let entry = cursor.read_entry_at(file_position).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("ENTRY: {:?}", entry);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue