Class: Groonga::QueryLog::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.



143
144
145
146
147
148
149
150
151
# File 'lib/groonga/query-log/server-verifier.rb', line 143

def initialize
  @groonga1 = GroongaOptions.new
  @groonga2 = GroongaOptions.new
  @n_clients = 8
  @request_queue_size = nil
  @disable_cache = false
  @output_path = nil
  @target_command_names = ["select"]
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.



140
141
142
# File 'lib/groonga/query-log/server-verifier.rb', line 140

def disable_cache=(value)
  @disable_cache = value
end

#groonga1Object (readonly)

Returns the value of attribute groonga1.



136
137
138
# File 'lib/groonga/query-log/server-verifier.rb', line 136

def groonga1
  @groonga1
end

#groonga2Object (readonly)

Returns the value of attribute groonga2.



137
138
139
# File 'lib/groonga/query-log/server-verifier.rb', line 137

def groonga2
  @groonga2
end

#n_clientsObject

Returns the value of attribute n_clients.



138
139
140
# File 'lib/groonga/query-log/server-verifier.rb', line 138

def n_clients
  @n_clients
end

#output_pathObject

Returns the value of attribute output_path.



142
143
144
# File 'lib/groonga/query-log/server-verifier.rb', line 142

def output_path
  @output_path
end

#request_queue_sizeObject



153
154
155
# File 'lib/groonga/query-log/server-verifier.rb', line 153

def request_queue_size
  @request_queue_size || @n_clients * 3
end

#target_command_namesObject

Returns the value of attribute target_command_names.



141
142
143
# File 'lib/groonga/query-log/server-verifier.rb', line 141

def target_command_names
  @target_command_names
end

Instance Method Details

#create_output(&block) ⇒ Object



169
170
171
172
173
174
175
176
# File 'lib/groonga/query-log/server-verifier.rb', line 169

def create_output(&block)
  if @output_path
    FileUtils.mkdir_p(File.dirname(@output_path))
    File.open(@output_path, "w", &block)
  else
    yield($stdout)
  end
end

#disable_cache?Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/groonga/query-log/server-verifier.rb', line 157

def disable_cache?
  @disable_cache
end

#target_command_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


161
162
163
164
165
166
167
# File 'lib/groonga/query-log/server-verifier.rb', line 161

def target_command_name?(name)
  @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