Class: Auger::Cassandra

Inherits:
Connection show all
Defined in:
lib/plugins/cassandra.rb

Instance Attribute Summary

Attributes inherited from Connection

#connection, #options, #requests, #response, #roles

Instance Method Summary collapse

Methods inherited from Connection

#do_open, #initialize, load, #method_missing, #timeout

Constructor Details

This class inherits a constructor from Auger::Connection

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Auger::Connection

Instance Method Details

#close(cassandra) ⇒ Object



16
17
18
# File 'lib/plugins/cassandra.rb', line 16

def close(cassandra)
  cassandra.disconnect!
end

#cluster_name(&block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/plugins/cassandra.rb', line 20

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

#open(host, options) ⇒ Object



12
13
14
# File 'lib/plugins/cassandra.rb', line 12

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

#ring(&block) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/plugins/cassandra.rb', line 28

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

#schema_agreement?(&block) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
48
49
50
# File 'lib/plugins/cassandra.rb', line 44

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

#version(&block) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/plugins/cassandra.rb', line 36

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