Class: Drnbench::RequestResponse::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/drnbench/request-response/runner.rb

Constant Summary collapse

MESSAGE_EXIT =
"exit"
MESSAGE_START =
"start"
MESSAGE_COMPLETE =
"complete"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(n_clients, config) ⇒ Runner

Returns a new instance of Runner.



31
32
33
34
35
36
37
38
# File 'lib/drnbench/request-response/runner.rb', line 31

def initialize(n_clients, config)
  n_clients = 1 if n_clients.zero?
  @n_clients = n_clients
  @config = config

  abstract = RequestPattern::Abstract.new(@config.request_patterns, @config)
  @requests = abstract.requests.shuffle
end

Instance Attribute Details

#n_clientsObject (readonly)

Returns the value of attribute n_clients.



25
26
27
# File 'lib/drnbench/request-response/runner.rb', line 25

def n_clients
  @n_clients
end

#resultObject (readonly)

Returns the value of attribute result.



25
26
27
# File 'lib/drnbench/request-response/runner.rb', line 25

def result
  @result
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/drnbench/request-response/runner.rb', line 53

def empty?
  @requests.empty?
end

#pop_requestObject



45
46
47
# File 'lib/drnbench/request-response/runner.rb', line 45

def pop_request
  @requests.pop
end

#push_result(result) ⇒ Object



49
50
51
# File 'lib/drnbench/request-response/runner.rb', line 49

def push_result(result)
  @result << result
end

#runObject



40
41
42
43
# File 'lib/drnbench/request-response/runner.rb', line 40

def run
  process_requests
  @result
end