Class: Droonga::Command::DroongaEngine::Configuration
- Inherits:
-
Object
- Object
- Droonga::Command::DroongaEngine::Configuration
- Defined in:
- lib/droonga/command/droonga_engine.rb
Instance Attribute Summary collapse
-
#ready_notify_fd ⇒ Object
readonly
Returns the value of attribute ready_notify_fd.
Instance Method Summary collapse
- #add_command_line_options(parser) ⇒ Object
- #address_family ⇒ Object
- #daemon? ⇒ Boolean
- #engine_name ⇒ Object
- #heartbeat_socket ⇒ Object
- #host ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #internal_connection_lifetime ⇒ Object
- #listen_socket ⇒ Object
- #log_file_path ⇒ Object
- #log_level ⇒ Object
- #pid_file_path ⇒ Object
- #port ⇒ Object
- #serf_agent_pid ⇒ Object
- #tag ⇒ Object
- #to_engine_command_line ⇒ Object
- #to_service_command_line ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/droonga/command/droonga_engine.rb', line 95 def initialize @config = nil @host = nil @port = nil @tag = nil @internal_connection_lifetime = nil @log_level = nil @log_file = nil @daemon = nil @pid_file_path = nil @ready_notify_fd = nil @listen_fd = nil @heartbeat_fd = nil @serf_agent_pid = nil end |
Instance Attribute Details
#ready_notify_fd ⇒ Object (readonly)
Returns the value of attribute ready_notify_fd.
94 95 96 |
# File 'lib/droonga/command/droonga_engine.rb', line 94 def ready_notify_fd @ready_notify_fd end |
Instance Method Details
#add_command_line_options(parser) ⇒ Object
193 194 195 196 197 198 199 200 |
# File 'lib/droonga/command/droonga_engine.rb', line 193 def (parser) (parser) (parser) (parser) (parser) (parser) (parser) end |
#address_family ⇒ Object
119 120 121 122 |
# File 'lib/droonga/command/droonga_engine.rb', line 119 def address_family ip_address = IPAddr.new(IPSocket.getaddress(host)) ip_address.family end |
#daemon? ⇒ Boolean
154 155 156 157 158 159 |
# File 'lib/droonga/command/droonga_engine.rb', line 154 def daemon? daemon = @daemon daemon = config["daemon"] if daemon.nil? daemon = false if daemon.nil? daemon end |
#engine_name ⇒ Object
115 116 117 |
# File 'lib/droonga/command/droonga_engine.rb', line 115 def engine_name "#{host}:#{port}/#{tag}" end |
#heartbeat_socket ⇒ Object
206 207 208 |
# File 'lib/droonga/command/droonga_engine.rb', line 206 def heartbeat_socket @heartbeat_socket ||= create_heartbeat_socket end |
#host ⇒ Object
124 125 126 |
# File 'lib/droonga/command/droonga_engine.rb', line 124 def host @host || config["host"] || default_host end |
#internal_connection_lifetime ⇒ Object
136 137 138 139 140 |
# File 'lib/droonga/command/droonga_engine.rb', line 136 def internal_connection_lifetime @internal_connection_lifetime || config["internal_connection_lifetime"] || default_internal_connection_lifetime end |
#listen_socket ⇒ Object
202 203 204 |
# File 'lib/droonga/command/droonga_engine.rb', line 202 def listen_socket @listen_socket ||= create_listen_socket end |
#log_file_path ⇒ Object
146 147 148 |
# File 'lib/droonga/command/droonga_engine.rb', line 146 def log_file_path @log_file_path || config["log_file"] || default_log_file_path end |
#log_level ⇒ Object
142 143 144 |
# File 'lib/droonga/command/droonga_engine.rb', line 142 def log_level @log_level || config["log_level"] || default_log_level end |
#pid_file_path ⇒ Object
150 151 152 |
# File 'lib/droonga/command/droonga_engine.rb', line 150 def pid_file_path @pid_file_path || config["pid_file"] || default_pid_file_path end |
#port ⇒ Object
128 129 130 |
# File 'lib/droonga/command/droonga_engine.rb', line 128 def port @port || config["port"] || default_port end |
#serf_agent_pid ⇒ Object
210 211 212 |
# File 'lib/droonga/command/droonga_engine.rb', line 210 def serf_agent_pid @serf_agent_pid end |
#tag ⇒ Object
132 133 134 |
# File 'lib/droonga/command/droonga_engine.rb', line 132 def tag @tag || config["tag"] || default_tag end |
#to_engine_command_line ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/droonga/command/droonga_engine.rb', line 161 def to_engine_command_line = [ "--host", host, "--port", port.to_s, "--tag", tag, "--internal-connection-lifetime", internal_connection_lifetime.to_s, "--log-level", log_level, ] if log_file_path .concat(["--log-file", log_file_path.to_s]) end if pid_file_path .concat(["--pid-file", pid_file_path.to_s]) end if daemon? << "--daemon" else << "--no-daemon" end end |
#to_service_command_line ⇒ Object
184 185 186 187 188 189 190 191 |
# File 'lib/droonga/command/droonga_engine.rb', line 184 def to_service_command_line = [ "--engine-name", engine_name, "--internal-connection-lifetime", internal_connection_lifetime.to_s, ] end |