back
Author here. Would be happy to answer any questions or clarify things. Its very much moreso a 'fun/useful toy' than 'production software' but there are some interesting principles that tie into it.
3 comments
Cool idea and thanks for sharing! I see that you are shelling out to run the git commands. Any reason for not using a git binding instead? rugged[0] is a pretty well-used library for interfacing with git directly.
This is definitely a plan in the future. My initial use case was operating off of the assumption that whatever server I would be running this on would have git pre-installed, so it was a simple way to get it up and running quickly. Thanks for the recommendation, its definitely towards the top of my todo list for 0.3 :)
The type is inferred from when you initially set the value. Note that saving the string '1' will return the integer 1 due to the naive nature of the implementation. Hashes, arrays and booleans behave as expected when saved.
Can you elaborate upon this in the readme? It wasn't clear to me whether git, ruby or the gkv has the naive implementation (or if the conversion only happens with the string '1').
Also is it possible to enumerate the versions of key-values that have been saved?
I'm sure I have several more questions but I'll leave it at that. Thanks for making this!
I just saw this now, sorry for being 5 days late if you even end up noticing it.
The typing is governed by YAML standards. This is why symbols are left out. Since it uses `YAML.dump` and `YAML.load` with the set/get, it will automatically assume the string '1' is an integer, '1.0' a float, and so on.
> is it possible to enumerate the versions of key-values that have been saved?
Yes, using the `get_version` method, you could do something like:
all_items = $ITEMS[key].map { |hash| db.get(hash) }
I should add this as a normal function to the API. Its now on my todo list.Just added the all past versions feature to the API now.
Have you tried comparing how this serves as a KV store as compared to other engines?
Someone added a PR with some benchmarks. Here they are on my system doing 1000 set/gets each time in 4 blocks [core i5, 8gb ram, ubuntu 15.04]
user system total real
set: 0.150000 0.080000 0.230000 ( 1.093421)
hash set: 0.110000 0.120000 0.230000 ( 1.085441)
get: 0.150000 0.040000 0.190000 ( 1.091698)
hash get: 0.110000 0.060000 0.170000 ( 1.075470)I've done no benchmarking yet. It is a piece that evolved initially from a project I was doing to just explore git's innards a bit more. I eventually gave a talk on what became v0.1 of this (only string store, no typing) at the Columbus Ruby Brigade, and have just been hacking on it a bit in the last couple of weeks because I've found it intriguing.