Class: GroongaQueryLog::Replayer::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/replayer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/groonga-query-log/replayer.rb', line 174

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

Parameters:

  • value

    the value to set the attribute disable_cache to.



168
169
170
# File 'lib/groonga-query-log/replayer.rb', line 168

def disable_cache=(value)
  @disable_cache = value
end

#error_responses_pathObject

Returns the value of attribute error_responses_path.



172
173
174
# File 'lib/groonga-query-log/replayer.rb', line 172

def error_responses_path
  @error_responses_path
end

#hostObject

Returns the value of attribute host.



162
163
164
# File 'lib/groonga-query-log/replayer.rb', line 162

def host
  @host
end

#n_clientsObject

Returns the value of attribute n_clients.



166
167
168
# File 'lib/groonga-query-log/replayer.rb', line 166

def n_clients
  @n_clients
end

#output_typeObject

Returns the value of attribute output_type.



173
174
175
# File 'lib/groonga-query-log/replayer.rb', line 173

def output_type
  @output_type
end

#portObject

Returns the value of attribute port.



163
164
165
# File 'lib/groonga-query-log/replayer.rb', line 163

def port
  @port
end

#protocolObject

Returns the value of attribute protocol.



164
165
166
# File 'lib/groonga-query-log/replayer.rb', line 164

def protocol
  @protocol
end

#read_timeoutObject

Returns the value of attribute read_timeout.



165
166
167
# File 'lib/groonga-query-log/replayer.rb', line 165

def read_timeout
  @read_timeout
end

#request_queue_sizeObject



209
210
211
# File 'lib/groonga-query-log/replayer.rb', line 209

def request_queue_size
  @request_queue_size || @n_clients * 3
end

#requests_pathObject

Returns the value of attribute requests_path.



170
171
172
# File 'lib/groonga-query-log/replayer.rb', line 170

def requests_path
  @requests_path
end

#responses_pathObject

Returns the value of attribute responses_path.



171
172
173
# File 'lib/groonga-query-log/replayer.rb', line 171

def responses_path
  @responses_path
end

#target_command_namesObject

Returns the value of attribute target_command_names.



169
170
171
# File 'lib/groonga-query-log/replayer.rb', line 169

def target_command_names
  @target_command_names
end

Instance Method Details

#create_client(&block) ⇒ Object



189
190
191
192
193
194
195
# File 'lib/groonga-query-log/replayer.rb', line 189

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



205
206
207
# File 'lib/groonga-query-log/replayer.rb', line 205

def create_error_responses_output(&block)
  create_output(@error_responses_path, &block)
end

#create_request_output(&block) ⇒ Object



197
198
199
# File 'lib/groonga-query-log/replayer.rb', line 197

def create_request_output(&block)
  create_output(@requests_path, &block)
end

#create_responses_output(&block) ⇒ Object



201
202
203
# File 'lib/groonga-query-log/replayer.rb', line 201

def create_responses_output(&block)
  create_output(@responses_path, &block)
end

#disable_cache?Boolean

Returns:

  • (Boolean)


213
214
215
# File 'lib/groonga-query-log/replayer.rb', line 213

def disable_cache?
  @disable_cache
end

#target_command_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


217
218
219
220
221
222
223
224
# File 'lib/groonga-query-log/replayer.rb', line 217

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