Attempt at delete

This commit is contained in:
Yuriy Dupyn 2024-02-03 17:56:08 +01:00
parent 3e7e8665fd
commit 53aa5a0127
2 changed files with 93 additions and 41 deletions

View file

@ -24,10 +24,10 @@ async fn create_store() -> Result<Store<Data>> {
println!("THE BYTES: {:?}", store.read_all_bytes().await?);
let mut cursor = store.cursor(AccessMode::Write).await.map_err(|e| e.to_io_or_panic())?;
let entry0: Entry<u32> = Entry::new_deleted(vec![1, 2, 3, 4, 5]);
let entry0: Entry<u32> = Entry::new(vec![1, 2, 3, 4, 5]);
append_entry(&mut cursor, &entry0).await?;
let entry1: Entry<u32> = Entry::new_deleted(vec![200, 200, 5, 6, 7]);
let entry1: Entry<u32> = Entry::new(vec![200, 200, 5, 6, 7]);
append_entry(&mut cursor, &entry1).await?;
println!("{:?}", store.read_all_bytes().await?);
@ -83,6 +83,13 @@ async fn main() -> Result<()> {
let entry0: Entry<u32> = Entry::new(vec![99, 98, 97, 96, 95]);
append_entry(&mut cursor, &entry0).await?;
let entry1: Entry<u32> = Entry::new(vec![50,50,50,50,50]);
let file_position = append_entry(&mut cursor, &entry1).await?;
println!("CURRENT FILE_POSITION = {}", file_position);
// Now file_position point to entry1.
// cursor.mark_deleted_at(file_position).await.map_err(|e| e.to_io_or_panic())?;
// cursor.seek_to(file_position).await.map_err(|e| e.to_io_or_panic())?;
cursor.read_entries().await.map_err(|e| e.to_io_or_panic())?;