Class: Drnbench::RequestResponse::Runner
- Inherits:
-
Object
- Object
- Drnbench::RequestResponse::Runner
- Defined in:
- lib/drnbench/request-response/runner.rb
Constant Summary collapse
- MESSAGE_EXIT =
"exit"
- MESSAGE_START =
"start"
- MESSAGE_COMPLETE =
"complete"
Instance Attribute Summary collapse
-
#n_clients ⇒ Object
readonly
Returns the value of attribute n_clients.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(n_clients, config) ⇒ Runner
constructor
A new instance of Runner.
- #pop_request ⇒ Object
- #push_result(result) ⇒ Object
- #run ⇒ Object
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_clients ⇒ Object (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 |
#result ⇒ Object (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
53 54 55 |
# File 'lib/drnbench/request-response/runner.rb', line 53 def empty? @requests.empty? end |
#pop_request ⇒ Object
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 |
#run ⇒ Object
40 41 42 43 |
# File 'lib/drnbench/request-response/runner.rb', line 40 def run process_requests @result end |