Class: Herdis::Plugins::ShepherdConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/herdis/plugins/shepherd_connection.rb

Constant Summary collapse

@@shepherd =
nil

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(port, config, status, logger) ⇒ ShepherdConnection

Returns a new instance of ShepherdConnection.



21
22
23
24
# File 'lib/herdis/plugins/shepherd_connection.rb', line 21

def initialize(port, config, status, logger)
  @port = port
  @logger = logger
end

Class Method Details

.shepherdObject



7
8
9
# File 'lib/herdis/plugins/shepherd_connection.rb', line 7

def self.shepherd
  @@shepherd
end

.shutdownObject



11
12
13
14
# File 'lib/herdis/plugins/shepherd_connection.rb', line 11

def self.shutdown
  @@shepherd.shutdown unless @@shepherd.nil?
  @@shepherd = nil
end

.shutdown_clusterObject



16
17
18
19
# File 'lib/herdis/plugins/shepherd_connection.rb', line 16

def self.shutdown_cluster
  @@shepherd.shutdown_cluster unless @@shepherd.nil?
  @@shepherd = nil
end

Instance Method Details

#runObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/herdis/plugins/shepherd_connection.rb', line 26

def run
  opts = {}
  copy_from_env(opts, :first_port, :to_i)
  copy_from_env(opts, :dir)
  copy_from_env(opts, :host)
  copy_from_env(opts, :restart)
  copy_from_env(opts, :port, :to_i)
  copy_from_env(opts, :shepherd_id)
  copy_from_env(opts, :inmemory)
  copy_from_env(opts, :redundancy, :to_i)
  copy_from_env(opts, :connect_to)
  opts[:port] = @port
  opts[:logger] = @logger
  @@shepherd = Herdis::Shepherd.new(opts)
end