Geist is a Git-backed key-value store written in Ruby. You may call it "Git Explicit Item Storage Tool" if you really want too.
require 'geist'
g = Geist.new '~/some/storage/path'
g.set :foo, 'bar'
g.set :baz, 123
g.set :name => 'geist', :platform => 'ruby'
g.delete :baz
g.keys #=> ["foo", "name", "platform"]
g.get :foo #=> "bar"
g.get :baz #=> nil
g.get :name, :platform #=> ["geist", "ruby"]
To be honest, the introduction was an outright fabrication. Geist is just a Ruby API to misuse Git as a simple key-value store. Git itself is a pretty good key-value store used to preserve blob (file), tree (directory), commit and tag objects.
The Ruby objects to store as values will be marshalled into Git blob objects. These objects are referenced with lightweight Git tags named by the given key.
Git will not double store duplicate values. Instead, the different key tags will refer the same Git object.
As Geist uses Git tags as keys, only objects with a working #to_s
method can
be used as keys. Additionally, based on Git's ref naming rules, Geist
rejects keys that can't be used as Git tag names, e.g. containing non-printable
characters or backslashes.
This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License. A copy of this license can be found in the LICENSE file.
- Sebastian Staudt – koraktor(at)gmail.com
I love it when someone tries to use something in a way it's not necessarily meant to be used... Nice Idea...