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 a KVValue enum that holds either a value or Deleted, 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 to get("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.

← Older
Writing bits to disk: toykv
→ Newer
How SSH works, under the hood