GithubHelp home page GithubHelp logo

dm-tokyo-cabinet-adapter's Introduction

DataMapper Tokyo Cabinet Adapter

Description

A DataMapper Tokyo Cabinet 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.9

  • tokyocabinet ~> 1.21

Install

  • Via gem:

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

    git clone git://github.com/shanna/dm-tokyo-cabinet-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__)
)

# 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 TokyoCabinet::TDB 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.

Yes I realize there is already another dm-tokyo-cabinet-adapter on github. I chose to occupy the most obvious name also as this table store is arguably better suited than the existing b-tree adapter to DataMappers relational database centric API.

That said ideally in the future I’d like to contribute to these broader goals:

  • All the TokyoCabinet table 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.

dm-tokyo-cabinet-adapter's People

Contributors

shanna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.