Class: GroongaQueryLog::ServerVerifier::Options

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/groonga-query-log/server-verifier.rb', line 206

def initialize
  @groonga1 = GroongaOptions.new
  @groonga2 = GroongaOptions.new
  @n_clients = 8
  @request_queue_size = nil
  @disable_cache = false
  @output_path = nil
  @output_opened = false
  @target_command_names = [
    "io_flush",
    "logical_count",
    "logical_range_filter",
    "logical_shard_list",
    "logical_select",
    "normalize",
    "object_exist",
    "select",
    "status",
  ]
  @care_order = true
  @verify_cache = false
  @ignored_drilldown_keys = []
  @stop_on_failure = false
  @rewrite_vector_equal = false
  @rewrite_vector_not_equal_empty_string = false
  @vector_accessors = []
end

Instance Attribute Details

#care_orderObject

Returns the value of attribute care_order.



199
200
201
# File 'lib/groonga-query-log/server-verifier.rb', line 199

def care_order
  @care_order
end

#disable_cache=(value) ⇒ Object (writeonly)

Sets the attribute disable_cache

Parameters:

  • value

    the value to set the attribute disable_cache to.



196
197
198
# File 'lib/groonga-query-log/server-verifier.rb', line 196

def disable_cache=(value)
  @disable_cache = value
end

#groonga1Object (readonly)

Returns the value of attribute groonga1.



192
193
194
# File 'lib/groonga-query-log/server-verifier.rb', line 192

def groonga1
  @groonga1
end

#groonga2Object (readonly)

Returns the value of attribute groonga2.



193
194
195
# File 'lib/groonga-query-log/server-verifier.rb', line 193

def groonga2
  @groonga2
end

#ignored_drilldown_keysObject

Returns the value of attribute ignored_drilldown_keys.



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

def ignored_drilldown_keys
  @ignored_drilldown_keys
end

#n_clientsObject

Returns the value of attribute n_clients.



194
195
196
# File 'lib/groonga-query-log/server-verifier.rb', line 194

def n_clients
  @n_clients
end

#output_pathObject

Returns the value of attribute output_path.



198
199
200
# File 'lib/groonga-query-log/server-verifier.rb', line 198

def output_path
  @output_path
end

#request_queue_sizeObject



234
235
236
# File 'lib/groonga-query-log/server-verifier.rb', line 234

def request_queue_size
  @request_queue_size || @n_clients * 3
end

#rewrite_vector_equal=(value) ⇒ Object (writeonly)

Sets the attribute rewrite_vector_equal

Parameters:

  • value

    the value to set the attribute rewrite_vector_equal to.



203
204
205
# File 'lib/groonga-query-log/server-verifier.rb', line 203

def rewrite_vector_equal=(value)
  @rewrite_vector_equal = value
end

#rewrite_vector_not_equal_empty_string=(value) ⇒ Object (writeonly)

Sets the attribute rewrite_vector_not_equal_empty_string

Parameters:

  • value

    the value to set the attribute rewrite_vector_not_equal_empty_string to.



204
205
206
# File 'lib/groonga-query-log/server-verifier.rb', line 204

def rewrite_vector_not_equal_empty_string=(value)
  @rewrite_vector_not_equal_empty_string = value
end

#stop_on_failure=(value) ⇒ Object (writeonly)

Sets the attribute stop_on_failure

Parameters:

  • value

    the value to set the attribute stop_on_failure to.



202
203
204
# File 'lib/groonga-query-log/server-verifier.rb', line 202

def stop_on_failure=(value)
  @stop_on_failure = value
end

#target_command_namesObject

Returns the value of attribute target_command_names.



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

def target_command_names
  @target_command_names
end

#vector_accessorsObject

Returns the value of attribute vector_accessors.



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

def vector_accessors
  @vector_accessors
end

#verify_cache=(value) ⇒ Object (writeonly)

Sets the attribute verify_cache

Parameters:

  • value

    the value to set the attribute verify_cache to.



200
201
202
# File 'lib/groonga-query-log/server-verifier.rb', line 200

def verify_cache=(value)
  @verify_cache = value
end

Instance Method Details

#disable_cache?Boolean

Returns:

  • (Boolean)


238
239
240
# File 'lib/groonga-query-log/server-verifier.rb', line 238

def disable_cache?
  @disable_cache
end

#need_filter_rewrite?Boolean

Returns:

  • (Boolean)


283
284
285
286
# File 'lib/groonga-query-log/server-verifier.rb', line 283

def need_filter_rewrite?
  rewrite_vector_equal? or
    rewrite_vector_not_equal_empty_string?
end

#open_output(&block) ⇒ Object



268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/groonga-query-log/server-verifier.rb', line 268

def open_output(&block)
  if @output_path
    if @output_opened
      mode = "a"
    else
      FileUtils.mkdir_p(File.dirname(@output_path))
      mode = "w"
      @output_opened = true
    end
    File.open(@output_path, mode, &block)
  else
    yield($stdout)
  end
end

#rewrite_vector_equal?Boolean

Returns:

  • (Boolean)


250
251
252
# File 'lib/groonga-query-log/server-verifier.rb', line 250

def rewrite_vector_equal?
  @rewrite_vector_equal
end

#rewrite_vector_not_equal_empty_string?Boolean

Returns:

  • (Boolean)


254
255
256
# File 'lib/groonga-query-log/server-verifier.rb', line 254

def rewrite_vector_not_equal_empty_string?
  @rewrite_vector_not_equal_empty_string
end

#stop_on_failure?Boolean

Returns:

  • (Boolean)


246
247
248
# File 'lib/groonga-query-log/server-verifier.rb', line 246

def stop_on_failure?
  @stop_on_failure
end

#target_command_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


258
259
260
261
262
263
264
265
266
# File 'lib/groonga-query-log/server-verifier.rb', line 258

def target_command_name?(name)
  return false if name.nil?

  @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

#to_filter_rewriter_optionsObject



288
289
290
291
292
293
294
295
# File 'lib/groonga-query-log/server-verifier.rb', line 288

def to_filter_rewriter_options
  {
    :rewrite_vector_equal => rewrite_vector_equal?,
    :rewrite_vector_not_equal_empty_string =>
      rewrite_vector_not_equal_empty_string?,
    :vector_accessors => vector_accessors,
  }
end

#verify_cache?Boolean

Returns:

  • (Boolean)


242
243
244
# File 'lib/groonga-query-log/server-verifier.rb', line 242

def verify_cache?
  @verify_cache
end