Module: Voltdb::ClientResponseUtils
- Defined in:
- lib/voltdb/client_response_utils.rb
Class Method Summary collapse
-
.map_client_response_result(client_response, index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object, Object>
This method is used for mapping VoltTableRows to an object.
-
.map_first_row_from_client_response_result(client_response, index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object>
This method is used for mapping the first row from a VoltTableRow to an object.
-
.validate_client_response_status(client_response) ⇒ Object
Checks that the status of the client response is SUCCESS.
Instance Method Summary collapse
-
#map(index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object, Object>
This method is used when we extend the Voltdb ClientResponse interface and it’s used for mapping VoltTableRows to an object.
-
#map_first_row(index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object>
This method is used when we extend the Voltdb ClientResponse interface and it’s used for mapping the first row from a VoltTableRow to an object.
-
#validate_status ⇒ client_response
This method is used when we extend the Voltdb ClientResponse interface and it’s used for valitation on the client response.
Class Method Details
.map_client_response_result(client_response, index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object, Object>
This method is used for mapping VoltTableRows to an object. It receives the index of the VoltTable that we want to map and a block that will be executed in that context
17 18 19 20 |
# File 'lib/voltdb/client_response_utils.rb', line 17 def self.map_client_response_result(client_response, index, validate_status = true, &block) validate_client_response_status(client_response) if (validate_status) VoltTableUtils.map_volt_table(client_response.get_results[index], &block) end |
.map_first_row_from_client_response_result(client_response, index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object>
This method is used for mapping the first row from a VoltTableRow to an object. It receives the index of the VoltTable that we want to map and a block that will be executed in that context
32 33 34 35 |
# File 'lib/voltdb/client_response_utils.rb', line 32 def self.map_first_row_from_client_response_result(client_response, index, validate_status = true, &block) validate_client_response_status(client_response) if (validate_status) VoltTableUtils.map_first_row_from_volt_table(client_response.get_results[index], &block) end |
.validate_client_response_status(client_response) ⇒ Object
Checks that the status of the client response is SUCCESS. If not, it throws an exception
45 46 47 48 49 50 51 |
# File 'lib/voltdb/client_response_utils.rb', line 45 def self.validate_client_response_status(client_response) unless ClientResponse.SUCCESS == client_response.get_status raise ClientResponseStatusError.new(client_response) end client_response end |
Instance Method Details
#map(index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object, Object>
This method is used when we extend the Voltdb ClientResponse interface and it’s used for mapping VoltTableRows to an object. It receives the index of the VoltTable that we want to map and a block that will be executed in that context
61 62 63 |
# File 'lib/voltdb/client_response_utils.rb', line 61 def map(index, validate_status = true, &block) ClientResponseUtils.map_client_response_result(self, index, validate_status, &block) end |
#map_first_row(index, validate_status = true) {|VoltTableRow| ... } ⇒ Array<Object>
This method is used when we extend the Voltdb ClientResponse interface and it’s used for mapping the first row from a VoltTableRow to an object. It receives the index of the VoltTable that we want to map and a block that will be executed in that context
73 74 75 |
# File 'lib/voltdb/client_response_utils.rb', line 73 def map_first_row(index, validate_status = true, &block) ClientResponseUtils.map_first_row_from_client_response_result(self, index, validate_status, &block) end |
#validate_status ⇒ client_response
This method is used when we extend the Voltdb ClientResponse interface and it’s used for valitation on the client response
81 82 83 |
# File 'lib/voltdb/client_response_utils.rb', line 81 def validate_status ClientResponseUtils.validate_client_response_status(self) end |