Sha256: 4409737537879c1c5bd529a1fd4fa8895c672f5641450a781f506adf16e745ca

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'dm-tokyo-adapter/cabinet'

module DataMapper
  module Adapters
    module Tokyo

      # A DataMapper Tokyo Tyrant table store adapter.
      #
      # http://tokyocabinet.sourceforge.net/tyrantdoc/
      # http://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 by the adapter for typecasting. There is no need to migrate your resource when you
      # create, update or delete properties.
      #
      # == See
      #
      # DataMapper::Adapters::Tokyo::Query:: Table Query.
      class TyrantAdapter < Tokyo::CabinetAdapter
        protected

          #--
          # TODO: Default port to 1978?
          def create_connection(model)
            credentials = [@options[:socket] || @options.values_at(:host, :port)]
            Rufus::Tokyo::TyrantTable.new(*credentials.flatten)
          end
      end # TyrantAdapter
    end # Tokyo

    TokyoTyrantAdapter = Tokyo::TyrantAdapter
    const_added(:TokyoTyrantAdapter)
  end # Adapters
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shanna-dm-tokyo-adapter-0.2.1 lib/dm-tokyo-adapter/tyrant.rb
shanna-dm-tokyo-adapter-0.3.0 lib/dm-tokyo-adapter/tyrant.rb
shanna-dm-tokyo-adapter-0.3.1 lib/dm-tokyo-adapter/tyrant.rb