rufus-tokyo 0.1.5, hail to the Tyrant
If you go to the the Tokyo Cabinet page, you’ll sometimes be welcome with a banner saying “Nagoya Cabinet” or “Shinjuku Cupboard”, no worries, you’re at the right place.
The two main projects of Mikio Hirabayashi are Tokyo Cabinet (local hash / table) and Tokyo Tyrant (remote Tokyo Cabinet).
After supporting Tokyo Cabinet in rufus-tokyo 0.1.4, Justin and I included support for Tokyo Tyrant in rufus-tokyo 0.1.5.
Getting Tokyo Cabinet and Tyrant is relatively easy, it boils down to getting the source from sf.net and then unpacking them and running “./configure && make && sudo make” for both of them (a more detailed description of the compile/install steps).
# # start a tyrant server from the command line : # # ttserver -port 45000 data.tch # require 'rubygems' require 'rufus/tokyo' # sudo gem install 'rufus-tokyo' t = Rufus::Tokyo::Tyrant.new('localhost', 45000) t['shinjuku'] = 'twin towers' t['ikebukuro'] = 'pond bag' p t['ikebukuro'] # => 'pond bag' t.close
Looks great, but since Tokyo Tyrant speaks kling… memcached, one is probably better served (in terms of performance) by a classic ruby memcached client library.
Still there is one area where rufus-tokyo + Tokyo Tyrant could make sense :
# # on the command line, launch a tyrant server with a stable structure : # # ttserver -port 45001 data.tct # # (note the .tct suffix, it indicates to the Tyrant it has to create # a table structure) # require 'rubygems' require 'rufus/tokyo/tyrant' # sudo gem install 'rufus-tokyo' t = Rufus::Tokyo::TyrantTable.new('localhost', 45001) t['pk0'] = { 'name' => 'jim', 'age' => '25', 'lang' => 'ja,en' } t['pk1'] = { 'name' => 'jeff', 'age' => '32', 'lang' => 'en,es' } t['pk2'] = { 'name' => 'jack', 'age' => '44', 'lang' => 'en' } t['pk3'] = { 'name' => 'jake', 'age' => '45', 'lang' => 'en,li' } # ... p t.keys # => [ 'pk0', 'pk1', 'pk2', 'pk3' ] p t.query { |q| q.add 'lang', :includes, 'en' q.limit 2 } # => # [{"name"=>"jim", :pk=>"pk0", "lang"=>"ja,en", "age"=>"25"}, # {"name"=>"jeff", :pk=>"pk1", "lang"=>"en,es", "age"=>"32"}] # ... t.close
There is one potential and interesting development for rufus-tokyo : Yehuda Katz integrated it into Moneta, his “unified interface to key/value stores”. Looking forward to see how it develops.
Many thanks to Justin, Yehuda and Zev for their work/support/help.
http://github.com/jmettraux/rufus-tokyo
Tested with Ruby 1.8.6 and Ruby 1.9.1p0 (There is a small issue with JRuby 1.1.6, I hope to solve it very soon and release a 0.1.6 for it).
tyrant
Oh joy! I’ve been wanting something like this for a while now. Just add validations and I’m set. dm-adapter for yet?
ActsAsFlinn
February 16, 2009 at 3:15 am
Hello Flinn,
I don’t think I will add validations, sorry.
dm-adapter, maybe, more at :
http://github.com/makoto/dm-tokyo-cabinet-adapter/
http://github.com/cheapRoc/dm-tyrant-adapter/
http://github.com/wycats/moneta/
Best regards,
John Mettraux
February 16, 2009 at 3:50 am
Thanks will probably work on cheapRoc/dm-tyrant-adapter if possible.
ActsAsFlinn
February 16, 2009 at 4:00 am
[…] Rufus 0.1.5 Release Notes – https://jmettraux.wordpress.com/2009/02/13/rufus-tokyo-015-hail-to-the-tyrant/ […]
» Tokyo Cabinet and Tyrant for Ruby Gittr
May 9, 2009 at 12:19 am
line 11 should now read:
require ‘rufus/tokyo/tyrant’
choonkeat
June 24, 2009 at 6:47 pm
Thanks a lot, updated !
John Mettraux
June 24, 2009 at 11:16 pm
[…] of the project, is actively maintaining the Tokyo Cabinet (rdoc) and Tokyo Tyrant (rdoc) libraries. John Mettraux is working on a FFI-backed, and arguably much more Ruby friendly version: rufus-tokyo, and Makoto Inoue has a prototype […]
Tokyo Cabinet: Beyond Key-Value Store - igvita.com
November 8, 2009 at 6:44 pm