class GroongaQueryLog::Replayer::Options
Attributes
disable_cache[W]
error_responses_path[RW]
host[RW]
n_clients[RW]
output_type[RW]
port[RW]
protocol[RW]
read_timeout[RW]
request_queue_size[W]
requests_path[RW]
responses_path[RW]
target_command_names[RW]
Public Class Methods
new()
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 180 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
Public Instance Methods
create_client(&block)
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 195 def create_client(&block) Groonga::Client.open(:host => @host, :port => @port, :protocol => @protocol, :read_timeout => @read_timeout, &block) end
create_error_responses_output(&block)
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 211 def create_error_responses_output(&block) create_output(@error_responses_path, &block) end
create_request_output(&block)
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 203 def create_request_output(&block) create_output(@requests_path, &block) end
create_responses_output(&block)
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 207 def create_responses_output(&block) create_output(@responses_path, &block) end
disable_cache?()
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 219 def disable_cache? @disable_cache end
request_queue_size()
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 215 def request_queue_size @request_queue_size || @n_clients * 3 end
target_command_name?(name)
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 223 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
Private Instance Methods
create_output(path) { |$stdout| ... }
click to toggle source
# File lib/groonga-query-log/replayer.rb, line 233 def create_output(path, &block) case path when nil NullOutput.open(&block) when "-" yield($stdout) else File.open(path, "w", &block) end end