No commit activity in last 3 years
No release in over 3 years
Tokyo Cabinet/Tyrant Table DataMapper Adapter.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.10.0
 Project Readme

DataMapper Tokyo Cabinet/Tyrant Table Store Adapter¶ ↑

Description¶ ↑

A DataMapper Tokyo Cabinet/Tyrant table store adapter.

Table Store¶ ↑

tokyocabinet.sourceforge.net/spex-en.html#features_tctdb

The Tokyo Cabinet table storage engine doesn’t require a predefined schema and as such properties in your resource are only used for by the adapter for typecasting. There is no need to migrate your resource when you create, update or delete properties.

Dependencies¶ ↑

Ruby
  • dm-core ~> 0.10.0

  • rufus-tokyo ~> 0.1.12

Install¶ ↑

  • Via gem:

    gem install shanna-dm-tokyo-adapter -s http://gems.github.com
  • Via git:

    git clone git://github.com/shanna/dm-tokyo-adapter.git
    rake install

Synopsis¶ ↑

# Tokyo Cabinet DB files will be located in #{path}/#{database}/#{resource}.tdb
DataMapper.setup(:default,
  :adapter  => 'tokyo_cabinet',
  :database => 'tc',
  :path     => File.dirname(__FILE__)
)

# Tokyo Tyrant connection.
DataMapper.setup(:default,
  :adapter  => 'tokyo_tyrant',
  :host     => 'localhost',
  :port     => '1978'
)

# Define your DataMapper resource and start saving:
class User
  include DataMapper::Resource
  property :id, Serial
  property :name, String
  property :age, Integer
end

# No need to (auto_)migrate!
User.create(:name => 'Fred', :age => '25')

# Conditions:
users = User.all(:age.gte => 10, :limit => 20, :order => [:age.asc])

TODO¶ ↑

  • Documentation. It’s undocumented at the moment.

  • Give access to the Rufus::Tokyo::Table object through the adapter. Handy if you want to add indexes and other things that can’t be done through the DataMapper API.

  • Better tests. I haven’t really tested all the DM primitives and query operators yet.

  • Better typecasting. DataTime and Time should typecast to Integer so that they can be searched using the numeric operators.

Ideally in the future I’d like to contribute to these broader goals:

  • All the TokyoCabinet stores equally supported in DM.

  • DataMapper define a public/semipublic API for key => value and search stores through Moneta (memcachedb, memcacheq, couchdb, mtokyo cabinet bdb, etc.)

  • DataMapper per adapter query operators. You can’t always shoehorn everything into an SQL mindset.

Contributing¶ ↑

Go nuts. Just send me a pull request (github or otherwise) when you are happy with your code.

Copyright © 2009 “Shane Hanna”. See LICENSE for details.