rust-in-action / code

Source code for the book Rust in Action
https://www.manning.com/books/rust-in-action?a_aid=rust&a_bid=0367c58f&chan=github
1.9k stars 445 forks source link

ch7-actionkv2: Disk Delete Issue #71

Closed zacfpearson closed 2 years ago

zacfpearson commented 2 years ago

Working with actionkv2 a bit and it looks like the "delete" keyword is broken for the disk version.

.\akv_disk.exe test_disk insert MN StPaul

.\akv_disk.exe test_disk insert PA Harrisburgh

.\akv_disk.exe test_disk get MN OUTPUT: [83, 116, 80, 97, 117, 108]

.\akv_disk.exe test_disk delete MN

.\akv_disk.exe test_disk get MN OUTPUT: [83, 116, 80, 97, 117, 108]

I think it's just adding the store_on_disk after updating the in memory kv. I made the change locally and it seems to be working.

"delete" => { a.delete(key).unwrap(); store_index_on_disk(&mut a, INDEX_KEY); }

zacfpearson commented 2 years ago

Can Close. Looks like there is a PR up for this already.

timClicks commented 2 years ago

Thanks for the reporting this. Sorry about the confusion.