Sha256: 8620c8907598243e7b4eb09ec16714b2e59cfd9a680af283636901e8ea584b73

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'cassandra'

module Auger

  class Project
    def cassandra(port = 9160, &block)
      @connections << Cassandra.load(port, &block)
    end
  end

  class Cassandra < Auger::Connection
    def open(host, options)
      ::Cassandra.new(options[:keyspace], "#{host}:#{options[:port]}")
    end

    def close(cassandra)
      cassandra.disconnect!
    end

    def cluster_name(&block)
      @requests << Class.new(Auger::Request) do
        def run(cassandra)
          cassandra.cluster_name
        end
      end.load(nil, &block)
    end

    def ring(&block)
      @requests << Class.new(Auger::Request) do
        def run(cassandra)
          cassandra.ring
        end
      end.load(nil, &block)
    end

    def version(&block)
      @requests << Class.new(Auger::Request) do
        def run(cassandra)
          cassandra.version
        end
      end.load(nil, &block)
    end

    def schema_agreement?(&block)
      @requests << Class.new(Auger::Request) do
        def run(cassandra)
          cassandra.schema_agreement?
        end
      end.load(nil, &block)
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auger-1.3.2 lib/plugins/cassandra.rb
auger-1.3.1 lib/plugins/cassandra.rb
auger-1.3.0 lib/plugins/cassandra.rb
auger-1.2.4 lib/plugins/cassandra.rb
auger-1.2.3 lib/plugins/cassandra.rb