Class: GroongaQueryLog::Replayer::Options
- Inherits:
-
Object
- Object
- GroongaQueryLog::Replayer::Options
- Defined in:
- lib/groonga-query-log/replayer.rb
Instance Attribute Summary collapse
-
#disable_cache ⇒ Object
writeonly
Sets the attribute disable_cache.
-
#error_responses_path ⇒ Object
Returns the value of attribute error_responses_path.
-
#host ⇒ Object
Returns the value of attribute host.
-
#n_clients ⇒ Object
Returns the value of attribute n_clients.
-
#output_type ⇒ Object
Returns the value of attribute output_type.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
- #request_queue_size ⇒ Object
-
#requests_path ⇒ Object
Returns the value of attribute requests_path.
-
#responses_path ⇒ Object
Returns the value of attribute responses_path.
-
#target_command_names ⇒ Object
Returns the value of attribute target_command_names.
Instance Method Summary collapse
- #create_client(&block) ⇒ Object
- #create_error_responses_output(&block) ⇒ Object
- #create_request_output(&block) ⇒ Object
- #create_responses_output(&block) ⇒ Object
- #disable_cache? ⇒ Boolean
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #target_command_name?(name) ⇒ Boolean
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/groonga-query-log/replayer.rb', line 170 def initialize @host = "127.0.0.1" @port = 10041 @protocol = :http @read_timeout = Groonga::Client::Default::READ_TIMEOUT @n_clients = 8 @request_queue_size = nil @disable_cache = false @target_command_names = [] @requests_path = nil @responses_path = nil @error_responses_path = nil @output_type = nil end |
Instance Attribute Details
#disable_cache=(value) ⇒ Object (writeonly)
Sets the attribute disable_cache
164 165 166 |
# File 'lib/groonga-query-log/replayer.rb', line 164 def disable_cache=(value) @disable_cache = value end |
#error_responses_path ⇒ Object
Returns the value of attribute error_responses_path.
168 169 170 |
# File 'lib/groonga-query-log/replayer.rb', line 168 def error_responses_path @error_responses_path end |
#host ⇒ Object
Returns the value of attribute host.
158 159 160 |
# File 'lib/groonga-query-log/replayer.rb', line 158 def host @host end |
#n_clients ⇒ Object
Returns the value of attribute n_clients.
162 163 164 |
# File 'lib/groonga-query-log/replayer.rb', line 162 def n_clients @n_clients end |
#output_type ⇒ Object
Returns the value of attribute output_type.
169 170 171 |
# File 'lib/groonga-query-log/replayer.rb', line 169 def output_type @output_type end |
#port ⇒ Object
Returns the value of attribute port.
159 160 161 |
# File 'lib/groonga-query-log/replayer.rb', line 159 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
160 161 162 |
# File 'lib/groonga-query-log/replayer.rb', line 160 def protocol @protocol end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
161 162 163 |
# File 'lib/groonga-query-log/replayer.rb', line 161 def read_timeout @read_timeout end |
#request_queue_size ⇒ Object
205 206 207 |
# File 'lib/groonga-query-log/replayer.rb', line 205 def request_queue_size @request_queue_size || @n_clients * 3 end |
#requests_path ⇒ Object
Returns the value of attribute requests_path.
166 167 168 |
# File 'lib/groonga-query-log/replayer.rb', line 166 def requests_path @requests_path end |
#responses_path ⇒ Object
Returns the value of attribute responses_path.
167 168 169 |
# File 'lib/groonga-query-log/replayer.rb', line 167 def responses_path @responses_path end |
#target_command_names ⇒ Object
Returns the value of attribute target_command_names.
165 166 167 |
# File 'lib/groonga-query-log/replayer.rb', line 165 def target_command_names @target_command_names end |
Instance Method Details
#create_client(&block) ⇒ Object
185 186 187 188 189 190 191 |
# File 'lib/groonga-query-log/replayer.rb', line 185 def create_client(&block) Groonga::Client.open(:host => @host, :port => @port, :protocol => @protocol, :read_timeout => @read_timeout, &block) end |
#create_error_responses_output(&block) ⇒ Object
201 202 203 |
# File 'lib/groonga-query-log/replayer.rb', line 201 def create_error_responses_output(&block) create_output(@error_responses_path, &block) end |
#create_request_output(&block) ⇒ Object
193 194 195 |
# File 'lib/groonga-query-log/replayer.rb', line 193 def create_request_output(&block) create_output(@requests_path, &block) end |
#create_responses_output(&block) ⇒ Object
197 198 199 |
# File 'lib/groonga-query-log/replayer.rb', line 197 def create_responses_output(&block) create_output(@responses_path, &block) end |
#disable_cache? ⇒ Boolean
209 210 211 |
# File 'lib/groonga-query-log/replayer.rb', line 209 def disable_cache? @disable_cache end |
#target_command_name?(name) ⇒ Boolean
213 214 215 216 217 218 219 220 |
# File 'lib/groonga-query-log/replayer.rb', line 213 def target_command_name?(name) return true if @target_command_names.empty? @target_command_names.any? do |name_pattern| flags = 0 flags |= File::FNM_EXTGLOB if File.const_defined?(:FNM_EXTGLOB) File.fnmatch(name_pattern, name, flags) end end |