toykv updates
Since my last post, I’ve committed a couple of updates to toykv. The first is a nice functionality update, the second is enabled by my learning a little more rust.
Implement delete · mikerhodes/toykv@2325ff1
With this update, toykv gains a
delete(key)
method. I did this in essentiallly the way I outlined previously: by adding aKVValue
enum that holds either a value orDeleted
, then threading this through the library, including serialisation.Use generics with Into<Vec
> for API ergonomics · mikerhodes/toykv@53dc863 This is a nice update that reduces the amount of boilerplate, especially in tests.
Previously there was quite a bit of
get("foo".as_bytes().to_vec())
code, which has now been reduced toget("foo")
by making the get, set and delete methods generic.I think this can further be improved using
Cow
. I think that would avoid unneeded cloning of data. But that is for later.
Obviously the library is still a learning aide, but it’s getting closer to at least having the functionality you would want in a real storage layer.