Module: Ciclope

Defined in:
lib/ciclope.rb,
lib/ciclope/host.rb,
lib/ciclope/ring.rb,
lib/ciclope/version.rb

Defined Under Namespace

Classes: Host, Ring

Constant Summary collapse

VERSION =
"0.0.5"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.auto_sort_connectionsObject

Returns the value of attribute auto_sort_connections.



8
9
10
# File 'lib/ciclope.rb', line 8

def auto_sort_connections
  @auto_sort_connections
end

.connectionsObject

Returns the value of attribute connections.



8
9
10
# File 'lib/ciclope.rb', line 8

def connections
  @connections
end

Class Method Details

.auto_sort?Boolean

Returns:

  • (Boolean)


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

def self.auto_sort?
  auto_sort_connections
end

.replication_seconds_behind_masterObject



24
25
26
27
28
29
30
# File 'lib/ciclope.rb', line 24

def self.replication_seconds_behind_master
  out = ring.hosts.map do |host|
    host.name + " ––– #{host.seconds_behind_master} seconds –––> "
  end
  out << ring.hosts.first.name
  out.join
end

.replication_statusObject



20
21
22
# File 'lib/ciclope.rb', line 20

def self.replication_status
  ring.hosts.map &:status
end

.ringObject



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

def self.ring
  @ring ||= Ring.new(connections, :sort_hosts => auto_sort?)
end