Class: Groonga::QueryLog::Replayer::Options
- Inherits:
-
Object
- Object
- Groonga::QueryLog::Replayer::Options
- Defined in:
- lib/groonga/query-log/replayer.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#n_clients ⇒ Object
Returns the value of attribute n_clients.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
- #request_queue_size ⇒ Object
-
#target_command_names ⇒ Object
Returns the value of attribute target_command_names.
Instance Method Summary collapse
- #create_client(&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.
143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/groonga/query-log/replayer.rb', line 143 def initialize @host = "127.0.0.1" @port = 10041 @protocol = :gqtp @n_clients = 8 @request_queue_size = nil @disable_cache = false @requests_path = nil @responses_path = nil @target_command_names = ["*"] end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
137 138 139 |
# File 'lib/groonga/query-log/replayer.rb', line 137 def host @host end |
#n_clients ⇒ Object
Returns the value of attribute n_clients.
140 141 142 |
# File 'lib/groonga/query-log/replayer.rb', line 140 def n_clients @n_clients end |
#port ⇒ Object
Returns the value of attribute port.
138 139 140 |
# File 'lib/groonga/query-log/replayer.rb', line 138 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
139 140 141 |
# File 'lib/groonga/query-log/replayer.rb', line 139 def protocol @protocol end |
#request_queue_size ⇒ Object
178 179 180 |
# File 'lib/groonga/query-log/replayer.rb', line 178 def request_queue_size @request_queue_size || @n_clients * 3 end |
#target_command_names ⇒ Object
Returns the value of attribute target_command_names.
142 143 144 |
# File 'lib/groonga/query-log/replayer.rb', line 142 def target_command_names @target_command_names end |
Instance Method Details
#create_client(&block) ⇒ Object
155 156 157 158 159 160 |
# File 'lib/groonga/query-log/replayer.rb', line 155 def create_client(&block) Groonga::Client.open(:host => @host, :port => @port, :protocol => @protocol, &block) end |
#create_request_output(&block) ⇒ Object
162 163 164 165 166 167 168 |
# File 'lib/groonga/query-log/replayer.rb', line 162 def create_request_output(&block) if @requests_path File.open(@requests_path, "w", &block) else NullOutput.open(&block) end end |
#create_responses_output(&block) ⇒ Object
170 171 172 173 174 175 176 |
# File 'lib/groonga/query-log/replayer.rb', line 170 def create_responses_output(&block) if @responses_path File.open(@responses_path, "w", &block) else NullOutput.open(&block) end end |
#disable_cache? ⇒ Boolean
182 183 184 |
# File 'lib/groonga/query-log/replayer.rb', line 182 def disable_cache? @disable_cache end |
#target_command_name?(name) ⇒ Boolean
186 187 188 189 190 191 192 |
# File 'lib/groonga/query-log/replayer.rb', line 186 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 |