Sha256: 7f02dca5f1cfccd5b945ca78406f0efa6f8c906cba3c0ca8fd6c27cf0342839f

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# coding: utf-8
# TODO
require 'mongo'

module UzuUzu
  module Kvs
    class Mongo
      #
      attr_reader :adapter
      
      #
      #
      #
      def initialize(env=nil)
        @adapter = :mongo
        @host = 'localhost'
        @port = 27017
        @db_name = 'uzuuzu'
        @spaces = {}
        if env
          @host = env['host'] || @host
          @port = env['port'] || @port
          @db_name = env['db'] || @db_name
        end
        @connection = Mongo::Connection.new(@host, @port)
        @db = @connection.db(@db_name)
      end
      
      #
      #
      #
      def space(name)
        @spaces[name] ||= Space.new(@db, name)
      end
      
      #
      #
      #
      class Space
        def initalize(db, space)
          @db = db
          @space = space
          @resource = @db[name]
        end
        
        def get(id)
          
        end
        
        def put(id, entity)
          
        end
        
        def find(params)
          
        end
        
        def find_all(params)
          
        end
        
        def method_missing(action, *args)
          @resource.send(action, *args)
        end # method_missing
      end # Space
    end # Mongo
  end # Kvs
end # UzuUzu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uzuuzu-core-0.0.10 lib/uzuuzu/kvs/mongo.rb
uzuuzu-core-0.0.9 lib/uzuuzu/kvs/mongo.rb