Repository is archived
No commit activity in last 3 years
No release in over 3 years
This is a DataMapper adapter for FluidDB (www.fluidinfo.com) It makes heavy use of memcache and uses Typhoeus to parallelize fetching tag values. TyphoeusClient can also be used independently to make low-level requests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

dm-fluiddb-adapter¶ ↑

This is a DataMapper adapter for FluidDB (www.fluidinfo.com)

It makes heavy use of memcache and uses Typhoeus to parallelize fetching tag values. TyphoeusClient can also be used independently to make low-level requests.

The connect url for the adapter is:

fluiddb://test:test@sandbox.fluidinfo.com/test

That will connect to the sandbox instance of fluiddb as the test user with test password and use the subnamespace “test”.

Quickstart¶ ↑

# gem install dm-fluiddb-adapter
require 'dm-core'
require 'memcached'

CACHE = Memcached.new 'localhost:11211', :prefix_key => 'fluiddb-test:'
DataMapper.setup(:default, "fluiddb://test:test@sandbox.fluidinfo.com/test")

class MyModel
  include DataMapper::Resource

  property :id, String, :key => true
  property :name, String
end
# Ignore the 404 errors logged during the migration, it's just the adapter
# testing to see if the fluiddb tags/namespaces exist.
MyModel.auto_migrate!

MyModel.create(:name => 'Hello World')
puts MyModel.first.inspect

Details¶ ↑

It creates a namespace for each datamapper resource and a tag in that namespace for each property. It creates a tag with the same name as the namespace which it refers to as the ‘identity tag’ and tags all the objects for that resoruce with it.

When you delete an object it removes the identity tag and adds a ‘deleted’ tag from the resource’s namespace to the object. The ‘deleted’ tag is to help with garbage collection although garbage collection is not implemented by the adapter. The reasoning is that you may want to use custom tags for properties and use objects/tags between multiple tables/views.

The about tag is not currently supported, but is on the short list for features as is being able to customize or make optional the identity tag and the corresponding ‘identity query’ which is the fluidb query used to find the entire set of objects belonging to the datamapper resource. ‘Serial’ properties are not supported and resources require a column named ‘id’, type String, and marked with ‘:key => true’.

You can get access to the underlying http client for making direct requests by calling:

DataMapper.repository(:default).adapter.http

The advantage to using the adapter’s http instance is that Typhoeus has to create a pool of handles to libCURL and it creates them on demand. They are a little slow to start up, so it’s better to use a warmed up instance of the http client.

TODO¶ ↑

  • Add support for the ‘about’ fluiddb tag at creation.

  • Enable setting and/or removing the identity tag and query.

  • Add Set property type

  • Add Tag property type

  • Add range support for querying date attributes

Copyright © 2009 Jordan Curzon. See LICENSE for details.