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.



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/groonga-query-log/server-verifier.rb', line 245

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 = []
  @rewrite_nullable_reference_number = false
  @nullable_reference_number_accessors = []
  @rewrite_not_or_regular_expression = false
  @rewrite_and_not_operator = false
end

Instance Attribute Details

#care_orderObject

Returns the value of attribute care_order.



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

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.



231
232
233
# File 'lib/groonga-query-log/server-verifier.rb', line 231

def disable_cache=(value)
  @disable_cache = value
end

#groonga1Object (readonly)

Returns the value of attribute groonga1.



227
228
229
# File 'lib/groonga-query-log/server-verifier.rb', line 227

def groonga1
  @groonga1
end

#groonga2Object (readonly)

Returns the value of attribute groonga2.



228
229
230
# File 'lib/groonga-query-log/server-verifier.rb', line 228

def groonga2
  @groonga2
end

#ignored_drilldown_keysObject

Returns the value of attribute ignored_drilldown_keys.



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

def ignored_drilldown_keys
  @ignored_drilldown_keys
end

#n_clientsObject

Returns the value of attribute n_clients.



229
230
231
# File 'lib/groonga-query-log/server-verifier.rb', line 229

def n_clients
  @n_clients
end

#nullable_reference_number_accessorsObject

Returns the value of attribute nullable_reference_number_accessors.



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

def nullable_reference_number_accessors
  @nullable_reference_number_accessors
end

#output_pathObject

Returns the value of attribute output_path.



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

def output_path
  @output_path
end

#request_queue_sizeObject



277
278
279
# File 'lib/groonga-query-log/server-verifier.rb', line 277

def request_queue_size
  @request_queue_size || @n_clients * 3
end

#rewrite_and_not_operator=(value) ⇒ Object (writeonly)

Sets the attribute rewrite_and_not_operator

Parameters:

  • value

    the value to set the attribute rewrite_and_not_operator to.



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

def rewrite_and_not_operator=(value)
  @rewrite_and_not_operator = value
end

#rewrite_not_or_regular_expression=(value) ⇒ Object (writeonly)

Sets the attribute rewrite_not_or_regular_expression

Parameters:

  • value

    the value to set the attribute rewrite_not_or_regular_expression to.



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

def rewrite_not_or_regular_expression=(value)
  @rewrite_not_or_regular_expression = value
end

#rewrite_nullable_reference_number=(value) ⇒ Object (writeonly)

Sets the attribute rewrite_nullable_reference_number

Parameters:

  • value

    the value to set the attribute rewrite_nullable_reference_number to.



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

def rewrite_nullable_reference_number=(value)
  @rewrite_nullable_reference_number = value
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.



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

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.



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

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.



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

def stop_on_failure=(value)
  @stop_on_failure = value
end

#target_command_namesObject

Returns the value of attribute target_command_names.



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

def target_command_names
  @target_command_names
end

#vector_accessorsObject

Returns the value of attribute vector_accessors.



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

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.



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

def verify_cache=(value)
  @verify_cache = value
end

Instance Method Details

#disable_cache?Boolean

Returns:

  • (Boolean)


281
282
283
# File 'lib/groonga-query-log/server-verifier.rb', line 281

def disable_cache?
  @disable_cache
end

#need_filter_rewrite?Boolean

Returns:

  • (Boolean)


338
339
340
341
342
343
344
# File 'lib/groonga-query-log/server-verifier.rb', line 338

def need_filter_rewrite?
  rewrite_vector_equal? or
    rewrite_vector_not_equal_empty_string? or
    rewrite_nullable_reference_number? or
    rewrite_not_or_regular_expression? or
    rewrite_and_not_operator?
end

#open_output(&block) ⇒ Object



323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/groonga-query-log/server-verifier.rb', line 323

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_and_not_operator?Boolean

Returns:

  • (Boolean)


309
310
311
# File 'lib/groonga-query-log/server-verifier.rb', line 309

def rewrite_and_not_operator?
  @rewrite_and_not_operator
end

#rewrite_not_or_regular_expression?Boolean

Returns:

  • (Boolean)


305
306
307
# File 'lib/groonga-query-log/server-verifier.rb', line 305

def rewrite_not_or_regular_expression?
  @rewrite_not_or_regular_expression
end

#rewrite_nullable_reference_number?Boolean

Returns:

  • (Boolean)


301
302
303
# File 'lib/groonga-query-log/server-verifier.rb', line 301

def rewrite_nullable_reference_number?
  @rewrite_nullable_reference_number
end

#rewrite_vector_equal?Boolean

Returns:

  • (Boolean)


293
294
295
# File 'lib/groonga-query-log/server-verifier.rb', line 293

def rewrite_vector_equal?
  @rewrite_vector_equal
end

#rewrite_vector_not_equal_empty_string?Boolean

Returns:

  • (Boolean)


297
298
299
# File 'lib/groonga-query-log/server-verifier.rb', line 297

def rewrite_vector_not_equal_empty_string?
  @rewrite_vector_not_equal_empty_string
end

#stop_on_failure?Boolean

Returns:

  • (Boolean)


289
290
291
# File 'lib/groonga-query-log/server-verifier.rb', line 289

def stop_on_failure?
  @stop_on_failure
end

#target_command_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


313
314
315
316
317
318
319
320
321
# File 'lib/groonga-query-log/server-verifier.rb', line 313

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



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/groonga-query-log/server-verifier.rb', line 346

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,
    :rewrite_nullable_reference_number =>
      rewrite_nullable_reference_number?,
    :nullable_reference_number_accessors =>
      nullable_reference_number_accessors,
    :rewrite_not_or_regular_expression =>
      rewrite_not_or_regular_expression?,
    :rewrite_and_not_operator =>
      rewrite_and_not_operator?,
  }
end

#verify_cache?Boolean

Returns:

  • (Boolean)


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

def verify_cache?
  @verify_cache
end